Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Includes

  1. #1
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Includes

    1) Script Title: Chrome CSS Drop Down Menu (v2.5)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...rome/index.htm

    3) Describe problem: I've built my nav and am trying to include it on my website via a server side include tag. Is that possible?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I don't see why not. SSI basically is as if you're manually including the script onto your pages...
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    NewsGuy (12-04-2008)

  4. #3
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    That's what I thought, but I can't get it to work properly. I really don't want to get into a situation where making a change to the nav involves me going in and editing every single page.

  5. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    If you cannot get SSI to work on your server, you can use javascript:
    Code:
    if(window.opera)
    {document.write('<iframe src="menu.html" width="0" height="0" name="menu" ></iframe>');}
    else document.write('<object type="text/html" data="menu.html" width="0" height="0" name="menu" ></object>');
    function extractMenu(){
    try{
    document.body.innerHTML+=window.frames['menu'].body.innerHTML;
    }
    catch(e){
    document.body.innerHTML+=window.frames['menu'].document.body.innerHTML;
    }
    }
    window.onload=extractMenu;
    where 'menu.html' contains your menu.
    ===
    Arie Molendijk.
    Last edited by molendijk; 12-04-2008 at 12:09 PM. Reason: Correction

  6. #5
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Pardon my ignorance of JavaScript, but where do I put that code in the HTML? Is it where I want the menu to show up or in the <HEAD>. Again, sorry for my ignorance, but thanks for the help!

  7. #6
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    In the head:
    Code:
    <head>
    <script type="text/javascript">
    if(window.opera)
    {document.write('<iframe src="menu.html" width="0" height="0" name="menu" ></iframe>');}
    else document.write('<object type="text/html" data="menu.html" width="0" height="0" name="menu" ></object>');
    function extractMenu(){
    try{
    document.body.innerHTML+=window.frames['menu'].body.innerHTML;
    }
    catch(e){
    document.body.innerHTML+=window.frames['menu'].document.body.innerHTML;
    }
    }
    window.onload=extractMenu;
    </script>
    </head>
    You can specify the position of the menu in menu.html.
    ===
    Arie.

  8. #7
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Quote Originally Posted by NewsGuy View Post
    That's what I thought, but I can't get it to work properly. I really don't want to get into a situation where making a change to the nav involves me going in and editing every single page.
    I'd still recommend using SSI instead of JavaScript to include the contents of a file, be it this script or some random HTML. What do you have so far? Have you verified first that SSI in general works on your site?
    DD Admin

  9. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,824
    Thanks
    49
    Thanked 240 Times in 233 Posts
    Blog Entries
    56

    Default

    Perhaps you tested SSI locally, on your hard disk only? That would explain why it does not seem to work with you. (You have to test it online).
    ===
    Arie.

  10. #9
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    SSI works and is being used on the page. I build the nav here: http://wcsi.whiterivernews.com/matt/nav2.html and tried to include it here: http://wcsi.whiterivernews.com/matt/testpage2.asp.

  11. #10
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Comparing the source of the two images, it seems the later, non working one is missing the .css file reference:

    Code:
    <link rel="stylesheet" type="text/css" href="http://wcsi.whiterivernews.com/matt/nav/chromestyle2.css" style="padding: 0" />
    Simply do a compare to see what else is missing if the above doesn't fix things.
    DD Admin

  12. The Following User Says Thank You to ddadmin For This Useful Post:

    NewsGuy (12-05-2008)

Bookmarks

Posting Permissions

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