Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-02-20 01:23:02
- dandul
- Member
- From: Brisbane, Australia
- Registered: 2010-01-31
- Posts: 33
can't make section-specific category list
Trying to make a menu that lists the categories used by articles in a particular section. So in section ‘notes’ if I’ve applied category One and Three to some articles, I want the menu to list just these categories, and not the unused Category Two.
I used this code:
<txp:category_list label=“Categories” section=’<txp:section />’ wraptag=“p” break=“br” />
And got every category. Nothing section-specific there! So then I tried this:
<txp:category_list this_section=“1” />
And again got every category in the database. Googled and typed and it beats me. Help anyone?
Stop wishing things were different to the way they are. Accept it, deal with it, move on.
Offline
Re: can't make section-specific category list
Have a look at some category plugins. The core category_list
tag doesn’t do what you want.
Code is topiary
Offline
Re: can't make section-specific category list
On your resulting menu, where should each category item link to? to a general site-wide category listing? or to a section-specific category listing?
Anyway, let’s try something simple first:
<txp:category_list>
<txp:variable name="has_article"><txp:article_custom section='<txp:section />' category='<txp:category />' limit="1"><!-- hello! --></txp:article_custom></txp:variable>
<txp:if_variable name="has_article" value="">
<!-- no articles in this category, don't display the category -->
<txp:else />
<txp:category />
</txp:if_variable>
</txp:category_list>
As always, inspired on some tip by Els.
Offline
#4 2010-02-20 05:58:09
- dandul
- Member
- From: Brisbane, Australia
- Registered: 2010-01-31
- Posts: 33
Re: can't make section-specific category list
Thanks for the suggestion jsoo, cbs_category_list did the job in a minute.
Thanks for the code maniqui, I had a play with it and will keep it for future reference. (BTW i was after section-specific category listings)
thanks for your time
:)
Stop wishing things were different to the way they are. Accept it, deal with it, move on.
Offline