When someone is at the home page, I need to have one of the menu items and its submenu items expanded out.
Has anyone ever done this?
Terry
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
When someone is at the home page, I need to have one of the menu items and its submenu items expanded out.
Has anyone ever done this?
Terry
I think this can be done using CSS classes in the same way as $LinkingMode works, provided that is how your menu knows what to expand.
So you could have a condition like this:
<% if URLSegment = home %>
<a class="Open" href="$Link">$MenuTitle</a>
<% else %>
<a href="$Link">$MenuTitle</a>
<% end_if %>
or you could create a function IsOpen() that returned the relevant class (if any) and call it via class="$IsOpen".
Aram,
You rock - thank you for this. Worked perfectly. Here's how I implemented it - works like a charm.
<% if URLSegment = rit-113-imrt-qa-software %>
<% control Children %>
<ul id="smenu">
<li class="sm$ID"><a href="$Link" title="Go to the $Title.XML page" class="sa$ID">$MenuTitle</a></li>
</ul>
<% end_control %>
<% end_if %>
Thanks again,
Terry