PDA

View Full Version : External Navbar (CSS or XML?)



boswell255
September 3rd, 2007, 05:49 PM
Forgive me I'm a total newb at web design but I was wondering if it was at all posible to build an external navbar using something like CSS or XML.

The reason I ask is because I have a site with quite a few pages, and it's likely I'll be needing to update the navbar from time to time. I'd rather not have to change every single page. I thought perhaps this could be accomplished via something like XML (I've seen similar things done in Flash, but I've scoured the internet and can't find anything for HTML.)

It really is just simple text links such as:

Home| About| Stuff | More Stuff etc.

It's probably something really simple that even preschool children can do, hence the lack of tutorials around, but like I said I really am quite inept at this sort of thing.

It'd be nice if I could style it with CSS too :)

Any help appreciated :thumb:

Steve.

thomjjames
September 4th, 2007, 04:24 AM
Hi,

Yes you could do this with Flash and XML or probably more simple, you could use a PHP include or require, so you will obviously need PHP installed. I know this is the client-side forum but this is how i'd do it.

here's how do to it:
1. Put your navigation links in a separate file and call it navigation.inc.
It should just contain the navigation links and no HTML head or body tags.
(you may want to get it working as part of the page first and then put the navigation in a separate file)

2. Next open up your page and copy and paste the following where you want your navigation to appear:



<?php include_once(dirname(__FILE__).DIRECTORY_SEPARATOR ."navigation.inc"); ?>


3. Next save you page as a PHP file by changing the .html extension to .php.

this way your singular navigation file is included on every page so changes to that file will be reflected site-wide.

you could also use this technique for other parts of your page like the page header or footer.

hope that helps
Tom

boswell255
September 4th, 2007, 03:56 PM
That's exactly what I was looking for!

It works perfectly too!

Thanks Tom, I owe you one :beer:!

Steve.

thomjjames
September 6th, 2007, 04:36 PM
No worries, glad to be of help!(-:

Tom



That's exactly what I was looking for!

It works perfectly too!

Thanks Tom, I owe you one :beer:!

Steve.