![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Registered User
Join Date: Jul 2007
Posts: 8
|
Dynamic content with PHP or javascript
Hi everyone
I'm working on my new site (a free pics and vids), is there another way to built a dynamic site then using PHP because i don't want to rename all my pages to .php . I saw other websites with dynamic menu, ad space, refferrer list... all the stuff added to all pages of the site and they use .html If they use javascript to add HTML to their pages, how it work, because when check the source code of their pages, I see HTML codes. Is Google bot can see their HTML codes for SEO reasons? I want to use javascript to include HTML codes to my pages like I did with PHP Maybe I miss something, I need some help, Thanks
__________________
Redmark ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Oct 2011
Posts: 474
|
You need .htaccess to remove the .php
__________________
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 |
Registered User
Industry Role:
Join Date: Mar 2013
Posts: 26
|
Actually you miss a lot of things.
![]()
__________________
pervypig.com |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Registered User
Join Date: Jul 2007
Posts: 8
|
What most webmasters do to include html code to their pages like a menu on top of every pages of the site that can be updated without manually change all these pages.
What is the right way to do this for seo, server speed and user friendly I need step by step details for server configuration Thanks in advance
__________________
Redmark ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 | |
Web Developer
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
|
Quote:
Ok you have two methods, you could use .htaccess to map all the .php files to be .htm, but this involves using a reasonable structure as the rules can be fiddly if you have a lot of subdirectories of different depths that you need to display content from. or as previously suggested get the server to parse all .html / .htm files as php. This is something which can backfire if you're not careful as it will evaluate all .html / .htm files, which could slow the server down if it's only a handful which need to be php. Showing standard menu across top of site You can either create a standard template and have that used across the site, then you only need to update the template (this involves some forward planning, but can be good if you what to have a dynamic site). Or you can include the menu on all the pages you need (same with the footer info), to do this you can write it as Code:
<?php @include_once("menu.php"); # For your menu @include_once("footer.php"); # For your footer # ..... you can carry this on for as many elements you want. ?> Personally I would create one template and then link all the pages up and feed them in through $_GET[] in the url's and it would have the page names being mapped by a .htaccess file using mod_rewrite functions. It might sound a little complicated to start with but it will pay off if you're creating a site which needs to be able to grow and expand quickly without the need to create every single page, take for example http://livegfcam.com this creates all the pages and links you see dynamically, all I have done is write the template, directory mapping and layout, if you looked at the server there are only a handful of files and the directories you see in the URL do not exist. I use this solution as I know php well enough to be able to create a lot of my content on the fly, what I would suggest is to think about what you want to do, google the question then if you can't understand the answer either post on the forums or if you don't want to do that, you can always drop me an email rob [at] foxydrop [dot] com An example from a project I'm currently doing (edited down to remove some of my features so you can get an idea) Example index.php Code:
<?php ob_start(); ## FTGP V 2.0 :D ## @require_once("config.php"); $url = str_replace("www.","",$_SERVER["HTTP_HOST"]); $sq = @mysql_query("select * from sites where address='".$url."' limit 0,1"); $tgps = @mysql_fetch_assoc($sq); $sitename = $tgps['title']; ?><html> <head> <title><?php echo $sitename; ?></title> <link href="/style.css" rel="stylesheet"> </head> <body> <img src="/title/<?php echo $tgps['title']; ?>.jpg" alt="<?php echo $sitename; ?>"> <div id="wrapper"> <?php if($_GET['page']== "index" || empty($_GET['page'])) $_GET['page'] = "home"; if(file_exists($_GET['page'].".php")){ include_once($_GET['page'].".php"); } else { include_once("home.php"); } ?> <div style="clear:both"></div> </div> <div id="foot"> <!-- Footer info here --> </div> <span style="clear:both"> </span> </body> </html><?php ob_end_flush(); ?> Code:
#start .htaccess code ## FTGP 2 by FoxyDrop.com ## RewriteEngine On RewriteBase / ####### Security ####### <FilesMatch ?\.(htaccess|htpasswd|ini|pg|eps|log|sh)$?> Deny from all </FilesMatch> ## Lock Directories ## Options -Indexes -MultiViews +FollowSymlinks ## Hotlink Protection RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?(top\.)?foxydrop.com [NC] RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] ####### House Keeping ####### ## Error Pages ## ErrorDocument 401 /?pg=404&error=401 ErrorDocument 403 /?pg=404&error=403 ErrorDocument 404 /?pg=404&error=404 ErrorDocument 500 /?pg=404&error=500 ####### Clean URLS ####### ## General ## RewriteRule ^([^/\.]+).htm?$ index.php?page=$1 [L] RewriteRule ^sitemap.xml?$ sitemap.php [L] Also just to point out the actual working parts of the site like the actual pages which are being included are the ones which have most of the code in this is just the template part of the site. Hope this helps Rob |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Apr 2013
Posts: 122
|
for dynamic content site, you need to use php.
and if you want html as an extension then you need to use htaccess rewrite rules. or you can add single line in httpd.conf on your server to treat .html files as .php files. this way you can create php coded files with .html extension like you said. good luck. |
![]() |
![]() ![]() ![]() ![]() |