Forum

Thread tagged as: Question, Runway

Nested categories navigation in Runway

Has anyone managed to achieve a nice nested list of categories in Runway?

I've got as far as this:


<perch:if different="catDepth"> <perch:if exists="perch_item_first"> <ul> <perch:else /> <perch:if id="catOrder" match="eq" value="1"> <ul> <perch:else /> </li> </ul> </li> </perch:if> </perch:if> <perch:else /> </li> </perch:if> <li><a href="/<perch:category id="catPath" />"><perch:category id="catTitle" /></a>

It's almost there, but in a couple of places, it's missing a closing </ul></li> which then throws the nesting out.

Drew - is there anyway to determine the last item in a category level, or if a category has subitems? perch_pages_navigation makes this easy with <perch:if exists="subitems"> - something like this in categories, would make navigation lists easier to achieve I think. Would you have any other suggestions?

Darren Neasham

Darren Neasham 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What does <perch:showall /> give you at that point? Anything useful?

Not really, unless I'm missing something - I have been looking at this for some time!

I can check against items that appear first in a category (either absolute first with perch_item_first, or first in each level with catOrder value of 1), but can't see an ID to check against that would allow me to determine if it's the last item in each level - apart from catOrder again. If you've got 12 categories in level 1, catOrder = 12 would be the last item in that level - but I can't figure out how I would create a formula to check for that - as that number would change depending on the category level (e.g. catOrder = 6 could be the last item in level 2).

Drew McLellan

Drew McLellan 2638 points
Perch Support

I've been looking at this and at the moment I'm not sure there is a good way.