build-website-header
spacer-image
 

 

PHP Navigation


Navigation appears on every page of you site and on most sites the navigation is the same on every page.

This presents the problem of what happens when you want to change the navigation?

Well if you have a static pure HTML website then you will need to change every page and upload the new pages to your website.

There are a few tricks that you can employ to make this easier but by far the best option for large sites is to use php include files for the navigation

Done this way you will only need to change the navigation file and the entire site navigation will be changed.

So lets take a look at an example. Here is a test page that uses include files for the navigation.

 

<html>

<body>

<?

include("navigation.htm");

?>

main text

</body>

</html>

 

here is the navigation file.

If you click here you can see the result.

Although it is rather simple it is very powerful we have now separated the navigation from the page content.

If you think that your site is going to grow to more than 50 pages then I would recommend you consider

Related Articles: