Forum Moderators: not2easy

Message Too Old, No Replies

CSS Nav Bar

         

Sothpaw

7:59 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



ok... so i use Frame Pages to set up my nav bar.
the idea was so that whenever i needed to add or change a link i didn't need to do it to all million pages.
i would love it if CSS provided a solution that i could set up a DIV or something that accessed the nav bar information from another file so i could change just that one file and the nave bar is magically changed on every page.
any ideas? articles?
thanks,

abbeyvet

8:05 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It isn't CSS you want for that, its include pages, which will do exactly as you describe. Look it up, there are various different ways of doing it - ASP PHP etc.

CSS is a styling thing, so of course you can use CSS to style your navigation no matter what you use to include the page. A good place to look for example of CSS navigation bars is listamatic.

Sothpaw

8:12 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



that's exactly the sort of answer i was looking for.
thanks a mil.

graphicsguy948

8:28 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



I do this for a lot of my navigation and/or redundant info on my pages by using the <script> tag:

<div id="siteInfo">
<SCRIPT language="JavaScript"src="../scripts/footer.js"></SCRIPT>
</div>

My javascript document is named footer.js and consists of this:

// JavaScript Document
<!--
document.write ('&copy;2006-2007 ABC Company');
//-->

I have some files that are quite long, that's just the footer example.

I script ALL e-mail addresses this way so search-bots won't pick them up.

Sometimes I will add the <noscript> tag so people with their javascripting off will know why they aren't seeing anything...or in the case of e-mail addresses I will write "abc AT abccompany DOT com" in the <noscript> tag.

It's the best way I've discovered to change one file instead of hundreds.

Sothpaw

9:29 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



so basically you use Java Script to include a page... this includes stuff is a new learning curve... well i wish i had found out about this 5 years ago. thanks.

Fotiman

9:33 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Using JavaScript to "include" a page is a bad idea. Users with JavaScript disabled will not see that page.

Sothpaw

9:37 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



ok so i'll use SSI (server side includes) instead
any negative feedback on SSI...?

graphicsguy948

10:13 pm on Jun 19, 2007 (gmt 0)

10+ Year Member



so basically you use Java Script to include a page...

Not a whole page, mind you, just portions of a page.

It's not a perfect method, as mentioned, due to the possibility of people having their javascripting disabled.

I was willing to make the tradeoff because MOST of our clientele (in my employer's industry) most likely will NOT have their javascripting disabled. I would personally guess that most computer user's out there do not turn off their javascripting, but that is just a guess based on generalization - most people like defaults, nerds like customization. ;)

I've had the company site using the javascript includes for two years now and no one has complained...plus I have enough redundant linking that the site is navigable without the scripting as well.

abbeyvet

10:15 pm on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To use SSI you will either have to give your pages an .shtml extension, or confgiure the server to parse .html pages for SSI. The latter is much preferable, especially if you have existing pages which are indexed in search engines.

Personally I'd go for PHP or ASP. There is nothing to choose between them and SSI for just including pages, but having the ability to use scripting for other things is very useful. You don't know what sort of functionality you may want to add in the future, leaving the way open for it now is not going to do any harm and you may well be thankful you did so at some future point.

Xapti

3:34 am on Jun 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



or you could just write up HTML code (+php code) in a .php file... that's pretty common, no?