Hi all, I have a navigation that uses the first entry in a weblog as the top level list item then using offset=“1” all following entries populate a nested list.
{exp:weblog:entries weblog="asset-based" sort="asc" limit="1" dynamic="off"}
<li{if segment_1 == "asset-based"} class="current"{/if}><a href="#">{pages-title}</a>
{/exp:weblog:entries}
{if segment_1 == "asset-based"}
<ul class="nested">
{exp:weblog:entries weblog="asset-based" offset="1" dynamic="off" sort="asc"}
<li><a href="#">{pages-title}</a></li>
{/exp:weblog:entries}
</ul>
{/if}
</li>Problem is, if there is only 1 entry the <ul> is still created and creates a gap.
I tried adding count > 1 to my segment conditional (not sure if thats right btw) it didn’t work, then I realised I needed to wrap it in the entries tag so the ‘count’ had a reference.
It didn’t like that (due to the nested entries tags I think) so I embedded the nested list like so…
</li>
{exp:weblog:entries weblog="asset-based" sort="asc" limit="1" dynamic="off"}
<li><a href="#}">{pages-title}</a>
{/exp:weblog:entries}
{exp:weblog:entries weblog="asset-based"}
{if segment_1 == "asset-based" AND count > 1}
{embed="includes/nav-list-item"}
{/if}
{/exp:weblog:entries}
</li>and that jus’ plain don’t work and I’m stumped! It all works fine until I add the count > 1.
This is the contents of the embed…
<ul class="nested">
{exp:weblog:entries weblog="asset-based" offset="1" dynamic="off" sort="asc"}
<li><a href="#">{pages-title}</a></li>
{/exp:weblog:entries}
</ul>It’ll be something simple I’d wager.
Thanks