Thanks a ton! I've refined it a little, and will probably continue to as I figure more things out with it, but that got it working about 98% as I wanted. :)
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
For some reason I just don't understand how these menu's derive. For example, I am using the Nature4web template to learn from and they have the following code:
<h3>Navigate</h3>
<ul id="Navigation">
<% control Menu(1) %>
<li>
<a class="$LinkingMode" href="$Link" title="Go to the $Title.XML page">$MenuTitle<span></span></a>
<% if Children %>
<% if LinkingMode = section %>
<ul id="Sub-Menu">
<% control Children %>
<li class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %>">
<% if LinkingMode = current %>
<a class="items" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% else %>
<a class="item" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>
<% if LinkingMode = current %>
<ul id="Sub-Menu">
<% control Children %>
<li class="$LinkingMode<% if FirstLast %> $FirstLast<% end_if %>">
<% if LinkingMode = current %>
<a class="items" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% else %>
<a class="item" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul>
what I want to achieve is a third level menu which I would assume includes a block like:
<% if Children %>
<% control Children %>
<a class="item" href="$Link" title="Go to the $Title.XML page">$MenuTitle</a>
<% end_control %>
<% end_if %>
Does anyone know what I am doing wrong?
The menu nav should appear as follows:
Home
Section
Sub-Page
but the sub-page never renders or when I've gotten it to partially work, it shows up at Section level instead of Sub-page level...
thanks for anyone's help in advance!
Its because you have that wrapped inside a <% if LinkingMode = current %> . this will only return true if you are on the section page. You need to change that to if LinkOrSection = section which will return true if you are on that page (eg the main section page) or a child of the section page
- Previous 10 entries
- 1
- Page 22(current)