PDA

View Full Version : external file for Chrome drop down menu



gtcway
10-16-2007, 03:05 AM
1) Script Title: Chrome CSS Drop Down Menu (v2.01)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/chrome/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

ddadmin
10-16-2007, 10:26 PM
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:


<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:


<!--#include virtual="/external.htm"-->

A tutorial on SSI here: http://www.javascriptkit.com/howto/ssi2.shtml

gtcway
10-17-2007, 01:09 AM
Thank you. I'll take a look at it.

gtcway
10-17-2007, 03:15 PM
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:D

debug
03-03-2009, 09:22 AM
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:D

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

debug
03-03-2009, 10:02 AM
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