Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-07-20 17:25:29

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 241
Website

How do I list expired articles?

I’m trying to build a list of past events using the date and time information saved to each article’s Expires field. Textpattern’s tag builder doesn’t have anything that could help. Anyone?

Offline

#2 2011-07-20 18:27:14

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: How do I list expired articles?

Don’t take the tag builder as the Gospel, use the TXP tag list when you’re lost.

if_expired is what you need inside your form or article tag.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2011-07-20 18:45:52

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 241
Website

Re: How do I list expired articles?

When I am trying to open an article that has reached its expiration date, it seems to be going to error page with code 410. That part is clear as it’s pretty easy to put a conditional tag inside error template and see if the page is expired or not. Problem is how to show that expired content. :-( I’ve tried to get a list of expired stuff using this:

<txp:article_custom limit="100" listform="kalenteri_lista" pgonly="0" searchall="1" status="4" time="past" section="kalenteri" />

So the time is directed to only past published articles. The listform has these (bottom part is done with uli’s help, but expired articles are still not visible):

<li>
<txp:posted format="%d.%m.%Y" />
<txp:if_expires>&ndash;<txp:expires format="%d.%m.%Y" /></txp:if_expires>: <txp:title />
</li>
<txp:if_expired>
<li>
<txp:posted format="%d.%m.%Y" />&ndash;<txp:expires format="%d.%m.%Y" />: <txp:title />
</li>
</txp:if_expired>

Offline

#4 2011-07-20 18:51:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,921
Website GitHub

Re: How do I list expired articles?

kuopassa wrote:

When I am trying to open an article that has reached its expiration date, it seems to be going to error page with code 410.

This might be a daft suggestion but have you checked to see if Publish expired articles is set to Yes in your Advanced Prefs?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2011-07-20 18:54:47

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 241
Website

Re: How do I list expired articles?

Thanks for pro tip, Bloke. That was it. :-)

Offline

Board footer

Powered by FluxBB