Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
Re: Display 5 recent articles except the one MOST recent
Stuart, what kind of problems do you run into with double article tags?
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
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.
Offline
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
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