Forum

Thread tagged as: Question, Problem

Any way to apply some HTML to JUST the top level of a menu?

So i have a pretty standard menu template that looks like this:

<perch:before>
    <ul>
</perch:before>
        <li<perch:if exists="current_page"> class="Selected"</perch:if><perch:if exists="ancestor_page"> class="ancestor"</perch:if>>
            <a <perch:if exists="subitems">class="arrow"</perch:if> href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>   
            <perch:pages id="subitems" encode="false" />         
        </li>
<perch:after>
    </ul>
</perch:after>

What i need to be able to do is add an additional, static <li> to the end. Simple enough! But because this is used for the drop downs on the menu too, if i put my static <li> inside the <perch:after>, it appears at the end of every drop down list too!

That makes sense, but i can't seem to figure out a way to basically add an additional bit of html to JUST the top most level of my menu.

Any ideas?

Daniel Owen

Daniel Owen 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can test pageDepth

<perch:if id="pageDepth" value="1">
    <li>...</li>
</perch:if>

Hi Drew,

Awesome, thank you for the speedy response :^) That did the trick (and handy to know too!)