Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-03-29 05:10:24

wilshire
Plugin Author
From: Akron, Ohio
Registered: 2004-08-27
Posts: 656
Website

[plugin] [ORPHAN] rss_posted

Based on an idea from one of my favorite textpatterners I put together an alternative to the standard <code><txp:posted/></code> tag. The major addition is that each part of the date (year, month and day) will be hyperlinked.

This can be used to link to an archive or other page that supports filtering by date. Coincidentally, this can be done using the latest version (0.14) of the rss_suparchive and you can see this in use on the posted dates on my site.

Given an example date of March 28, 2005, 3 hyperlinks will be created:

  1. 2005 will be hyperlinked to /section/2005
  2. March will be hyperlinked to /section/2005/03
  3. 28 will be hyperlinked to /section/2005/03/28

rss_posted

Download

Offline

#2 2005-03-30 01:37:36

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: [plugin] [ORPHAN] rss_posted

works beautifully. thanks Rob :)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#3 2005-04-22 08:22:34

nathanpitman
New Member
From: Berkshire, UK
Registered: 2004-04-05
Posts: 4
Website

Re: [plugin] [ORPHAN] rss_posted

quick question RE this plug-in and your suparchive_menu… how do I make my archives page ‘data aware’? At present it returns nothing but an empty html and body tag when I try to browse it using http://nathanpitman.com/archives/2005/04 for example.

:)

Cheers.

Offline

#4 2005-04-22 12:03:29

wilshire
Plugin Author
From: Akron, Ohio
Registered: 2004-08-27
Posts: 656
Website

Re: [plugin] [ORPHAN] rss_posted

There is nothing special you should have to do. The filtering happens automatically based on your URL. What version of the plugin and Textpattern are you using?

Offline

#5 2005-04-22 12:53:54

nathanpitman
New Member
From: Berkshire, UK
Registered: 2004-04-05
Posts: 4
Website

Re: [plugin] [ORPHAN] rss_posted

TXP latest build, downloaded this AM (RC3).

rss_suparchive, 0.14

:)

Offline

#6 2006-03-09 14:18:24

carla
Member
Registered: 2005-09-20
Posts: 17
Website

Re: [plugin] [ORPHAN] rss_posted

Could anyone please give some styling advice for this plugin? Thank you! :)


Offline

#7 2006-06-03 15:15:40

[CPR]-AL.exe
Member
From: Moscow
Registered: 2006-04-07
Posts: 18
Website

Re: [plugin] [ORPHAN] rss_posted

My friend Lexxus has made a bugfix (with 1-9 days) and added a support for different languages (here you can see a Russian version, used on cpr.wandy.ru):

function rss_posted($atts) {

global $thisarticle;
extract($atts);

$monthformat = isset($monthformat) ? $monthformat : “n”;
$dateformat = isset($dateformat) ? $dateformat : “j”;
$yearformat = isset($yearformat) ? $yearformat : “Y”;
$formatmode = isset($formatmode) ? $formatmode : “DATE”;
$sep1 = isset($sep1) ? $sep1 : “ “;
$sep2 = isset($sep2) ? $sep2 : “, “;
$linktosection = isset($linktosection) ? $linktosection.”/” : “”;
$order = isset($order) ? $order : “M,D,Y”;

$linkDateFormat = ‘d’;
$linkMonthFormat = ‘m’;
$linkYearFormat = ‘Y’;

$pdate = $thisarticle[“posted”];

$darr = array( ‘pdate’ => $pdate, ‘linktosection’ => $linktosection, ‘monthformat’ => $monthformat, ‘dateformat’ => $dateformat, ‘yearformat’ => $yearformat, ‘linkMonthFormat’ => $linkMonthFormat, ‘linkDateFormat’ => $linkDateFormat, ‘linkYearFormat’ => $linkYearFormat
);
$sarr = array($sep1,$sep2);

$dts = explode(“,”, $order); $dateformat = ($mode == “YEAR”) ? “%Y” : “%B %Y”; $c=-1; $p=0; $lasto=”“; $lastd = safe_strftime($dateformat,$res0[“posted”]); for($i=0; $i < count($dts); $i++) { $ddate[] = rss_fmt($darr, $dts[$i]).$sarr[$i]; }

return implode(‘’, $ddate);
}

function rss_fmt ($darr, $type) {

$rus_month = array (’ ‘, ‘января’, ‘февраля’, ‘марта’, ‘апреля’, ‘мая’, ‘июня’, ‘июля’, ‘августа’, ‘сентября’, ‘октября’, ‘ноября’, ‘декабря’);

extract($darr);

switch ($type) { case “M”: return href($rus_month[date($monthformat, $pdate)], hu.$linktosection.date($linkYearFormat, $pdate).”/”.date($linkMonthFormat, $pdate)); break; case “D”: return href(date($dateformat, $pdate), hu.$linktosection.date($linkYearFormat, $pdate).”/”.date($linkMonthFormat, $pdate).”/”.date($linkDateFormat, $pdate)); break; case “Y”: return href(date($yearformat, $pdate), hu.$linktosection.date($linkYearFormat, $pdate)); break; default: return; }

}


There are 10 types of people in the world – those who understand binary and those who don’t.

Offline

#8 2007-02-16 15:06:48

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

Re: [plugin] [ORPHAN] rss_posted

wilshire wrote:

Based on an idea from one of my favorite textpatterners I put together an alternative to the standard <code><txp:posted/></code> tag. The major addition is that each part of the date (year, month and day) will be hyperlinked.

Any chance or an option to have the output of the tag be runned thorugh htmlentities. A textpattern site is in UTF8 and in Denmark some of the months name are using HTML entities, so I like to enscape the month names before outputting them.

so a htmlentities=“1” option would be super nice!

Offline

Board footer

Powered by FluxBB