Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with Inserting a menu bar into every html page

    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

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Agree, but it won't affect caching. The browser gets the page as a whole.
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    The only other way would be to use frames. *shutters*
    OracleGuy

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Posts
    596
    Thanks
    0
    Thanked 0 Times in 0 Posts
    JavaScript can easily do this. The trick is converting the .htm file to a .js one. Not usually a big deal.

  • #6
    Regular Coder
    Join Date
    Apr 2003
    Location
    On the W3C and W3schools web sites.
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    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

  • #7
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #8
    Regular Coder
    Join Date
    Nov 2002
    Posts
    596
    Thanks
    0
    Thanked 0 Times in 0 Posts
    cahing is a big deal.

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

    sincerely, cbp

  • #9
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by brothercake; 07-31-2003 at 06:56 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #11
    giz
    giz is offline
    Regular Coder
    Join Date
    Apr 2003
    Location
    UK
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #12
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What javascript links?
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #13
    Regular Coder
    Join Date
    Apr 2003
    Location
    On the W3C and W3schools web sites.
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #14
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #15
    Regular Coder
    Join Date
    Nov 2002
    Posts
    596
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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."


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •