Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-12 16:32:19

jbhis8up
Member
From: Converse, TX
Registered: 2004-12-16
Posts: 22
Website

Display 5 recent articles except the one MOST recent

I’m trying to figure out a way to display a list of the most recent articles with the exception of THE MOST recent article. I’d like to have the one most recent article displayed at the top of the page and the other 5 most recent articles displayed in a list on another part of the page.

Any suggestions?

Offline

#2 2006-04-12 17:00:43

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Display 5 recent articles except the one MOST recent

<code><txp:article limit=“1” />
<txp:article limit=“5” offset=“1” /></code>

Offline

#3 2006-04-12 18:07:55

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Display 5 recent articles except the one MOST recent

Using 2 article tags may create problems. I would suggest the second be an article_custom tag. If there are sections that aren’t allowed on the front-page then using the “section=” attribute with a comma-separated list of those sections that are allowed will be needed.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#4 2006-04-12 18:13:22

jbhis8up
Member
From: Converse, TX
Registered: 2004-12-16
Posts: 22
Website

Re: Display 5 recent articles except the one MOST recent

I never knew about the <code>offeset</code> property. I guess I should read up on the latest enhancements (unless that’s not that new…) Thanks for the help guys!

Offline

#5 2006-04-12 18:59:32

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Display 5 recent articles except the one MOST recent

Stuart, what kind of problems do you run into with double article tags?


Offline

#6 2006-04-12 20:48:07

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

Re: Display 5 recent articles except the one MOST recent

thebombsite wrote:

Using 2 article tags may create problems. I would suggest the second be an article_custom tag. If there are sections that aren’t allowed on the front-page then using the “section=” attribute with a comma-separated list of those sections that are allowed will be needed.

AFAIK, “section=” attribute in <txp:article_custom /> doesnt allow multiple comma-separated values. It’s a “one value” (one section) attribute.

@ ma_smith

I think Stuart is talking about “problems” with more than one <txp:article /> in the page when you are in individual-article context.
For each txp:article in a page template, when you are in individual-article context, it will call the corresponding individual article (and there will be more “troubles” if auto-append comments is on).
A solution is to wrap the snippet like this.
<code><txp:if_individual_article>
<txp:article />
<txp:else />
<txp:article limit=“1” />
<txp:article limit=“5” offset=“1” />
</txp:if_indivual_article></code>

A “dirty” solution w/o condtinital could be this:
<code><txp:article limit=“1” />
<txp:article limit=“5” offset=“1” form=“empty” listform=“mylistform” /></code>

Then, you have a totally empty form named “empty”. So, when in individual-article context, it wont output nothing.
Dont know (cant imagine) if there is a side-effect by doing that.

@ jbhis8up

The “offset” isnt new, at least, it was already in 4.0.2, and before, if i’m not wrong.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2006-04-12 22:26:58

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Display 5 recent articles except the one MOST recent

Damn. My bad. They’ve added comma-separateds to so many “sections” you forget where we’re at. Maybe that should be next on the list. I think “chh_article_custom” allows them. Maybe we should check out the code and send it in?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#8 2006-04-13 02:50:30

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Display 5 recent articles except the one MOST recent

Bah, it should allow a list (same for category). Patch time…

Offline

#9 2006-04-13 09:25:45

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Display 5 recent articles except the one MOST recent

Nice one. :)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB