Help with Custom Menu
Posted: Thu Jan 24, 2008 9:48 pm
I feel like I'm getting really close on this, but can't figure out this last part...
So, here's an example of a hard-coded menu that I want to implement in CMSMS:
It's a dynamic menu and as long as I have the classes and IDs on there right, it works great with the included .js file. I don't think there's a need to include that, because as long as it will output what you see above, it will work. Anyway, you can see above that there are two cases for top level links. It will have children or not. If it does, then I bring the "onmouseover" and "onmouseout" calls into the anchor tag. In the example above, "Welcome" does not have children, while "About" does.
So here's what I have so far:
It's working great in that it distinguishes between those nodes that have children and those that don't, AND it assigns subsequent numbers to each top level link. This "top_level_num" is placed in the classes for the containers that will hold the sub-level links also. However, you can see that I still have these sub-level links hard-coded. Anyone have any ideas on how I can adjust the code to list only the children of the node that the "top_level_num" is currently referring to?
I would very much appreciate any help.
Mike
So, here's an example of a hard-coded menu that I want to implement in CMSMS:
Code: Select all
<div id='main-nav'>
<ul>
<li class='nav1' ><a class='nav1' href='#'><span>Welcome</span></a></li>
<li class='nav2'><a class='nav2' href='#' onmouseover="ypSlideOutMenu.showMenu('menu2');" onmouseout="ypSlideOutMenu.hideMenu('menu2')"><span>About</span></a>
<div id='menu2Container'>
<div id='menu2Content'>
<a href='#'>About Link One</a>
<a href='#'>About Link Two</a>
<a href='#'>About Link Three</a>
<a href='#'>About Link Four</a>
</div>
</div>
</li>
</ul>
</div>
So here's what I have so far:
Code: Select all
{if $count > 0}
<div id='main-nav'>
<ul>
{foreach from=$nodelist item=node}
{counter assign="top_level_num"}
{if $node->depth == 1 && $node->haschildren == false}
<li class='nav{$top_level_num}' >
<a class="nav{$top_level_num}" href="{$node->url}" {if $node->target ne ""} target="{$node->target}"{/if}><span>{$node->menutext}</span></a>
</li>
{elseif $node->depth == 1 && $node->haschildren == true}
<li class='nav{$top_level_num}' >
<a class="nav{$top_level_num}" href="{$node->url}" {if $node->target ne ""} target="{$node->target}"{/if} onmouseover="ypSlideOutMenu.showMenu('menu{$top_level_num}');" onmouseout="ypSlideOutMenu.hideMenu('menu{$top_level_num}')"><span>{$node->menutext}</span></a>
<div id='menu{$top_level_num}Container'>
<div id='menu{$top_level_num}Content'>
<a href='#'>Sub Link One</a>
<a href='#'>Sub Link Two</a>
<a href='#'>Sub Link Three</a>
<a href='#'>Sub Link Four</a>
</div>
</div>
</li>
{/if}
{/foreach}
</ul>
</div>
{/if}
I would very much appreciate any help.
Mike