How to repeat navigation area on all pages
Hi everyone -
This is pretty basic, I think, but I'm a beginner..
In writing a strict XHTML site, what's the 'best practice' way to keep the same top/side nav across multiple pages of a site so that I just have to edit one place to change it on all pages? Then each page would have a content area specific to the page.
I appreciate any guidance!
Thanks,
greg posted this at 12:48 — 4th January 2009.
He has: 1,581 posts
Joined: Nov 2005
The most common method is using a server side language such as PHP, and 'including' another file.
Something like "header.php" which would be all your most common used requirements (nav links etc) and can be included in each page as required.
decibel.places posted this at 14:19 — 4th January 2009.
He has: 1,494 posts
Joined: Jun 2008
There is a tutorial on Tizag that explains what you want to achieve
You could also do it with a JavaScript file, but PHP is a better choice.
webwiz posted this at 19:16 — 5th January 2009.
He has: 629 posts
Joined: May 2007
If your host allows it, Server Side Includes (SSI) is a simple solution.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.