Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-27 14:45:38

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

More elegant way to output linked category list

Hi All,
On the Reviews page of my site, I want to output a linked list of categories. The two caveats are that I only want categories for which there are articles (in the reviews section), and I only want category1. This is working:

<txp:if_section name="reviews">
       <h3>by Cruise Line</h3>
       <ul><txp:article_custom limit="999" section="reviews" sort="Category1 asc">
       <txp:if_different>
       <li><a href="/reviews/?c=<txp:category1 />"><txp:category1 title="1" /></a></li>
       </txp:if_different>
       </txp:article_custom></ul>
</txp:if_section>

But it seems like there should be a more elegant way?

Last edited by nabrown78 (2009-03-27 14:47:43)

Offline

#2 2009-03-27 17:12:11

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: More elegant way to output linked category list

I only can offer some code editions :)

<txp:if_section name="reviews">
       <h3>by Cruise Line</h3>
       <txp:article_custom limit="999" section="reviews" sort="Category1 asc" wraptag="ul" break="li">
         <txp:if_different>
           <a href="/<txp:section />?c=<txp:category1 />"><txp:category1 title="1" /></a>
         </txp:if_different>
       </txp:article_custom>
</txp:if_section>

Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#3 2009-03-27 18:53:13

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: More elegant way to output linked category list

I think cbs_category_list might do what you want.

Offline

Board footer

Powered by FluxBB