Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2015-03-07 06:13:03
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
if no article found, message appear
here i listed all my future events:
<txp:article form="upcoming-events" time="future" section="upcoming-events" limit="5" />
now i need to appear a message of “No Article Found” if there is no listed articles found.
thanks
Offline
Re: if no article found, message appear
<txp:variable name="hasarticle" value='<txp:article form="upcoming-events" time="future" section="upcoming-events" limit="1" />' />
<txp:if_variable name="hasartcle" value="">
No Article Found
<txp:else />
<txp:article form="upcoming-events" time="future" section="upcoming-events" limit="5" />
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: if no article found, message appear
You’d better reuse the variable, rather than calling <txp:article />
twice, especially with different limit
attributes (can break pagination):
<txp:variable name="hasarticle" value='<txp:article form="upcoming-events" time="future" section="upcoming-events" limit="5" />' />
<txp:if_variable name="hasartcle" value="">
No Article Found
<txp:else />
<txp:variable name="hasarticle" />
</txp:if_variable>
Offline
#4 2015-03-09 18:04:32
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: if no article found, message appear
Perfect :-)
Offline
Pages: 1