Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#76 2004-08-09 21:45:52

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

Re: Browsing by date plugin

schussat: the akw_archive tag is only going to pull posts from the section in which it is being called, so unless you have posts in your Archive section, you won’t see anything.


The future is… now!

Offline

#77 2004-08-10 02:41:15

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

Re: Browsing by date plugin

He’s trying to fool the section context.

Offline

#78 2004-08-10 02:48:49

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Browsing by date plugin

> Remillard wrote:

> He’s trying to fool the section context.

Yep, and while it appears that I’m fooling the section, I’m still gettiing no love from akw_archive. I doublechecked that the tag was properly closed with />. I’ll keep tinkering with it, but I think for now I’ll just have to live without. Thanks for all the suggestions, Remillard.


-Alan

Offline

#79 2004-08-10 03:05:27

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

Re: Browsing by date plugin

for whatever it’s worth, what I was doing for debug was going into the code, on the function that parse() calls (I forget the name now) and doing a
print_r($match);
print_r($pretext);
(and a little formatting for them, so maybe a;
print_r(“\n———————————-\n”);
between them).

And then load the page and read the source. It’ll show you EVERY tag that it tries to parse and what it thinks is going on :).

Remi

Offline

#80 2004-08-10 21:55:12

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

Re: Browsing by date plugin

Is anyone getting permlinks to work? If so, how? Please divulge!


The future is… now!

Offline

#81 2004-08-12 07:53:18

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

Re: Browsing by date plugin

Hello

Thanks for this great plugin.

My blog is in swedish and so i wanted the outputed month to be in swedish aswell to do that i made a little change to the code, here is what i did.

i have only tried this in the function <code>akw_month_list</code> but i should work on the other functions aswell.

in the function <code>akw_month_list</code>

the row that says:

<code>$thismonthyear = date(‘F Y’, $uPosted + $timeoffset);</code>

i changed to:

<code>
$getDate = getdate($uPosted + $timeoffset);
$thismonthyear = akw_get_custom_month($getDate).” “.date(‘Y’, $uPosted + $timeoffset);
</code>

And finaly i added the function

<code>
function akw_get_custom_month($date)
{ $month = array(“Januari”,“Februari”,“Mars”,“April”,“Maj”,“Juni”,“Juli”,“Augusti”,“September”,“Oktober”,“November”,“December”); for($i=1; $i<13; $i++) { if ($date[“mon”]==$i) { return $month[$i-1]; } }
}
</code>

I have a working example up <a href=“http://johan.galaxen.net/arkiv”>here</a> at the bottom of the page.

sorry for my bad english mon :)

Last edited by osei (2004-08-12 08:00:47)


Johan Nilsson

Offline

#82 2004-08-14 18:27:54

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

Re: Browsing by date plugin

Just trying to bump this. How are you guys getting the permlinks to work? I still cannot get my links to the stories to work right. Any help would be greatly appreciated.


The future is… now!

Offline

#83 2004-08-24 02:35:55

CrimsonTeiwaz
New Member
From: Maryland, USA
Registered: 2004-07-26
Posts: 2

Re: Browsing by date plugin

I was just curious if thekolonel or anyone else had found a solution to the slight bug in the plugin that causes some posts to be listed incorrectly on the pages for a single day’s articles?

Basically, I’m just resetting the time of the article posted to something before about 11pm and it seems to work okay, but has anyone figured out how to fix it internally yet?

Oh, and thanks again to botono9, who suggested using the zem_link plugin for problems with the permanent links in forms used with akw_archive. :)


“I know. I know. Permanent psychosis. At least the colors are nice.”
Aeon Flux

Offline

#84 2004-09-27 04:29:19

macsepp
Member
From: Ludwigsburg - Germany
Registered: 2004-09-02
Posts: 19
Website

Re: Browsing by date plugin

Hey guys, i recognized an important bug of the latest version 1.2 (g19)
I’m using 1.0rc1 with both plugins, akw_archive and akw_aware_date, and got my months listed and the entries listed for a specific month.

I describe the problems/bugs I found, and it might help some of you guys having problems with it as well as far as I read from above.

In the beginning I didn’t get the URL params working (surprise!), or at least it seemed so because I had one single Article as an example, in this case with a date of September. Nothing showed up over <code>?s=weblog&y=2004&m=09</code>. Then I entered a second entry and set the date to July, and nothing worked either. Finally by accident I entered some more articles and gave them few more different months and it was working, or at least close to it.

A link like <code>?s=weblog&y=2004&m=09</code> gave me the entries of August not September. So nothing did work because I always tried with a test entry for Sept and July, and it just couldn’t show up something for a month earlier for both! haha…

Finally I noticed that it works fine with Timezone set to 0, and thats the major bug I wanted to mention if not sombody else already did or I’m doing something wrong. I set the timezone to +10 and it showed always a month before.

I would love to get this fixed thekolonel ;) because I love your plugin anyway, it’s cool.


Textpattern loves me, and I love textpattern.

Offline

#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

Board footer

Powered by FluxBB