Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#85 2004-09-28 21:33:20

Luc
New Member
From: Brazil
Registered: 2004-09-21
Posts: 8
Website

Re: Browsing by date plugin

Hi guys,

i’m new at Textpattern but have managed to set my blog up. I’m working at my archive and installed the akw_archive and akw_date_aware plug ins.

I managed to get my archive to work as intended, namely a list of months and years:

september 2004
august 2004
etc.

However i have one glitch:
if i click on september, i get the posts of august, if i click on august i get the ones of july,…. so it’s always a month off.
I only use my frontpage to show the archive list and have only 2 page templates: the default one and the archive one.

here are the tags i use:

<txp:akw_article_date_aware limit=“5” />

<txp:akw_month_list limit=“1000” archiveform=“entry_list” monthform=“entry_excerpt” form=“entry_full” headwrap=“h3” daywrapclass=“day-list” dayitemclass=“day” postwrapclass=“post-list” />

Note that i’m not using forms for these tags: i’m not sure if i need to and if so, how to set them up.

Does one of you have a clue as to why the archive shows off a month?

live page:

http://www.dzinelabs.com/blog/cms/


@dzinelabs

Offline

#86 2004-09-28 22:21:05

tinyfly
Member
From: Dallas, Texas
Registered: 2004-05-10
Posts: 462
Website

Re: Browsing by date plugin

Hey Luc,

Welcome to Textpattern. Read the post above yours. It looks like the problem is with the timezone settings in the admin area. Set the timezone to 0 until this bug gets fixed and see if that helps

Offline

#87 2004-09-28 23:32:15

Luc
New Member
From: Brazil
Registered: 2004-09-21
Posts: 8
Website

Re: Browsing by date plugin

DUH! That’s what you get when scanning posts instead of read them carefully ;-)

Indeed, setting it to 0 did the trick.

Tnx a lot tinyfly.

Now i’m almost ready to replace my current blog with TextPattern :-)

I have a question about that but i guess i’ll post that somewhere else :-)


@dzinelabs

Offline

#88 2004-10-02 19:07:36

HarryTick
New Member
From: NY
Registered: 2004-05-20
Posts: 5
Website

Re: Browsing by date plugin

I’ve just about given up attempting to get these plugins to work. I keep coming back and messing with it every couple of weeks. Not sure if it is my inexperience with the textpattern model, or just plain not understanding where in pages/forms/articles they were intended to operate.

rares back to throw towel in

Offline

#89 2004-10-02 20:57:09

botono9
Member
Registered: 2004-07-07
Posts: 17
Website

Re: Browsing by date plugin

I modified the original code to get it to work they way I want (pull from section of my choice, don’t break down by days). I’ll lay it all out in this message. Proceed at your own risk.

Here’s the code of the plugin, with my changes. Copy this into the code window and click save:

<pre>//
// Archive 0.6 (g19) by Lex Konrad (nakedloftparty.com)
// Portions by Dean Allen
// Slightly adjusted by Aaron Murray (onotob.org)

// ——————————————————————————————-
// View switcher

function akw_archive($atts)
{ global $pretext,$txpac;

$d = gps(‘d’); $m = gps(‘m’); if ($pretext[‘id’]) { return akw_doArticle_da($atts); } if ($d) { $atts[‘listform’] = ($atts[‘dayform’]) ? $atts[‘dayform’] : $atts[‘listform’]; return akw_doArticles_da($atts); } if ($m) { $atts[‘listform’] = ($atts[‘monthform’]) ? $atts[‘monthform’] : $atts[‘listform’]; return akw_doArticles_da($atts); } $atts[‘form’] = $atts[‘archiveform’]; return ‘<div id=“archive-list”>’.akw_doArchiveArticles($atts).’</div>’; }

// ——————————————————————————————————————-
// Outputs list of articles grouped by year & month… useful for archive pages… killed body query
// MOD to accept date format

