Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-11-16 07:17:20

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,032
Website GitHub Mastodon Twitter

[SOLVED] article custom conditionals

I am trying to get a list using the article custom tag but I want this list to exclude the current, and another article. This is the code which seems that it is not working as nothing is parsed.

<txp:if_individual_article>
<txp:article_custom section="archive" limit="20" wraptag="ul" break="li">
<txp:if_article_id id='<txp:article_id />,1'>
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_article_id>
</txp:article_custom>
</txp:if_individual_article>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2017-11-16 07:50:35

etc
Developer
Registered: 2010-11-11
Posts: 5,082
Website GitHub

Re: [SOLVED] article custom conditionals

Hi Yiannis,

you should set the parent <txp:article_id /> outside of <txp:article_custom /> list:

<txp:variable name="article_id" value='<txp:article_id />' />
<txp:if_individual_article>
<txp:article_custom section="archive" limit="20" wraptag="ul" break="li">
<txp:if_article_id id='<txp:variable name="article_id" />,1'>
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_article_id>
</txp:article_custom>
</txp:if_individual_article>

or, better, use exclude attribute:

<txp:if_individual_article>
<txp:article_custom exclude='<txp:article_id />,1' section="archive" limit="20" wraptag="ul" break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:if_individual_article>

Offline

#3 2017-11-16 09:02:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,032
Website GitHub Mastodon Twitter

Re: [SOLVED] article custom conditionals

Thanks so much Oleg…. I have to remember the exclude attribute… So much simpler. The second script works just fine!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB