Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-23 10:42:20

gemal
Member
From: Copenhagen, Denmark
Registered: 2007-01-09
Posts: 107
Website

Show new articles different than others?

Is there in txp or as a plugin a way to display, lets say, all articles that are less than 2 days old, in a different style than the others?

I mean something like this:
<txp:if_older_than days=“2”><div class=“new”></txp:if_older_than>

?

Last edited by gemal (2007-08-23 10:42:30)

Offline

#2 2007-08-23 12:04:15

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: Show new articles different than others?

You can put some peace of php code in your article form to do that

for examlpe:
<txp:php>
$gap = 2*24*60*60;
$t = strtotime(“now”);
$a = posted (array ());
$diff = $t – $a
if ($diff < $gap) { echo ‘<div class=“new”>’
}
</txp:php>

I haven’t tested the code, but i think you have the main idea of what must you do.

Offline

#3 2007-08-23 12:26:52

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

Re: Show new articles different than others?

One of these plugins perhaps?

Offline

#4 2007-08-23 16:13:40

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

Re: Show new articles different than others?

Offline

Board footer

Powered by FluxBB