Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Problem with control Menu(1) and (2)


Reply


4 Posts   2006 Views

Avatar
mommek

Community Member, 9 Posts

19 July 2010 at 10:58pm

Hello,

I have somethink like this:

<% control Menu(1) %>

<li id="button-$URLSegment"><a href="$Link" title="go to &quot;{$Title}&quot;"></a>

<% if Menu(2) %>
<% control Menu(2) %>
<ul>
<li><a href="$Link">$MenuTitle</a></li>
</ul>
</li>
<% end_control %>
<% else %>
</li>
<% end_if %>

<% end_control %>

but it doesn't work :-(

I just wanna show sub-menu when I hover main menu:
(somethink like this: http://www.dynamicdrive.com/style/csslibrary/item/suckertree-menu-horizontal/ )

Can someone help me?

Avatar
mommek

Community Member, 9 Posts

19 July 2010 at 11:42pm

ok, so I found how works <% children %>..

<% control Menu(1) %>

<li id="button-$URLSegment"><a href="$Link" title="go to &quot;{$Title}&quot;"></a>

<% if Children %>
<ul>
<% control Menu(2) %>
<li><a href="$Link">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
</li>

<% end_control %>

---------------
but it shows:

<li id="button-xyz"><a href="/xyz/" title="go to &quot;xyz&quot;"></a>
<ul>
<li><a href=""></a></li>
</ul>
</li>

Does someone know why?

Avatar
Willr

Forum Moderator, 5513 Posts

20 July 2010 at 1:20pm

You cannot use Menu() inside another Menu(). The function Menu is part of the global scope of the templates rather than individual elements. You should use <% if Children %><% control Children %>... when you are inside a menu control and what to show another level.

Avatar
mommek

Community Member, 9 Posts

20 July 2010 at 8:16pm

thanks a lot :)