Theme override- determining what menu items to show in header
Hi -
I'm using theme overrides and don't want all of the menu items to show in the header.
I'm using the following code right now...
<$Model.Items:
{
<a class="no-underline" href="<$it.Url$>"><div class="header-nav"><$it.Title$></div></a>
}$>
One of the items I don't want to produce and <a> tag for is the home page. Also, if a person is signed in I don't want the Join / Register page to show.
thanks,
Rob
-
Alexey Podolsky commented
1)
<$Model.Items:
{
<$if (it.IsFirstItem)$>
<div class="header-nav"><$it.Title$></div>
<$else$>
<a class="no-underline" href="<$it.Url$>"><div class="header-nav"><$it.Title$></div></a>
<$endif$>
}$>
this code just shows the first element (your home page) without link.
2) should be more complicated, but still possible without JS. Main problem is that we cannot compare agains certain values in TE, so it is virually impossible to detect required item in collection. The solution might be the following:
a) copy URL of login page somewhere (now it is /Default.aspx?pageId=1241083)
b) move login page in your site structure editor to the second level of any other page, thus it won't show in your current menu.
c) Add the following code after or before <$Model.Items:{...}$>
<$if (PageModel.IsAnonymousView)$>
<a class="no-underline" href=/Default.aspx?pageId=1241083"><div class="header-nav">Join</div></a>
<$endif$>
this will render Join link only for non-logged-in members.
For list of general page and menu parameters lurk thru
http://help.wildapricot.com/display/DOC/Page+Model
https://help.wildapricot.com/display/DOC/Menu+gadget
might be helpful
feel free to experiment and report results (;