Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
conditional statement, is this the best way.
Would this work?
I need to get the following to display articles with one of either two forms depending on the category.
<txp:if_category name=“multiple”> <txp:if_individual_article> <txp:article limit=“1” form=“multiple_entry” section=“web” /> <txp:else /> <txp:article limit=“1” form=“blog_entry” status=“sticky” section=“web” /> </txp:if_individual_article> <txp:else /> <txp:if_individual_article> <txp:article limit=“1” form=“single_entry” section=“web” /> <txp:else /> <txp:article limit=“1” form=“single_entry” status=“sticky” section=“web” /> </txp:if_individual_article> </txp:if_category>-thanks in advance
kevin
p.s. here is a link if you’d like to see the formatted code
http://www.mcmonagledesign.com/images/format.gif
Last edited by kvnmcwebn (2009-05-05 11:53:10)
its a bad hen that wont scratch itself.
photogallery
Offline
Re: conditional statement, is this the best way.
kvnmcwebn wrote:
Would this work?
<txp:if_category name="multiple">
<txp:if_individual_article>
<txp:article limit="1" form="multiple_entry" section="web" />
<txp:else />
<txp:article limit="1" form="blog_entry" status="sticky" section="web" />
</txp:if_individual_article>
<txp:else />
<txp:if_individual_article>
<txp:article limit="1" form="single_entry" section="web" />
<txp:else />
<txp:article limit="1" form="single_entry" status="sticky" section="web" />
</txp:if_individual_article>
</txp:if_category>
It may work or not (i.e. it may output the desired output), although I think there are some “conceptual” errors on your code (by the way, you can use bc.
to put formatted code here at the forum, quote my post to see how I did it).
Back to the code.
If I understand what you are trying, the following snippet may be one possible solution
<txp:if_individual_article>
<!-- if we are in an individual article -->
<txp:if_article_category name="multiple">
<!-- and if that article category is "multiple" -->
<txp:article limit="1" form="multiple_entry" section="web" />
<txp:else />
<!-- else (that article category isn't "multiple") -->
<txp:article limit="1" form="single_entry" section="web" />
</txp:if_article_category>
<txp:else />
<!-- if we aren't in an individual article, we are in an article list -->
<txp:article limit="1" form="blog_entry" status="sticky" section="web" />
</txp:if_individual_article>
Offline
Re: conditional statement, is this the best way.
hi maniqui,
<txp:if_article_category name="multiple">
I think thats what i was looking for.
I will try it now. thanks a mill.
-kevin
its a bad hen that wont scratch itself.
photogallery
Offline
Re: conditional statement, is this the best way.
Hi Maniqui, that works perfectly. Also thanks for the detailed comments. I see were the errors were in my understanding. Much appreciated.
its a bad hen that wont scratch itself.
photogallery
Offline