Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:09
Static and Dynamic Menu Content w/ Velocity
Poster: spirollo
Dated: Friday September 17 2004 - 20:20:11 BST
I have a site whereby I need the menus to contain both static and dynamic content. The static content is 80% of the content. About 20% of the submenus will be dynamic.
I'd like to cache the static sub-menus using JS files. I am using Velocity Template macros (VMs) to do the dynamic rendering on my site.
What is the best way to accomplish this? Can I store half the menu data in a javascript file in one directory and then store the dynamic content in another directory in VM files?
If so, how do I accomplish this? I tried splitting the sub-menus into another JS file but ran into an error (line17,char384,object undefined) when I ran over the submenu.
Thanks for your time.
Scott
Poster: Ruth
Dated: Sunday September 26 2004 - 5:48:08 BST
First a disclaimer. I dont' know a thing about the VMs and dynamic menus and such. But, I wanted to maybe give you a starting point if you know this stuff.
I used the menu in the download sample. I took the menu_data.js file and I cut out the main menu and all the submenus but the last two, leaving all the code i.e. menuOpenDelay, and the menuStyle codes in the file with those two submenus. Then I saved it as menu_data1.js. Then I took the original menu_data.js file and cut out those last two submenus and saved that file as menu_data.js So the menu_data.js file would now be without the last two submenus, and the menu_data1.js would have those two submenus and the style coding. Then I opened the menu.htm page and put the second call in the menu calls
Code:
<script type="text/javascript" src="milonic_src.js"></script>
<param copyright="JavaScript Menu by Milonic - http://www.milonic.com"></param>
<script type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>");
-->
</script>
<script type="text/javascript" src="menu_data.js"></script>
<script type="text/javascript" src="menu_data1.js"></script>
<param copyright="JavaScript Menu by Milonic - http://www.milonic.com"></param>
<script type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>");
-->
</script>
<script type="text/javascript" src="menu_data.js"></script>
<script type="text/javascript" src="menu_data1.js"></script>
I had no problem with the main menu opening all the submenus, even though two of them came from a different file. I tested it in IE5.5 and Netscape 7.
I don't know if this will be of any help, I realize the second file is not a 'dynamic' file, but I wanted to let you know that you can save data in two different menu_data.js files and get a single main menu to work.
Ruth