Page 1 of 1

Navigator, how to give class depending on depth

Posted: Thu May 04, 2017 11:43 am
by CMSmsmsms
Hello everyone

I am struggling with the Navigator a bit. What my template needs is to give the 'outer' ul a certain class (nav navbar-nav) and the ul inside it so to say (for the dropdown) another class (dropdown-menu). I understand this is quite trivial and have been searching for an hour in de CMSMS docs but I was unable to find the answer.

Would be great if you could give a hint

I am using CMSMS 2.16 and the 'simple' menu template that came with it.

Thanks!

Re: Navigator, how to give class depending on depth

Posted: Thu May 04, 2017 12:23 pm
by velden

Code: Select all

{function name=Nav_menu depth=1}{strip}
<ul class="{if $depth==0}nav navbar-nav{else}dropdown-menu{/if}">
  {foreach $data as $node}
    {* setup classes for the anchor and list item *}
...
I recently worked on a BS3 menu and it needed more checks. But this should do what you asked.

Re: Navigator, how to give class depending on depth

Posted: Thu May 04, 2017 1:27 pm
by CMSmsmsms
Velden, That works! Thanks so much!