function akw_doArchiveArticles($atts)
{ global $pretext,$prefs,$txpcfg,$timeoffset; extract($pretext); if (is_array($atts)) extract($atts);

$form = (empty($form)) ? ‘default’ : $form; $limit = (empty($limit)) ? 10 : $limit; $count = (!$count) ? 0 : $count; // deprecated in g1.17 // LEX: format tags $headwrapclass = ($headwrapclass) ? ‘ class=”’.$headwrapclass.’”’ : ‘’; $wraptag = ($headwrap) ? ‘<’.$headwrap.$headwrapclass.’>’ : ‘’; $endwrap = ($headwrap) ? ‘</’.$headwrap.’>’ : ‘’; $daywrapclass = ($daywrapclass) ? ‘class=”’.$daywrapclass.’”’ : ‘’; $dayitemclass = ($dayitemclass) ? ‘class=”’.$dayitemclass.’”’ : ‘’; $postwrapclass = ($postwrapclass) ? ‘class=”’.$postwrapclass.’”’ : ‘’; $yearprefix = ($yearprefix) ? $yearprefix.’ ‘ : ‘’; $monthprefix = ($monthprefix) ? $monthprefix.’ ‘ : ‘’; $dayprefix = ($dayprefix) ? $dayprefix.’ ‘ : ‘’; $fromsection = ($fromsection) ? $fromsection : $s; $hidedays = ($hidedays) ? true : false; if($q) { include_once txpath.’/publish/search.php’; return hed(gTxt(‘search_results’),2).search($q); } // might be a form preview, otherwise grab it from the db $Form = (isset($_POST[‘Form’])) ? gps(‘Form’) : fetch(‘Form’,‘txp_form’,‘name’,$form); $date = akw_convert_date(); $q1a = “select ID, AuthorID, Title, url_title, Excerpt, Category1, Category2, Section, Keywords, Image, Annotate, AnnotateInvite, unix_timestamp(Posted) as uPosted “; $q1b = “select count(*) “; $query = array( “from “.PFX.“textpattern where status = 4”, ($s == ‘default’) // are we on the front page? ? filterFrontPage() : ‘’, ($fromsection && $fromsection!=‘default’) // section browse? ? “and section = ‘”.doSlash($fromsection).”’” : ‘’, ($c) // category browse? ? “and ((Category1=’”.doSlash($c).”’) or (Category2=’”.doSlash($c).”’))” : ‘’, (strlen($date)==4) // LEX: year browse? ? “and DATE_FORMAT(Posted,’%Y’) = ‘$date’” : ‘’, (strlen($date)==7) // LEX: year month browse? ? “and DATE_FORMAT(Posted,’%Y %m’) = ‘$date’” : ‘’, (strlen($date)==10) // LEX: year month day browse? ? “and DATE_FORMAT(Posted,’%Y %m %d’) = ‘$date’” : ‘’ ); $q2b = “ and Posted < now()”; $total = getThing($q1b . join(’ ‘,$query) . $q2b); // LEX: fixed bug in paging logic where empty category brings up paging links $numPages = ($total > 0) ? ceil($total/$limit) : 1; $pg = (!$pg) ? 1 : $pg; $offset = ($pg – 1) * $limit; $q2a = “ and Posted < now() order by posted desc limit $offset,$limit”; // send paging info to txp:newer and txp:older $pageout[‘pg’] = $pg; $pageout[‘numPages’] = $numPages; $pageout[‘s’] = $fromsection; $pageout[‘c’] = $c; $GLOBALS[‘thispage’] = $pageout; $GLOBALS[‘is_article_list’] = true; $rs = getRows($q1a . join(’ ‘,$query) . $q2a); if ($rs) { foreach($rs as $a) { extract($a); $com_count = safe_count(‘txp_discuss’,“parentid=$ID and visible=1”); $author = fetch(‘RealName’,‘txp_users’,‘name’,$AuthorID); $author = (!$author) ? $AuthorID : $author; $out[‘thisid’] = $ID; $out[‘posted’] = $uPosted; $out[‘if_comments’] = ($Annotate or $com_count) ? true : false; if ($Annotate or $com_count) { $out[‘comments_invite’] = (function_exists(‘akw_formatCommentsInvite_durl’)) ? akw_formatCommentsInvite_durl($AnnotateInvite,$Section,$ID,$uPosted) //LEX: detailed url : formatCommentsInvite($AnnotateInvite,$Section,$ID); } else $out[‘comments_invite’] = ‘’; $out[‘comments_count’] = $com_count; $out[‘mentions_link’] = (function_exists(‘akw_formatMentionsLink_durl’)) ? akw_formatMentionsLink_durl($Section, $ID, $uPosted) //LEX: detailed url : formatMentionsLink($Section, $ID); $out[‘author’] = $author; $out[‘permlink’] = (function_exists(‘akw_formatPermLink_durl’)) ? akw_formatPermLink_durl($ID,$Section,$uPosted) //LEX: detailed url : formatPermLink($ID,$Section);
  1. $out[‘body’] = parse($Body_html); $out[‘excerpt’] = $Excerpt; $out[‘title’] = $Title; $out[‘url_title’] = $url_title; $out[‘category1’] = $Category1; $out[‘category2’] = $Category2; $out[‘section’] = $Section; $out[‘keywords’] = $Keywords; $out[‘article_image’] = $Image;
$GLOBALS[‘thisarticle’] = $out; // define the article form $article = ($override_form) ? fetch(‘Form’,‘txp_form’,‘name’,$override_form) : $Form; // LEX: if we have a new month append month header to beginning of article $thisday = date(‘jS’, $uPosted + $timeoffset); $thismonthyear = date(‘F Y’, $uPosted + $timeoffset); if ($lastmonthyear != $thismonthyear) { // close open tags – post-list, day-item, day-list if ($hidedays) { $out = ($init) ? “</ul>\n” : ‘’; } else { $out = ($init) ? “</ul>\n</li>\n</ul>\n” : ‘’; } // open new tags – day-list, day-item, post-list $out .= akw_month_label($thismonthyear,$wraptag,$endwrap,$yearprefix,$monthprefix,$fromsection); if (!$hidedays) { $out .= “\n<ul $daywrapclass>\n<li $dayitemclass>”.akw_day_label($uPosted + $timeoffset,$thisday,$dayprefix,$fromsection); } $out .= “\n<ul $postwrapclass>\n”; // attach article $article = $out.$article; $init = 1; } elseif (($thisday != $lastday) && !$hidedays) { // close open tags – post-list, day-item $out = “</ul>\n</li>\n”; // open new tags – day-item, post-list $out .= “<li $dayitemclass>”.akw_day_label($uPosted + $timeoffset,$thisday,$dayprefix,$fromsection).”\n<ul $postwrapclass>\n”; // attach article $article = $out.$article; } $lastmonthyear = $thismonthyear; $lastday = $thisday; $out = ‘’; // quick check for things not pulled from the db $article = (function_exists(‘akw_doPermlink_durl’)) // LEX: detailed url ? akw_doPermlink_durl($article, $out[‘permlink’], $Title, $url_title) : doPermlink($article, $out[‘permlink’], $Title, $url_title); $articles[] = parse($article); // sending these to paging_link(); deprecated in g1.17 $GLOBALS[‘uPosted’] = $uPosted; $GLOBALS[‘limit’] = $limit; // unset($GLOBALS[‘thisarticle’]); } return join(‘’,$articles).”</ul>\n</li>\n</ul>”; } }

// ——————————————————————————————-
function akw_rel_link($atts, $thing) // LEX: Outputs relative link rather than permalink (MOD for url_mode)
{ global $thisarticle,$c,$pfr,$id;

$d = gps(‘d’); $m = gps(‘m’); $thing = (isset($thing)) ? parse($thing) : ‘’; if (is_array($atts)) extract($atts); $class = ($class) ? ‘ class=”’.$class.’”’ : ‘’; $Title = ($thisarticle[‘url_title’]) ? $thisarticle[‘url_title’] : stripSpace($thisarticle[‘title’]); $linktitle = ($id OR $m OR $d) ? ‘’ : ‘ title=”’.strip_tags(substr($thisarticle[‘excerpt’],0,100)).’”’; // improve substr if ($c) { $date = getdate($thisarticle[‘posted’]); extract($date); $mon = (strlen($mon) 1) ? '0'.$mon : $mon; $mday = (strlen($mday) 1) ? ‘0’.$mday : $mday; $relink = ‘<a href=”’.$pfr.$thisarticle[‘section’].’/’.$c.’/’.$year.’/’.$mon.’/’.$mday.’/’ .$thisarticle[‘thisid’].’/’.$Title.’”’.$linktitle.$class.’>’.$thing.’</a>’; } else { $relink = ‘<a href=”’.$thisarticle[‘permlink’].$Title.’”’.$linktitle.$class.’>’.$thing.’</a>’; } return $relink; }

// ——————————————————————————————
// Adds month label to archive entries

function akw_month_label($thismonthyear,$wraptag,$endwrap,$ytitle,$mtitle,$fromsection)
{ global $pfr,$s,$c;

$monthyear = explode(’ ‘, $thismonthyear); $url_mon = date(‘m’,strtotime(‘1 ‘.$thismonthyear)); $mtitle = $mtitle.$thismonthyear; $ytitle = $ytitle.$monthyear1; $out = $wraptag.akw_formatMonthHref($monthyear0,$mtitle,$fromsection,$c,$monthyear1,$url_mon).’ ‘.akw_formatYearHref($monthyear1,$ytitle,$fromsection,$c,$monthyear1).$endwrap; return $out; }

// ——————————————————————————————
// Adds day label to archive entries

function akw_day_label($uPosted,$thisday,$dtitle,$fromsection)
{ global $pfr,$s,$c;

$label = $thisday; $title = date(‘F jS Y’,$uPosted); $date_array = getdate($uPosted); extract($date_array); $url_mon = (strlen($mon) 1) ? '0'.$mon : $mon; $url_mday = (strlen($mday) 1) ? ‘0’.$mday : $mday; $title = $dtitle.$title; $out = $wraptag.akw_formatDayHref($label,$title,$fromsection,$c,$year,$url_mon,$url_mday).$endwrap; return $out; } </pre>

Next, I created a section called “archive” with a corresponding page. On that page I have the following tag, located where I want the archive display to show up (the page is basically the same as my “default” page, but with the tag below instead of the <code><txp:article /></code> tag):

<pre><txp:akw_archive limit=“5000” form=“archivelinks” archiveform=“archivelinks” hidedays=“yes” headwrap=“h3” fromsection=“article” /></pre>

Next, I created a form called “archivelinks” with a type of “article”, which looks like this:

<pre><li><txp:zem_link><txp:title /></txp:zem_link>
<br />
<txp:cnj_if_excerpt>
<div class=“excerpt”>
<strong>Excerpt</strong>:<br />
<txp:excerpt />
</div>
</txp:cnj_if_excerpt>
</li></pre>

Note, I had to install the plugin zem_link to get permlinks to work and cnj_if_excerpt to test for article excerpts.. Search the plugins forum for these plugins.

Do all of the above and you will have an archive page that looks something like this

Last edited by botono9 (2004-10-02 20:58:37)


The future is… now!

Offline

#90 2004-10-05 05:11:06

doogxela
Member
Registered: 2004-07-29
Posts: 14
Website

Re: Browsing by date plugin

botono9, could you post a link to a text file with the code or something? Textile seems to have messed with it.

Offline

#91 2004-10-27 05:11:23

arakune
Member
Registered: 2004-10-23
Posts: 13

Re: Browsing by date plugin

I must be three kinds of idiots today, because I’m really not getting this.

I’ve been playing with the date_aware and archive plugins, trying to figure out how this all fits together. I think I’ve got a handle on the date_aware plugin. I’m currently using it to create links to daily archive pages, by wrapping the following around <code><txp:posted /></code> inside an article:

<code>
<a nicetitle=“View posts for this day” href=’/index.php?y=<txp:posted format=“Y” />&m=<txp:posted format=“m” />&d=<txp:posted format=“j” />’>
</code>

There may be an easier way to do it, but it works for me, and generally makes things very happy :) Thanks so much for this plugin!

I’m getting stumped on creating an archive page, though. I see where you say to use something like

<code>
<txp:archive limit=“1000” lowform=“entry_list” medform=“entry_excerpt” form=“entry_full” headwrap=“h3” daywrapclass=“day-list” dayitemclass=“day” postwrapclass=“post-list” />
</code>

in your page body, which is fine. But obviously, I don’t want to be doing this on my default page. I’d want to create a new “page” for the archive (perhaps even use the “archive” page that’s already there).

But then, how do I link to that archive page from my default page. I have other plugins, which display site nav links in my sidebar (category lists, recent posts, etc.), and they all pull up the default page template. Likewise, permalinks use the default page template….. I presume the archive template exists for just this sort of thing, but see no way of calling it explicitly.

I realize that this is probably more of an TXP question that a plugin question :( but since I’m running into while trying to use the archives plugin, I’m hoping somebody here won’t mind taking a minute to shed some light ;)

Offline

#92 2004-11-03 20:16:07

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

Re: Browsing by date plugin

i did read over the four pages of this thread…
i seem to just not understand…

how do i make the posted dates in an article be linkable to their separate dates?

e.g.:

<a href=“http://thiswouldlinkto_2003-10entries”>October</a> <a href=“http://thiswouldlinkto_2003-10-05entries”>5</a>, <a href=“http://thiswouldlinkto_2003entries”>2003</a>
Article body goes here blah blah

i did look at the plugin description where it’s installed, but it’s actually not clear there even that you have to replace txp:article with txp:akw_article_date_aware…

all that said, this is a very useful plugin for a very extremely terribly useful feature that i’d really like to be using throughout my site! thank you


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

Offline

#93 2004-11-03 20:39:17

tinyfly
Member
From: Dallas, Texas
Registered: 2004-05-10
Posts: 462
Website

Re: Browsing by date plugin

I assume that since the author of this plugin hasn’t posted here since July, despite there being numerous questions about its use, that development on this plugin is effectively dead.

I would like to implore that somebody with better php skills than myself pick up the ball on this plugin and explain how to use it in a clear and concise manner. In non-programming speak.

Offline

#94 2004-11-03 21:49:03

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: Browsing by date plugin

I myself admit to someone who never quite ever figured this one out. What sort of behavior do people actually want? Something like:
<code><txp:xxx_article_list_by_date month="10" year="2004" form="yyyy" /></code>
And have it spit out all the articles for that month? (And likewise for year, and perhaps day?)

Offline

#95 2004-11-04 00:28:53

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

Re: Browsing by date plugin

Remillard,
yes, that would be very nice also… the archive list that can be broken out/selected via year/month/day is a very cool thing indeed.

you know what else would be cool? having the date on an article be broken out into linkable month-day-year, so that someone can come across that article either randomly from a list of categories or its particular section, and say “hmm.. interesting article. i wonder what else was written that day/month/year” and easily click on that piece of the date accordingly.

:) that would be cool.

but i will very patiently wait for the day.


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

Offline

#96 2004-11-04 18:04:07

thekolonel
Archived Plugin Author
From: NYC
Registered: 2004-03-01
Posts: 28
Website

Re: Browsing by date plugin

Don’t worry… development isn’t dead. I was waiting on the release candidate before finishing the plugin work. I will start a new thread inclusive of this, the archive plugin, and any future date-related plugs. Bear with me, as I have some site-related work to do before I’m ready to update the public plugins.

Offline

Board footer

Powered by FluxBB