Free Scripts
+ Redirects

+ No Right Click

+ Alerts

+ Popups

+ Menus

+ Calendars

+ Forms

+ Windows

+ 4x Browser

+ Images

+ Links

+ Frames

+ Clocks/Time

+ Misc.



 Navigate
 Javascripts

 New Scripts

 Submit Script

 Free Content

 Link To Us

 Bookmark Us

 Privacy Policy






Recommend Us : Bookmark Us : Link To Us : Submit A Script
Registered Members

Creating a Navigation Menu in JavaScript: Step 3
by Christopher S.L.Heng,

Changing Your Pages
Trivial isn't it? However, changing your pages is not so trivial if your site has numerous pages. Worse, if you have the intention of including every page on your website in that menu, each time you add a new page, you have to go through all your pages to modify the menu. Sooner or later, the menu will cease to be a novelty.

I faced this problem when I decided to convert all of thefreecountry.com's approximately 150 pages to include a drop down menu. For those of you familiar with this site, you will probably know that I add new pages (with new articles or with other categories of free stuff) rather regularly. Not only would the conversion be a pain, the maintenance would be a nightmare.

To minimize your maintenance nightmare, you might want to consider a few options:

  1. Put your site in frames, and place the menu in the parent frame. That way, you only have to modify one page. Disadvantages: visitors who arrive at your child pages from outside the site would not get to see the menu (happens more often than you think!); many people bly dislike frames; some older browsers cannot handle frames; and unless you take special action, search engines do not index a site with frames particularly well.

  2. Put your menu in a separate file, and include it on every page using server side includes (SSI) or PHP. Once again, each time you add to the menu, you only need to modify one file. Disadvantages: not all web servers have SSI (or PHP) enabled; if your server requires you to have a .shtml extension for SSI pages (and .php for PHP pages), you will need to convert all your pages to have that extension (what happens to visitors who arrive via bookmarks or previous search engine listings?).

  3. Put your menu in a separate file, but prior to uploading, run a script on your own machine that inserts it into every page. Then upload the modified pages to your site. Disadvantages: everytime you add one item to the menu, you have to re-upload every single page that uses that menu.

You'll have to decide yourself which method suits you best. If, of course, your site only has a few pages, and is likely to stay that way, then you can simply add the menu to every single page.

Back to Step 1 >> Back to Step 2


Copyright 2000 by Christopher S L Heng. All rights reserved.
Visit http://www.thefreecountry.com/ for more free articles, resources and tools for webmasters and software programmers.