Installing PHP


Ok, to start off this tutorial I will just talk a little about the benefits of using PHP. First off and most helpfull if you are not using SSI or PHP is that it makes updating your site very simple. Instead of changing every page when you want to add a new page to the menus you only have to change one page and it will automatically change all of them! If you are using SSI now, then switching to PHP will also make your site load a little faster, one thing Im sure we are always trying to do. Also in SSI you have to put thoes two codes in every file, which gets very annoying. PHP doesnt require to put anything but the actual content in the file.

Ok, now you know why to swtich to PHP, now you can learn.
1. First go through and get the layout code from your files. An easy way to do that is just to go to one of your pages, view source, copy that to notepad and deleat all the content from that page. Ok, now where the content was, and where you want any info you type to be, add this code instead:
<?php include ("$page.extension"); ?>
Your gonna want to customize that a bit. Where it says page you can add your site's ID numbers, like I would use TF but it can really be anything you want. And where it says extension you will add what page extension you are using. I use txt but if your switching from SSI then you might want to use .shtml. Now save this file as index.php or main.php.

Now your gonna want to get your content pages ready to use PHP. If your using SSI now then just go and deleat all the layout codes from the files. If your not then go and deleat all the layout tags and everything relating to that, so your left with just the content for that page. Also make sure all the files are ending with the tag you chose, like page.txt, because if theyr not then it wont work.

Now your gonna make the pages show the layout. In order to do that you need to make the URL that you use to get to the page make the layout show. I would suggest reading this through a few times so you know what your doing, then follow along.
Start with your URL and add a backslash to it, like this:
http://www.yoururl.com/
Easy enough, right. Now add the page name you are using for the layout file, either main.php or index.php. SO you have this:
http://www.yoururl.com/index.php
Next add a question mark (?) and the page ID you chose (the letters you replaced page with.) ANd after the ID add a equils sign (=).
http://www.yoururl.com/index.php?id=
That is the code. Now you add to that the page name without the extension. Lets say Im gonna make goldinfo.txt show up. I would add this:
http://www.yoururl.com/index.php?id=goldinfo
Now, try putting that customized URL in the URL box and see if ti showes the URL. If it does then you have successfully installed PHP. Now go and change all the URLs in the layout file to match the one above but with the appropriate file name.
If it didnt work then I would be happy to help you so that it will, just e-mail me at Matt@johtofalls.com.

I hope this tutorial helped you out a little, enjoy your easy-to-update site!