PDA

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



TechMistress
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>
</span>
<select name="cats" onChange="openDir(this.form)">
<option value="projects.php">{LANG_PROJTYPES}</option>
<option value="projects.php">{LANG_ALL}</option>
{LOOP: CATEGORIES}
IF("{CATEGORIES.ctype}"=="0"){
<option value="{SITEURL}projects.php?cat={CATEGORIES.id}" {CATEGORIES.selected} >{CATEGORIES.name}</option>{:IF}
IF("{CATEGORIES.ctype}"=="1"){
<option value="{SITEURL}projects.php?cat={CATEGORIES.id}" {CATEGORIES.selected} >{CATEGORIES.name}</option>{:IF}
IF("{CATEGORIES.ctype}"=="2"){
<option value="{SITEURL}projects.php?cat={CATEGORIES.id}" {CATEGORIES.selected} >&nbsp;&nbsp;&nbsp;{CATEGORIES.name}</option>{:IF}
{/LOOP: CATEGORIES}
</select>
</form>

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

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

ddadmin
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.