Textpattern Forum

You are not logged in. Register | Login | Help

#1 2009-07-04 16:58:43

woof
Member
Registered: 2004-08-01
Posts: 127

Exclude expired articles when Publish expired articles is set to yes?

Greetings all. I hope someone can help with my seemingly simple yet sticky puzzle to do with expired articles

I have Publish expired articles? set to yes in the advanced preferences tab.

My articles are for theatre performance runs where start time is the Timestamp date and time and end time is the Expires date and time.

My page shows two lists of articles:
A. what’s on right now (i.e. where the start time is past and the end time is in the future).
B. what’s coming up (i.e. start time is in the future).

B. is easy… this works:
<txp:article_custom pgonly="0" section="productions" time="future" listform="whatsongrid_next" sort="Custom_4 asc"/>

A. sounds easy — and with Publish expired articles? set to the default no it is… this works:
<txp:article_custom pgonly="0" section="productions" listform="whatsongrid_now" time="past" sort="Custom_4 asc"/>

But when Publish expired articles? is set to yes it outputs ALL expired articles in the section.

I tried using if_expired in the list form and although it works its probably not a good solution from an overhead pov (especially as there will be hundreds of expired articles):
<txp:if_expired><txp:else /><txp:permlink><txp:title /></txp:permlink></txp:if_expired>

I think saccade has identified the problem in his post in the Feature Ideas forum Expired Articles: Finetuning and his proposed tag attribute solution works perfectly for me (many thanks saccade!), but, unless this is officially adopted, for obvious reasons I’d much rather find a plug-in, workaround or inline php solution to this.

Does anyone have any suggestions? Thanks.

Last edited by woof (2009-07-04 17:01:36)

Offline

#2 2009-07-04 18:10:30

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: Exclude expired articles when Publish expired articles is set to yes?

I don’t know how it stacks up from the point of view of overhead, but you could use the odd little plugin I just published yesterday. I was already thinking of un-publishing it owing to the direction of this thread, but what you’re requesting is one of the other useful things about the plugin.


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#3 2009-07-04 18:36:02

woof
Member
Registered: 2004-08-01
Posts: 127

Re: Exclude expired articles when Publish expired articles is set to yes?

Hi J Soo
Cheers – I tried out your plugin earlier and I could be mistaken but it seemed I couldn’t get it to exclude expired articles in the output. I’m going to revisit it right now, give it another go and see how I get on. Thanks.

Offline

#4 2009-07-04 18:41:11

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: Exclude expired articles when Publish expired articles is set to yes?

Hmm, appears to be quite FUBAR’d. Let me have a look…

Edit: Okay, I think I’ve fixed it.

Last edited by jsoo (2009-07-04 19:19:31)


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#5 2009-07-04 19:29:23

woof
Member
Registered: 2004-08-01
Posts: 127

Re: Exclude expired articles when Publish expired articles is set to yes?

jsoo wrote:

Okay, I think I’ve fixed it.

Cheers – I was just about to reply to say I gave it another go and still can’t seem to get your plugin to achieve what I’m looking for – though I feel the capability is probably close.

fingers crossed and thanks for your help

Offline

#6 2009-07-04 19:57:12

woof
Member
Registered: 2004-08-01
Posts: 127

Re: Exclude expired articles when Publish expired articles is set to yes?

Thanks for the fix jsoo but unfortunately I still can’t seem to get it to work for what I’m trying to achieve

I want to exclude all articles with an expired value from what is returned by the article tag when time =“past” and publish expired articles is yes

So if I had three articles with timestamp and expiry ranges as follows, today (4 July 09) it would show only B.
A. 01 Jan 09 – 30 April 09
B. 01 May 09 – 31 August 09
C. 01 Sept 09 – 31 Dec 09

Offline

#7 2009-07-04 20:07:13

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: Exclude expired articles when Publish expired articles is set to yes?

Using version 0.2 of the plugin, I have just set up a group of articles with the exact Posted and Expires dates you list in your example. Using this code:

<txp:soo_article_filter expires="future">
<txp:article time="past" />
</txp:soo_article_filter>

shows only article B.

Edit: Is your site in debugging mode? If you’re getting the “Not unique table/alias” error you will need to use the alternate version of the plugin.

Last edited by jsoo (2009-07-04 20:09:26)


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#8 2009-07-04 20:22:50

woof
Member
Registered: 2004-08-01
Posts: 127

Re: Exclude expired articles when Publish expired articles is set to yes?

Excellent – It works! – sorry for confusion, not sure why it didn’t work first time.

I’m using the standard version of the plug-in and it works ok – btw the alternate version in the current download archive seems to have corrupted – when I open it its just an error message rather than the expected plugin code.

Thanks for your help and a really useful plug-in. Woof

Offline

#9 2009-07-04 20:32:12

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: Exclude expired articles when Publish expired articles is set to yes?

woof wrote:

btw the alternate version in the current download archive seems to have corrupted – when I open it its just an error message rather than the expected plugin code.

Oops — fixed. Thanks for pointing it out, and glad the plugin’s working for you!


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

Board footer

Powered by FluxBB