I have a pretty typical page layout with navigation split into a horizontal nav for top level items and then a vertical nav in a sidebar for 2nd level items. My question is: is there some sort of if/else logic I can use to display alternative content in the sidebar for top level pages that don't have children? Either in the page template (if sidebar div is empty, insert this code..., or if {menu} returns nothing, insert this code...) or in the Menu Manager template (if no list items, insert this code...)
In the Menu Manager template I tried
{if $count > 0}
...menu code
{else}
...my alternative code
{/if}
but it didn't work. Maybe someone has done this before, or can see where I'm going wrong. Thanks.
[SOLVED] Logic for alternative content if menu empty
[SOLVED] Logic for alternative content if menu empty
Last edited by Cerulean on Tue Feb 08, 2011 4:16 am, edited 1 time in total.
Re: Logic for inserting alternative content if menu empty
{capture assign='test'}{menu}{/capture}{if !empty($test)}
<div>
{$test}
</div>
{else}
<div>
something else
</div>
{/if}
Thanks to calguy1000...
<div>
{$test}
</div>
{else}
<div>
something else
</div>
{/if}
Thanks to calguy1000...
Last edited by Dr.CSS on Tue Feb 08, 2011 6:28 am, edited 1 time in total.
Reason: to give credit where credit is due
Reason: to give credit where credit is due
Re: Logic for inserting alternative content if menu empty
That is brilliant! Thanks!