Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2016-06-05 06:03:34
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 276
how to apply if_first_article to articl_custom ?
is it possible to apply the <txp:if_first_article>
to the <txp:article_custom ...>
area ?
i tried this to default form, but not works for me:
<txp:article_custom category='news'>
<txp:if_first_article><ul></txp:if_first_article>
<li><txp:title /></li>
<txp:if_last_article></ul></txp:if_last_article>
</txp:article_custom>
Offline
Re: how to apply if_first_article to articl_custom ?
I think this might be a simpler solution:
<ul>
<txp:article_custom category='news'>
<li><txp:title /></li>
</txp:article_custom>
</ul>
Offline
#3 2016-06-05 20:31:21
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: how to apply if_first_article to articl_custom ?
Your code, raminrahimi, should work. Its advantage is when “news” doesn’t have an article, so Textpattern doesn’t output an empty <ul>
.
Is it possible that something is wrong in the context where you use your code block?
Offline
Re: how to apply if_first_article to articl_custom ?
Simpler still:
<txp:article_custom category="news" wraptag="ul" break="li">
<txp:title />
</txp:article_custom>
but I guess your actual situation is more complex. Your logic looks fine and if_first_article
and if_last_article
do work with txp:article_custom
. Perhaps check the rest of your code within your tags carefully to see if there are any anamolies that might be interfering with the logic.
TXP Builders – finely-crafted code, design and txp
Offline
Re: how to apply if_first_article to articl_custom ?
Thank you, Jakob. You have the best solution and I should have caught that.
Offline