Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
how do you style recent articles differently than regular articles?
I say style — and that would work — but I’d really like to display some special content (“Just Added!” or something).
I’ve been looking for a <txp:if_recent></txp:if_recent>
tag but haven’t found it. I tried to build it myself, but it wasn’t happening. Does anyone know how to do this?
Thanks,
– BenOffline
Re: how do you style recent articles differently than regular articles?
What about using the “limit” and “offset” attributes with 2 article tags and different forms?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Offline
Re: how do you style recent articles differently than regular articles?
Ben
Do either Stuart or Jukka’s suggestions meet your goal? Or are you looking for something more dynamic – ie, any and all articles meeting the necessary condition show the “special content” automatically, and after a certain time, automatically age out, even if they remain the most recent posts?
Mike
Last edited by maverick (2007-12-31 04:29:10)
Offline
Re: how do you style recent articles differently than regular articles?
I knew I wasn’t being perfectly clear. No, neither of those will do for me here.
The specific example is: entering tour dates, and I have them being ordered by a custom field by date so they will appear correctly on the page. The clients like to have a little yellow sign appear by the dates if they are newly added (“Just Added!”) — this makes sense to me. If someone signs up for the RSS feed, or just drops by regularly to check it out, this is a good way to see what’s new on the page at a glance.
So what I’d really like is something like this:
<txp:if_recent>
<div class="justadded"><img src="justadded.gif" /></div>
</txp:if_recent>
Does that make sense? So if the article is recent, the justadded.gif is displayed, but as the article ages and it’s no longer considered recent, the image is no longer displayed. This seems like something that would be useful to more people than just me. I tried to hack something together myself taking my cue from the @<txp:recent_articles /> tag, but I couldn’t figure it out.
Thanks,
- Ben
Offline
Re: how do you style recent articles differently than regular articles?
Would csb_if_newer_than be what you are looking for?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: how do you style recent articles differently than regular articles?
I would go with Stuart’s suggestion:
<txp:article limit="1" form="just-added-form" />
<txp:article offset="1" form="normal-form" />
Although… this would only work for just one “just added” tour date (the last one).
By the way, how do you use a custom field as a date and then have your articles listed in order by that custom field? I mean, in which format should the date be typed?
Offline
Re: how do you style recent articles differently than regular articles?
Ben
Have you checked out the ras_if plugins?
- ras_if_dates
- ras_if_expired
- ras_enable_content/links
- ras_if_days (which was to eventually replace his “if_current” and “if_expired” plugins.
Or maybe Steve’s new smd_if plugin could be made to work somehow?
Mike
Offline
Re: how do you style recent articles differently than regular articles?
Thanks everyone! I’m pretty sure that cbs_if_newer_than is exactly what I’m looking for.
maniqui,
I’m using msv_if_custom_article_date to order the articles correctly.
- Ben
Offline