Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
article custom and categories
Using article_custom, can I restrict articles which only belong to category1? I was thinking of something like
<txp:article_custom section="mysection" category1="mycategory" sort="rand()" limit="10"><txp:permlink><txp:title /></txp:permlink></txp:article_custom>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: article custom and categories
I dont think you can with textpattern tag, but using smd_query sure!
Offline
Re: article custom and categories
Hi Rabah,
Thanks… I’m trying to do it using native tags. I’m now experimenting with variables to achieve the above.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: article custom and categories
I think I have worked it out
<txp:article_custom section="mysection" category="mycategory" sort="rand()" limit="10">
<txp:variable name="categoryone" value='<txp:category1 />' />
<txp:if_variable name="categoryone" value="">
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_variable>
</txp:article_custom>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: article custom and categories
I think you could use <txp:if_article_category>
Instead of declaring the variable and the if else?
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Re: article custom and categories
I have thinked about that solution too, but the problem is you could have less than 10 articles using limit=“10”.
Last edited by Dragondz (2012-05-17 10:56:03)
Offline
Re: article custom and categories
Dragondz wrote:
I have thinked about that solution too, but the problem is you could have less than 10 articles using limit=“10”.
sure, but I’m not sure that’s a problem?
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Re: article custom and categories
My solution is also parsing 9 articles if any article from category2 makes the random list.
I use the code in 2 places.
- to generate a list of “10” articles
- to generate one random article (I use
limit-"1"
for this one:))
The first case doesn’t worry me too much, the second though, does.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: article custom and categories
colak wrote:
Using article_custom, can I restrict articles which only belong to category1?
Welcome to aks_article plugin
<txp:aks_article section="mysection" category1="mycategory" sort="rand()" limit="10"><txp:permlink><txp:title /></txp:permlink></txp:aks_article>
Last edited by makss (2012-05-22 09:13:04)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Pages: 1