Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-06-18 00:55:09

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

asy_showdate: shows posted-date, only if different from prom previous

This plugin makes it possible to show custom-formatted posted-date only if the output would be different from the previously outputted date.
So depending on which date-format you choose, you can make the date only appear once per (hour|day|week|month) even when you multiple articles in that time frame.

Example can be seen here:
www.sencer.de/links/

Takes two arguments: wraptag (as always), and format which is equivalent to php’s date function

www.sencer.de/code/asy_showdate.txt

Offline

#2 2004-06-18 06:37:03

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

Nice work, this is a cool plugin.

Offline

#3 2004-07-24 15:27:39

blazamo
Guest

Re: asy_showdate: shows posted-date, only if different from prom previous

I don’t get how this works. :(

#4 2004-07-25 22:12:24

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

It is an article-tag. You put in your article-form. The parameters and the usage is explained, when you click on the plugin in your admin-panel, and right below the Text-area there is description.

<:txp:asy_showdate format=“D, d.M” wraptag=“h2” /> where format takes the same attributes as phps date-function . Wraptag is optional.

Offline

#5 2004-07-25 22:17:52

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

Use this tag instead of <txp:posted />.

Offline

#6 2005-08-11 12:29:10

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

This tool is great. Thanks.

Is there a way to get German days, ie Dienstag for Tuesday?

Offline

#7 2005-08-12 16:54:52

tranquillo
Archived Plugin Author
Registered: 2005-03-07
Posts: 127
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

<code>function asy_showdate($atts) { global $thisarticle,$timeoffset; static $last_date = NULL;

$monate = array(1=>“Januar”, 2=>“Februar”, 3=>“März”, 4=>“April”, 5=>“Mai”, 6=>“Juni”, 7=>“Juli”, 8=>“August”, 9=>“September”, 10=>“Oktober”, 11=>“November”, 12=>“Dezember”);

$tage = array(1=>“Montag”, 2=>“Dienstag”, 3=>“Mittwoch”, 4=>“Donnerstag”, 5=>“Freitag”, 6=>“Samstag”, 7=>“Sonntag”,);

if (is_array($atts)) extract($atts);

$date_offset = $thisarticle[“posted”] + $timeoffset; $new_date = date($format,$date_offset);

$datum = strtotime(“$new_date”); $monat = date(“n”, $datum); $tag = date(“j”, $datum); $wochentag = date(“w”, $datum); $new_date = $tage[$wochentag] . “, “ . $tag . “. “ . $monate[$monat];

if (is_null($last_date) || ($new_date!=$last_date)) { $date_out = $last_date = $new_date; if (!empty($wraptag)) $date_out = tag($date_out,$wraptag); return $date_out; }
}</code>

wobei in <code><txp:asy_showdate format=“D d M” wraptag=“h2” /></code> das Format ohne Punkt und Komma angegeben werden muss.

Last edited by tranquillo (2005-08-12 17:06:03)

Offline

#8 2005-08-12 17:22:59

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

Besser wäre es einfach http://de.php.net/manual/en/function.strftime.php anstelle von date zu benutzen. ;)

Offline

#9 2005-08-12 18:02:46

tranquillo
Archived Plugin Author
Registered: 2005-03-07
Posts: 127
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

“Dieser kam zu ihm und legte ihm die Hände auf, damit er wieder sehen kann. Im selben Moment fiel es ihm wie Schuppen von den Augen, und er konnte wieder sehen.” :-)

Offline

#10 2005-08-12 22:06:29

valdok
Member
From: Chicago
Registered: 2004-03-14
Posts: 31
Website

Re: asy_showdate: shows posted-date, only if different from prom previous

I love you.

Offline

#11 2008-11-26 18:34:58

marcusm
New Member
Registered: 2008-11-26
Posts: 1

Re: asy_showdate: shows posted-date, only if different from prom previous

I just started a new blog with the latest version of Textpattern (4.0.6). On my main page I would like the date to be displayed only once per day, above the entries for that day. So I installed this plug-in (asy_whodate) and put it in the default form, according to the instructions, but the result is that no date is displayed at all.

Anyone know why it isn’t working or how to fix it?

Here is the default form, as I now have it:

<txp:asy_showdate format=“l, F j” wraptag=“h2” />

<txp:if_individual_article>
<h1 class=“entry-title”><txp:permlink><txp:title /></txp:permlink></h1>
<txp:else />
<h3 class=“entry-title”><txp:permlink><txp:title /></txp:permlink></h3>
</txp:if_individual_article>

<div class=“entry-content”>
<txp:body />
</div>

<p class=“tags”><txp:category1 title=“1” link=“1” />, <txp:category2 title=“1” link=“1” /></p>

<txp:comments_invite wraptag=“p” />

<div class=“divider”><img src=”<txp:site_url />images/1.gif” width=“400” height=“1” alt=”—-” title=”“ /></div>

Offline

#12 2008-11-26 20:25:25

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

Re: asy_showdate: shows posted-date, only if different from prom previous

Wouldn’t txp:if_different do exactly the same? (FAQ)

Offline

Board footer

Powered by FluxBB