Fresh Pages with PHP | |
|
Here we show how even a novice can keep static pages fresh with php. Why would you want to do this? Search engines prefer pages that are edited every now and again - pages that have fresh content. Here is a method you can use to keep even the most boring static page automagically fresh.
What is fresh PHP generated contentHere we define fresh content as a paragraph or more of text which is preferably unique on the web, and which is changed on a daily to monthly basis. It is best if this content is changed at random intervals, matching the way edits are made on real sites.Here is some automagically maintained content: Here at webmaster alpha we can show you how to produce fresh scripted content using very simple methods. ![]() fresh scripted content We hope this information helps you build the website that you dream about. A link back would be appreciated. Here is the function used to generate this content and some instructions for modifying it to suit your pages:
PHP Automagic content scriptTo use this script on a plain html page, first change the extension of the file from htm or html to php, ie mypage.htm would become mypage.php and delete the original htm/html file. Edit your new php file, the first line should consist of: <?php Then paste in the script from the textbox above, so that it appears above the <html> tag in your file and below the first line you just added. Next add a line just above the <html> tag with just: ?> The script can then be called from inside the html on your page where you want it to appear like this: <?php phpcontent(" php generated content "," fresh content ") ?>
Modifying the PHP Automagic content scriptThis is how the script works. First we touch a timer file. Touch just makes sure the file exists and creates it if it does not preventing any errors. You can of course change the name of the file to what you like, just remember to change all occurances of it. Tip: I tend to name all infrequently manually edited files Z- something since this puts them at the bottom of the directory listing out of the way!Then we pull the file into $timer which since the file has two lines in it will then be an array, the first line in the file which is the time-out beyond which we change the contents is $timer[0] and the second line which is the seed for the random number generator is $timer[1]. time() returns the unix timestamp in seconds, we check to see whether this is larger than our time-out. If it is then we set the random number seed to the current time (in seconds), then we set the time out to be this current time plus a random number of seconds between 86400 (1 day) and 1728000 (20 days). You can change these numbers to suit yourself. Then we save the new timeout and seed to the file. Note no change will occur until the next page load! We set the seed for the random number generator to be equal to the second line in the file - intval is needed to force the type of the line to integer and avoid an error since lines read from files are by default of type string. The way random number generators work is by operating on a seed value, given the same seed value a random number generator will always produce the same series of numbers. By specifying a value we ensure the random content will always be the same until we change that number. Php automatically initialises the generator with a different number each time it is loaded, by specifying a value here we are stopping that default behaviour. Now we decide which of the two topics we are going to write about. Lets say you have a page on donuts and you are targetting the keywords 'Manhattan Donuts' and 'Creme Donuts' then these can be your two topics when you call the routine from your html code. When the code changes it will pick one at random. You could easily rewrite to pick from more than two topics, or from a list in an external file. We build an array of sentences with the keyword $topic where we want our topics to appear. For this example I have done a smaller number of sentences than I normally would. Often I will do 10 introductory sentences, 10 images, 10 middle sentences, 10 end sentences and 4-5 sign-off sentences. This gives you 80,000 combinations with two topics. You can put any html you want in the sentences, links, images, and so on. The important thing is that they are organised into functional groups so you can put them together in the right order and they will always read properly no matter which your script selects. Now we put together our 'blurb' by selecting one sentence at random from each group and echo it to the screen. Please write your own sentences that suit your application, this will stop the search engines from detecting any signatures.
You are welcome to use any or all of this code. A link back would be nice!
|
Useful Pages
PHP Fresh Page Referrersbookmark hitinternal hit www.google.nl ... ... www.scispace.com luvox.blog.fc2.com www.netvibes.com ... ... lamisil.blog.fc2.com ... diovan.blog.fc2.com ... ... crestor.blog.fc2.com ... www.minkpink.net ... www.getjealous.com ... ... ... www.google.com ... ... ... amaryl.blog.fc2.com www.google.co.in vip.asus.com www.facebook.com ... ... ... ... ... www.azcentral.com es-es.facebook.com ... www.everyoneweb.be www.google.com.np www.beerbrew.net www.google.com.kh yandex.ru www.google.com.au This list of people who link to this useful page is automagically maintained. Link to us, send traffic, and get listed. Simple. |