Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-03-06 13:42:00

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,485
Bitbucket GitHub

Displaying live, expired and future articles with article_custom

Hi, everyone.
I’ve come unstuck with article_custom, and I’m hoping someone can give me a pointer or two.

I would like to:

i) display articles that are live and non-expired (that is, that the status is live and there is either no expiry set, or the expiry is in the future)
ii) display articles that are live and expired (that is, live status and an expiry date in the past)
iii) display articles that are live and upcoming (that is, live status and a timestamp in the future)

First of all, I’ve set expired articles to be displayed via admin -> prefs -> advanced. I am also aware of arc_pref_override and I’m getting used to the logic behind that.

I have achieved iii) above with the following:

<txp:article_custom time=“future” />

And I can achieve i) by wrapping arc_pref_override around an article tag, like this:

<txp:arc_pref_override pref=“publish_expired_articles” value=“0”><txp:article limit=“999” /></txp:arc_pref_override>

…but I’m stumped when I try and figure the logic around ii). Is there a way to use article_custom (or even article, I’m not fussy) to only output expired articles? Failing that, is there a recommended plugin that can achieve the same thing?

Thanks in advance.
Pete

Last edited by gaekwad (2012-03-06 13:44:06)

Offline

#2 2012-03-06 13:51:10

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

Re: Displaying live, expired and future articles with article_custom

gaekwad wrote:

Is there a way to use article_custom to only output expired articles?

Does the <txp:if_expired> tag help?

Untested but:

<txp:article_custom>
   <txp:if_expired>
       // I'm a goner!
   </txp:if_expired>
</txp:article_custom>

should do the trick.

btw, a new attribute expired for article custom is coming.


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

#3 2012-03-06 14:00:38

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,485
Bitbucket GitHub

Re: Displaying live, expired and future articles with article_custom

Bloke wrote:

<txp:article_custom> <txp:if_expired> // I’m a goner! </txp:if_expired>
</txp:article_custom>

Perfect – just the job. Thanks, Stef.

btw, a new attribute expired for article custom is coming.

Aha! Excellent news!

Offline

Board footer

Powered by FluxBB