Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Can I distinguish whether I am listing cat1 or cat2?
Is it possible to have a different display if I am listing category1 or category2? It seems I haven’t a conditional to distinguish if I’m showing cat1 or cat2 in page template.
It would be very useful, because I want to assign two different purpose to cat1 (i.e., topic) and cat2 (i.e., where the article was originally published). So I want different information displayed at top of category listing in the two cases…
Any hint would be apreciated.
Z-
Offline
Re: Can I distinguish whether I am listing cat1 or cat2?
You could use the <code> <txp:if_category /></code> tag for this.
http://textpattern.net/wiki/index.php?title=Txp:if_category
Offline
Re: Can I distinguish whether I am listing cat1 or cat2?
Thanks Maarten, but this doesn’t fit my needs. if_category doesn’t allow to disinguish cat1 or cat2: you can only set specific category names.
At the moment I solved with a workaround: I created a new section/page template that I use only for cat2 listing. In articles, when listing cat2, I link cat2 to that section (I created a new plugin to mixup the basic category1/category2 txp tags with category tag that allows you to chose the section to link: eventually I would release it after some testing).
Bye
Z-
Offline
Re: Can I distinguish whether I am listing cat1 or cat2?
Hi Zanza,
Sorry, I didn’t read well… Cat1 and Cat2 distinguishing is indeed not possible with the if_category. The only other thing I can think of is if_article_category. It has the attribute “number=“1 or 2”, but I’m not sure if this will help.
ciao
Maarten
Offline