[pmwiki-users] Event-calendar with pagelist and ftime? (repost)

Patrick R. Michaud pmichaud at pobox.com
Tue Nov 13 13:44:58 CST 2007


On Tue, Nov 13, 2007 at 08:21:19PM +0100, Audun Myhra Bergwitz wrote:
> >>And how do I make a pagelist showing for instance what's happening this
> >>week?
> >
> >How are you wanting to define "this week"?  Do you want it to mean
> >"events happening in the next seven days", or "events happening in
> >the same week (Mon-Sun) as today"?
>
> I want "this week" to mean "events happening in the same week (Mon-Sun) 
> as today".

Excellent.  Assuming that your page names contain calendar dates,
as in Group.2007-11-13 or Group.20071113, then you can do this by 
defining a {$NameISOWeek} page variable in config.php with:

  $FmtPV['$NameISOWeek'] =
    "strftime('%GW%V', array_shift(DRange(\$name)))";

This causes {$NameISOWeek} to return the ISO week specification
for a given page name.  Then one can list all of the pages in
the current week by using:

   (:pagelist $NameISOWeek={(ftime %GW%V)} :)

If you need a version that takes dates from a page text variable
instead of a pagename, we can do that also with a bit more
code.

Pm



More information about the pmwiki-users mailing list