Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Single/multiple articles in category
How do I handle this?
If some category only has 1 article, how do I force it to show only the one article in full, instead of a list of one article?
And if the category has multiple articles, it should show the list of articles.
Offline
Re: Single/multiple articles in category
Should get you started:
<txp:if_individual_article>
<txp:article limit="1">
<txp:body />
</txp:article>
</txp:if_individual_article>
<txp:if_article_list>
<txp:article>
<txp:excerpt />
</txp:article>
</txp:if_article_list>
Last edited by jstubbs (2009-08-31 13:48:15)
Offline
Re: Single/multiple articles in category
Methinks OP is asking for something quite different: when an article list consists of only one article, not at all the same as individual article context.
I think you’ll need a plugin to count the articles, such as mdn_count or mem_article_count, then use variable and if_variable for the logic.
Code is topiary
Offline
Re: Single/multiple articles in category
@jsoo, you got me in the right direction.
<txp:variable name="single" value='<txp:mdn_count category="#"/>' />
<txp:if_variable name="single" value="1">
One article
<txp:else />
Article list
</txp:if_variable>
Last edited by LetterHoofd (2009-08-31 14:16:50)
Offline
Re: Single/multiple articles in category
I think one could adapt the TXP code in Els’ TXP Tip that deals with a similar issue where a single article in a section (as opposed to the category in LetterHoofd’s requirement) receives a different treatment to a more than one articles in a section.
Offline
Re: Single/multiple articles in category
Good one, Joe. Once again Els has the no-plugin answer.
Code is topiary
Offline
Pages: 1