...

View Full Version : Need help with Inserting a menu bar into every html page



senthilpr_in
07-30-2003, 07:08 PM
Hi all,

I have a standard menu bar, which I want to insert into everypage. I thought this should be faster because, the browser can fetch the page from cache, everytime the user navigates to a newpage.

How do I insert the page say sidebar.htm into the mainpage say index.htm

Thanks

Senthil

oracleguy
07-30-2003, 07:56 PM
The best way would be to use a server side include. You should be able to accomplish it with shtml, try searching google for a good tutorial on the subject.

If you are already using PHP or ASP in your pages, then you can just do a include through them.

meow
07-30-2003, 08:24 PM
Agree, but it won't affect caching. The browser gets the page as a whole.

oracleguy
07-30-2003, 10:16 PM
The only other way would be to use frames. *shutters*

cheesebagpipe
07-31-2003, 02:33 AM
JavaScript can easily do this. The trick is converting the .htm file to a .js one. Not usually a big deal.

theabyss
07-31-2003, 03:01 AM
That won't work for the people that have JavaScript disabled. I used to be one of those people because of those stupid popups, but now Mozilla takes care of that for me :cool:

It'll work, but I concentrate on making my pages viewable no matter what the situation is. If you can't find a good and free SSI host, get your own server. Aprelium's Abyss server is great for that. That's where my username came from :)

meow
07-31-2003, 03:18 AM
I don't see how the cahing is such a big deal. Images are cached anyway and how many bytes of text can there be in a menu?

cheesebagpipe
07-31-2003, 03:24 AM
cahing is a big deal.

Many people are reluctant to cah, understandably so. Don't make light of their concerns.

sincerely, cbp

meow
07-31-2003, 03:35 AM
Once again... IMAGES are BIG compared to TEXT. IMAGES are already CACHED. That's why it doesn't matter if you can cache the whole menu or not.

This whole thread is about 1500 bytes of TEXT. The same size as ONE of the BUTTONS on this page. That will be chached. Because images are cahed. See? :cool:

brothercake
07-31-2003, 05:52 AM
How about - core navigation through a <ul> tree of a links, and that's accessible to all, whatever they support or have enabled; then transform the list with cacheable- CSS and Javsacript, to make a dynamic navbar.

Peddling my list menu again blatantly ... but it is the new way :) Check it out - http://www.brothercake.com/scripts/listmenu/

nb - the CSS and script won't cache if it's directly in the source like that; that's just an eg; you need to put it in external files.

giz
07-31-2003, 08:06 PM
Javascript written links are not generally followed by robots and spiders.

If you want search engines to properly index your site then you also need to create a sitemap page full of normal HTML links. These links point back to every page of the site. You will also need to put a normal HTML link on every page of the site pointing to the sitemap page.

meow
08-01-2003, 05:32 AM
What javascript links? :confused:

theabyss
08-01-2003, 09:09 AM
Posted by cheesebagpipe:
JavaScript can easily do this. The trick is converting the .htm file to a .js one. Not usually a big deal.

Cheesebagpipe is saying that you can use external .js files to write out links using the document.write function. Then, updating that will update all of the pages associated with it. Won't work on search engines, or for people with JavaScript off.

meow
08-01-2003, 02:58 PM
Oh! Sorry. I'm always assuming people are either answering the original question or the guy just above if it doesn't say anything else. Sometimes they aren't.

cheesebagpipe
08-01-2003, 05:25 PM
Cheesebagpipe is saying that you can use external .js files to write out links using the document.write function.Always glad to know what I was saying.

Senthil:
I have a standard menu bar, which I want to insert into everypage.
Me:

JavaScript can easily do this.I didn't mention 'links' - 'menu bar' imo usually implies a DHTML-style menu, which requires JS in any event to function. And a site map with hardcoded (HTML) links is a must on almost any site. Didn't say anything, pro or con, about caching either, save a lame typo joke that went unnoticed. My only point: JavaScript is quite capable of generating HTML output. The difficulties in converting from mixed HTML to JS strings have been exaggerated. When (or whether) to use this technique is another matter entirely; I was just mentioning that it's possible. Not everyone has their own dedicated server, or a full-service host. And, as Doug Crockford has observed: "You will find that it [JavaScript] is not a toy language, but a full programming language with many distinctive properties." :cool:

theabyss
08-01-2003, 06:48 PM
Personally, I hate JavaScript because it causes so many problems with browsers. You have to have tons of script for each different browser and it gets way too big. The onclick, onmouseover, etc. are the only things I like doing. I'm moving to XHTML Basic though, so no JavaScript for me.

I love caching though because it's great to reduce server load, but then again, it depends on how much you're updating. For a weblog type of site, you could set Expires to be 6 hours (which is my setup). Plus, when I'm rebooting my computer, they won't see connection errors because the page will be in cache. It's weird how they pronounce it "cash". I always thought they pronounced it "catchy", because it "catches" things from servers :D

giz
08-02-2003, 03:39 AM
>> My only point: JavaScript is quite capable of generating HTML output. <<

For newbies: Such HTML code is still not search engine friendly.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum