Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Display text when no articles are available for a certain section?
I am currently designing for a newspaper website that uses Textpattern.
They want it so that the section fronts only display the most recent issue. I figured out how to do this with custom field, but sometimes there are no articles for a certain section in that issue, and the section page will be blank.
How can I make it so that the sections with no matching articles can have some text on it that says something like “No available articles”?
Thanks.
Josie
Offline
Re: Display text when no articles are available for a certain section?
chh_if_data should do it… but there might be a solution using just txp tags.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#3 2008-12-07 20:52:45
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Display text when no articles are available for a certain section?
colak wrote:
… but there might be a solution using just txp tags.
Of course there is (in 4.0.7) :) What is the code you are using on the section front page?
Offline
Re: Display text when no articles are available for a certain section?
I am using a simple article tag right now:
<txp:article form="section-list" issue="<txp:output_form form="issue"/>"/>
And I am also using 4.0.7.
I don’t mind using a plugin, but I would much rather keep it simple by using only textpattern default tags.
Last edited by xjosie729 (2008-12-07 21:38:51)
Josie
Offline
#5 2008-12-07 21:47:33
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Display text when no articles are available for a certain section?
<txp:variable name="if_articles" value='<txp:article issue=''<txp:output_form form="issue" />'' />' />
<txp:if_variable name="if_articles" value="">
<p>No recent articles for this issue.</p>
<txp:else />
<txp:article form="section-list" issue='<txp:output_form form="issue"/>' />
</txp:if_variable>
Not tested, and it’s new for me as well, so let me know if it works.
Last edited by els (2008-12-07 21:53:34)
Offline
Re: Display text when no articles are available for a certain section?
It works perfectly. Thank you so much!
Josie
Offline
Re: Display text when no articles are available for a certain section?
I used a custom field named “issue”.
I can’t find it now but I read somewhere on the FAQ that it’s possible to use the name of the custom field as an attribute for the article tag in order to filter the articles.
Josie
Offline
#8 2008-12-08 02:26:31
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: Display text when no articles are available for a certain section?
xjosie729 wrote:
I used a custom field named “issue”.
Of course, I had forgotten that. It’s getting late here ;-)
Offline