Results 1 to 6 of 6

Thread: external file for Chrome drop down menu

  1. #1
    Join Date
    Oct 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default external file for Chrome drop down menu

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

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

    3) Describe problem: I would like to have the drop down menu code in a single external file that I can edit, instead of having to edit it on every page. I was sure I saw a way to do it in the forums with a search for "chrome", but having spend over an hour looking again, I haven't been able to find it again.
    Thanks

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

    Default

    Part of the design of this menu is that the menu contents is regular HTML and added inline on the page, for search engine friendiness. The best way to use an external, single source to embed this content on muliple pages is via server side, such as SSI (server side includes), or in PHP, the include() function etc. Using SSI for example, you would save the BODY portion of the script in an external file:

    Code:
    <div class="chromestyle" id="chromemenu">
    <ul>
    <li><a href="http://www.dynamicdrive.com">Home</a></li>
    <li><a href="#" rel="dropmenu1">Resources</a></li>
    <li><a href="#" rel="dropmenu2">News</a></li>
    </ul>
    </div>
    
    <!--1st drop down menu --> 
    <div id="dropmenu1" class="dropmenudiv">
    <a href="http://www.dynamicdrive.com/">Dynamic Drive</a>
    <a href="http://www.cssdrive.com">CSS Drive</a>
    <a href="http://www.javascriptkit.com">JavaScript Kit</a>
    </div>
    
    
    <!--2nd drop down menu --> 
    <div id="dropmenu2" class="dropmenudiv" style="width: 150px;">
    <a href="http://www.cnn.com/">CNN</a>
    <a href="http://www.msnbc.com">MSNBC</a>
    <a href="http://news.bbc.co.uk">BBC News</a>
    </div>
    
    <script type="text/javascript">
    cssdropdown.startchrome("chromemenu")
    </script>
    and embed it via something like:

    Code:
    <!--#include virtual="/external.htm"-->
    A tutorial on SSI here: http://www.javascriptkit.com/howto/ssi2.shtml

  3. #3
    Join Date
    Oct 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you. I'll take a look at it.

  4. #4
    Join Date
    Oct 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I actually found an easier way, IMO. I'm using Dreamweaver, so I just created a Library item. I have one file that I can edit and Dreamweaver inserts it in every page

  5. #5
    Join Date
    Feb 2009
    Location
    South Africa
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by gtcway View Post
    I actually found an easier way, IMO. I'm using Dreamweaver, so I just created a Library item. I have one file that I can edit and Dreamweaver inserts it in every page
    Sorry to bug you but can you share it with us I'v been trying to do this for the last week and no luck. I have like 60 pages and to add a sub menu is a big hassel plzzzzzzzzz

  6. #6
    Join Date
    Feb 2009
    Location
    South Africa
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by debug View Post
    Sorry to bug you but can you share it with us I'v been trying to do this for the last week and no luck. I have like 60 pages and to add a sub menu is a big hassel plzzzzzzzzz
    THX man got it going

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
  •