Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-11-23 14:30:16

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Create a navigation list

Hi everyone,
this is the question: I want to create a menu where categories with more than one article groups their articles in nest unordered list, while categories with only one article are directly rendered as list item of primary list.

How can I tell Textpattern to check the numbers of article per categories and let it write the right HTML?

Something like:

<ul>
    <li><a class="have-more-than-one-articles">Article category</a>
      <ul>
        <li><a href="#">Article title</a></li>
        <li><a href="#">Article title</a></li>
        <li><a href="#">Article title</a></li>
      </ul>
    </li>
    <li><a class="only-one-article" hre="#">Article title</li>
    <li><a class="only-one-article" hre="#">Article title</li>
    <li><a class="only-one-article" hre="#">Article title</li>
</ul>

Thanks

Last edited by wornout (2010-11-23 14:49:11)

Offline

#2 2010-11-23 18:01:59

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Create a navigation list

You can do that using this method, the example code is for sections and a slightly different context, but you should be able to adapt it to your needs.
If you need help let me know :)

Offline

#3 2010-11-23 18:22:15

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Create a navigation list

I think I can do that!
Thanks for all support Els :-)

Offline

Board footer

Powered by FluxBB