Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-30 04:58:28

benbruce
Plugin Author
Registered: 2006-01-13
Posts: 328
Website

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,

– Ben

Offline

#2 2007-12-30 05:03:56

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

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

#3 2007-12-30 14:32:48

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: how do you style recent articles differently than regular articles?

And you also could use txp:if_first_article and txp:if_last_article

Cheers!

Offline

#4 2007-12-31 04:28:44

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

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

#5 2007-12-31 06:56:38

benbruce
Plugin Author
Registered: 2006-01-13
Posts: 328
Website

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

#6 2007-12-31 08:04:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

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

#7 2007-12-31 15:40:52

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

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?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2007-12-31 17:18:23

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: how do you style recent articles differently than regular articles?

Ben

Have you checked out the ras_if plugins?

Or maybe Steve’s new smd_if plugin could be made to work somehow?

Mike

Offline

#9 2007-12-31 18:35:21

benbruce
Plugin Author
Registered: 2006-01-13
Posts: 328
Website

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

Board footer

Powered by FluxBB