Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-01-30 20:14:38
- WhiteDog
- Member
- From: Maine
- Registered: 2005-09-07
- Posts: 174
TXP if Category how to?
The conditional statements in textpattern are terriffic, butI got to thinking can I nest if_category in if-category or do i use another else?
<txp:if_category category="fruit">
...your content here...
<txp:else />
<txp:if_category category="vegetables">
...your content here...
<txp:else />
...default option...
</txp:if_category>
</txp:if_category>
or
<txp:if_category>
...your content here...
<txp:else />
...some other content...
<txp:else/>
...default content...
</txp:if_category>
Thanks in advance
Last edited by ruud (2008-01-30 20:18:14)
Grrr RRR nnndth grrr Skeek!
Offline
Re: TXP if Category how to?
Neither is possible, but you can do
<txp:if_category name="fruit">
...your content here...
</txp:if_category>
<txp:if_category name="vegetables">
...your content here...
</txp:if_category>
<txp:if_category name="fruit,vegetables">
<txp:else />
...default option...
</txp:if_category>
Last edited by ruud (2008-01-31 22:47:17)
Offline
#3 2008-01-30 20:21:46
- WhiteDog
- Member
- From: Maine
- Registered: 2005-09-07
- Posts: 174
Re: TXP if Category how to?
Thanks!!!!!!!!!
Grrr RRR nnndth grrr Skeek!
Offline
#4 2008-01-31 22:37:40
- WhiteDog
- Member
- From: Maine
- Registered: 2005-09-07
- Posts: 174
Re: TXP if Category how to?
Thought… Can I do
<txp:if_category category="fruit">
...your content here...
</txp:if_category>
<txp:if_category category="vegetables">
...your content here...
</txp:if_category>
<txp:if_section section="contact">
...different content
</txp:if_section>
Last edited by ruud (2008-01-31 22:46:39)
Grrr RRR nnndth grrr Skeek!
Offline
#5 2008-01-31 22:46:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: TXP if Category how to?
The attribute is name
, not category
or section
:)
Yes, you should be able to do something like that.
Offline
#6 2008-01-31 23:24:45
- WhiteDog
- Member
- From: Maine
- Registered: 2005-09-07
- Posts: 174
Re: TXP if Category how to?
SO it would be?
<txp:if_category name=“vegetables”>
My vegetable related content…
</txp:if_category>
<txp:if_section name=“contact”>
…different content
</txp:if_section>
?
Grrr RRR nnndth grrr Skeek!
Offline
#7 2008-01-31 23:44:38
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: TXP if Category how to?
Yes, but if you also need to display articles that are not in category ‘vegetables’ or ‘fruit’ nor in section ‘contact’, you will need some more conditionals. If those other articles don’t need to be further specified, you could add
<txp:if_section name="contact">
<txp:else />
<txp:if_category name="vegetables,fruit">
<txp:else />
all the rest...
</txp:if_category>
</txp:if_section>
Offline
#8 2008-01-31 23:51:22
- WhiteDog
- Member
- From: Maine
- Registered: 2005-09-07
- Posts: 174
Re: TXP if Category how to?
Enough theory now I am going to jump in! Thanks!!!
Grrr RRR nnndth grrr Skeek!
Offline
Pages: 1