View Full Version : All Levels Navigational Menu & Dynamic Content?

01-30-2009, 07:12 PM
1) Script Title: All Levels Navigational Menu (v2.1)

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

3) Describe problem:
I want to know if I can use this using dynamic content on my php driven website.

My current menu content is done as a LOOP with one dropdown form box. I'd like to use the DD script to render this info.

Here is my current menu system. Type 1 is main category, type 2 is the sub category:

<form name="form" method="post" action="">
<span class="header1">View Other Project Categories:<br>
<select name="cats" onChange="openDir(this.form)">
<option value="projects.php">{LANG_PROJTYPES}</option>
<option value="projects.php">{LANG_ALL}</option>
<option value="{SITEURL}projects.php?cat={CATEGORIES.id}" {CATEGORIES.selected} >{CATEGORIES.name}</option>{:IF}
<option value="{SITEURL}projects.php?cat={CATEGORIES.id}" {CATEGORIES.selected} >{CATEGORIES.name}</option>{:IF}
<option value="{SITEURL}projects.php?cat={CATEGORIES.id}" {CATEGORIES.selected} >&nbsp;&nbsp;&nbsp;{CATEGORIES.name}</option>{:IF}

Here is what I tried to do with the DD Script (which didn't work, of course:

<div id="ddsidemenubar" class="markermenu">
<li><a href="{SITEURL}projects.php?cat={CATEGORIES.id}" rel="ddsubmenuside1">{CATEGORIES.name}</a></li>
<script type="text/javascript">ddlevelsmenu.setup("ddsidemenubar", "sidebar") </script>
<!--Side Drop Down Menu 1 HTML-->
<ul id="ddsubmenuside1" class="ddsubmenustyle blackwhite">
<li><a href="{SITEURL}projects.php?cat={CATEGORIES.id}">Item 1a</a></li>

01-30-2009, 09:47 PM
In general, the checklist for using any server side language to dynamically output client side JavaScript is the same. As long as what gets output to the browser looks identical to as if you've manually included the script (in this case All Levels Menu) on your page, it should work. Exactly how to do this depends on how your pages are set up using PHP/ mySQL, and is beyond the scope of what we can help you with, unfortunately.

One helpful tip is to use the "view source" feature of your browser often as you're trying to dynamically output the contents of the menu. Compare the output with what you're trying to output, and adjust your server side code until the two matches.