Page 1 of 1

Re: How can I hide a div if menu is empty

Posted: Tue Oct 18, 2016 11:03 pm
by paulbaker
I would attempt to resolve this by creating my own template based on minimal_menu and putting the div tags within the template, only showing them if there are menu items to show. Worth a try?

Re: How can I hide a div if menu is empty

Posted: Wed Oct 19, 2016 10:08 am
by velden
Another options is to use the smarty {capture} tag.

It is said to be less efficient though.

Make sure the Navigator template returns nothing (not even some spaces) if there are no menu items to show.

Re: How can I hide a div if menu is empty

Posted: Thu Oct 20, 2016 7:05 am
by calguy1000
Though paul's answer is technically the best... this will also work (and is better than capture, which is slow).

{Navigator loadprops='0' template='minimal_menu' start_level="2" assign='tmp'}
{if !empty($tmp)}<div class="wrap">{$tmp}</div>{/if}

Re: How can I hide a div if menu is empty

Posted: Thu Oct 20, 2016 8:23 am
by Rolf
after assigning you get access to the Navigator parameters in your Core::Page template. So you can also do something like:

{Navigator loadprops='0' template='minimal_menu' start_level="2" assign='tmp'}
{if isset($nodes)}<div class="wrap">{$tmp}</div>{/if}