Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
comma-separated categories
Hi guys.
I want to view article, which placed in two categories, but, i dont want to show articles, which placed in one of categories also.
for example, i want to show one article, which placed in category a and b, i do for it:
<txp:article_custom category=“a, b” form=“default” limit=“3” pgonly=“0” section=“news” sort=“Posted desc” status=“4” />TXP views all articles which placed in both categories, but i have only one article which is placed in both categories. How i can do this?
thanks.
<txp:txp_me />
Offline
Re: comma-separated categories
Hi Zia
I dont know how you can do that usi,g standard txp tag, the only way isee is by using bloke pluggin : smd_query
Cheers
Offline
Re: comma-separated categories
soo_article_filter is another possible solution.
<txp:soo_article_filter where="category1 IN ('a','b') AND category2 IN ('a','b')">
<txp:article_custom limit="3" section="news" />
</txp:soo_article_filter>
Notes:
- This is untested.
- The category test I’ve used here isn’t very strict; it only checks that each article category is assigned to either ‘a’ or ‘b’. To get something more specific would require a more elaborate
where
clause. - I’ve removed the unneeded attributes from your
article_custom
tag. You have three (status
,sort
,form
) that you are simply setting to their default values, and one (pgonly
) that doesn’t do anything inarticle_custom
(it’s allowed because of the shared code betweenarticle
andarticle_custom
).
Code is topiary
Offline
Pages: 1