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   1965 Views

Avatar
mommek

19 July 2010 at 10:58pm Community Member, 9 Posts

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

19 July 2010 at 11:42pm Community Member, 9 Posts

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

20 July 2010 at 1:20pm Forum Moderator, 5511 Posts

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

20 July 2010 at 8:16pm Community Member, 9 Posts

thanks a lot :)