Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Don't display an article at the form level if the posted date is past
Ok, this is convoluted. I’ve a section who’s only job is to display articles from a certain category with time="any"
.
One particular section has events, and for those the posted day is the date of the event, so i need to exclude them in the form. Thinking something like this:
<txp:if_article_section name="events"><txp:else/>
<txp:if_posted ... or something???><txp:else/>
<txp: body/> and whatnot
</txp:if_posted>
</txp:if_article_section>
Any way to do this?
Yes, I have tried turning it off and on.
Offline
#2 2016-12-23 20:09:31
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Don't display an article at the form level if the posted date is past
If you have set an ‘expires’ date for the articles in section ‘Events’, you could do this:
<txp:if_article_section name="events">
<txp:if_expired>
<txp:else />
<txp:body /> etcetera
</txp:if_expired>
<txp:else />
<txp:body /> etcetera
</txp:if_article_section>
But if not, you will probably need one of smd_query or etc_query.
Offline
Re: Don't display an article at the form level if the posted date is past
What you need (if I get it right) will be possible in 4.7 with <txp:evaluate />
tag. Meanwhile, you can try etc_date
<txp:if_article_section name="events"><txp:else/>
<txp:etc_if_date date="posted" compare="now.." format="%s">
<txp: body/> and whatnot
</txp:etc_if_date>
</txp:if_article_section>
Last edited by etc (2016-12-23 22:53:22)
Offline
Re: Don't display an article at the form level if the posted date is past
Els wrote #303397:
If you have set an ‘expires’ date for the articles in section ‘Events’ …
If I were starting from scratch, I would probably make ‘expired’ the date of the event rather than posted. Hmm.
etc wrote #303398:
What you need (if I get it right) will be possible in 4.7 with
<txp:evaluate />
tag. Meanwhile, you can try etc_date
<txp:if_article_section name="events"><txp:else/>...
I’ll try that. Also <txp:evaluate />
sounds intriguing. I’m looking forward to 4.7!
Meanwhile, I solved this “for now” with basically a gross hack: two separate article_custom tags, one with time=“any” and one with time=“future”. Now the Events are always on top of the other articles. But since I’d be sorting by date and the other articles are “evergreen” and posted however long ago the result is the same.
Yes, I have tried turning it off and on.
Offline