|
|
|||||||
|
OK to do this you will need a minimum of 3 files. One .php and two .html. The idea is that a page is requested in the URL, for example www.site.com/index.php?page=plumbing. In the PHP file you need to first find out what page is requested. So in the <head> tag we first do a command to find the value for 'page'. <?php $page = $_GET['page']; $html = ".html"; if ($page == '') { $page2 = 'main'; } else { $page2 = $page; } ?> What this does is first opens up PHP, next it finds the value for 'page'. It assigns this value to the variable $page. The next part assigns a value to the variable $html. After this an 'if' statement is run which checks to see if 'page' has a value, if it does then it assigns the value of 'page' to 'page2', if it doesn't have a value then it assigns a default value, such as main (which would load main.html in the main part). Then were you want the requested page to show put this code <?php include "$page2" . "$html"; ?> Which tells the server to include the value of page2.html. Which means that it finds the variable 'page2' and adds .html to the end and asks it to be shown. Just a note that if you don't have the page that is requested (i.e. there is a typo) you will get a php error because I haven't written the part to check it displays properly. The next part is to make the files which will be included. All you need to do is make a page like normal, but omit everything but what is in the <body> tags. So for example if your page is <html> <head> <title>Example</title> </head> <body> Example text </body> </html> you need to change it to Example text. Hope this helps Please post your website address when asking for help! *Nanook http://www.bains007.co.uk << Under redevelopment Donate via PayPal |