Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [howto] show articles from category and augment with articles from section
Oh right, we posted at the same time. Nice solution, there too.
Ah well, I learned something in the process too.
TXP Builders – finely-crafted code, design and txp
Offline
Re: [howto] show articles from category and augment with articles from section
jakob wrote:
Nice solution, there too.
It wouldn’t have been possible without yours and Uli’s help:)
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: [howto] show articles from category and augment with articles from section
by adding <txp:if_article_id>
in the article_custom
tag one can omit the current article from the generated list. Thanks to Jukka for the tip.
Latest code
<txp:variable name="relatedtexts"
value='<txp:related_articles limit="10" break=",">
<txp:article_id />
</txp:related_articles>'/>
<txp:variable name="moretexts"
value='<txp:article_custom
limit="11" section=''<txp:section />''
break="," sort="rand()">
<txp:if_article_id><txp:else /><txp:article_id /></txp:if_article_id>
</txp:article_custom>' />
<txp:if_variable name="relatedtexts" value="">
<txp:article_custom limit="10" section='<txp:section />' break="li" wraptag="ul" sort="rand()" class="related_articles">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
<txp:else />
<txp:article_custom
wraptag="ul"
break="li"
limit="10"
class="related_articles"
id='<txp:rah_repeat offset="1"
break="," duplicates="1"
sort="regular asc"
value=''<txp:variable name="relatedtexts"/>,<txp:variable name="moretexts" />''>
<txp:rah_repeat_value />
</txp:rah_repeat>'
sort='field(ID,<txp:variable name="relatedtexts" />,<txp:variable name="moretexts" />)'>
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:if_variable>
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: [howto] show articles from category and augment with articles from section
I thought this would be the solution to all my problems, but it doesn’t seem to work for me. I copied the code from the last post but it only works for articles without an assigned category. Does anyone have a clue?
…Prrrrrrrr…
Offline