Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-04 18:27:17

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

Today's featured article

I have a bunch of articles, and I would like to display a different one each day in an order that I specify ahead of time — not randomly. How do I do it?


Mark

Offline

#2 2008-09-04 20:15:47

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Today's featured article

Set the publication date to the date when you want to show the article and use limit=“1” in the txp:article tag to show just one article.

Offline

#3 2008-09-04 20:38:51

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

Re: Today's featured article

That would, I believe, preclude the article from showing up at all until the specified date. What if I wanted people to be able to read the articles at any time if they navigated to various categories, but have one of those articles show up on the front page as a featured article? Is there a way, perhaps, that I could rotate through them on a daily basis?


Mark

Offline

#4 2008-09-04 20:56:51

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Today's featured article

You could set the day of year as a value of a custom field (named customfield1) and use the article_custom list to show a list of just one article that matches the current day of year, using asy_wondertag:

<txp:asy_wondertag><txp:article_custom limit="1" customfield1="<txp:php>echo date('z');</txp:php>" /></txp:asy_wondertag>

In the upcoming TXP 4.0.7, it could be done like this:

<txp:article_custom limit="1" customfield1='<txp:php>echo date(''z'');</txp:php>' />

Last edited by ruud (2008-09-04 21:23:06)

Offline

#5 2008-09-04 21:00:13

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

Re: Today's featured article

Thanks. I’ll give it a try.


Mark

Offline

#6 2008-09-04 21:11:42

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Today's featured article

txp:custom_list?

Did you mean txp:article_custom?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2008-09-04 21:22:46

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Today's featured article

Yes, I’ll update the example in my post.

Offline

#8 2008-09-05 20:56:35

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

Re: Today's featured article

Strangely enough, the asy_wondertag plug-in is not listed at Textpattern Resources. I had to hunt it down in the forums.


Mark

Offline

Board footer

Powered by FluxBB