[pmwiki-users] Calendar / Event list

Thomas Lederer celok at gmx.net
Fri Mar 31 10:58:01 CST 2006


Well, what can i say... thank you. that is about 98% of what i wanted.
Great piece of code.

For the remaining 2%: Is there an option to exclude lines from being
included?

>> ||[[#t20060419]]19.04.2006 ||15.00 || Teatime     ||
>> ||[[#t200605]]|| || ||
>> ||[[#t20060511]]11.05.2006 ||20.00 || Party-Time  ||
>> ||[[#t20060519]]19.05.2006 ||15.00 || Teatime     ||
>> ||[[#t200605]]|| || ||

For the empty (second) line should not be displayed. I tried
%display=none%, but then still an empty line remains.

I changed http://www.pmwiki.org/wiki/Test/NextEventAnchor to reflect this.

"No" for an answer (for a _simple_ solution) is totally ok with me...
just wanted to ask anyway.

-- 
Tom
Patrick R. Michaud schrieb am 31.03.2006 16:34 Uhr:
> On Fri, Mar 31, 2006 at 12:53:03PM +0200, Thomas Lederer wrote:
>> I would like a page (one) to store the events. Having one page per event
>> seems to be huge unnecessary waste.
>>
>> My requirements are: 	date	time	description (less than 10 words)
>>
>> thats basically one line per event.
>>
>> I thought maybe something like this:
>>
>> ||[[#t200604]]|| || ||
>> ||[[#t20060401]]01.04.2006 ||20.00 || Pizzaeating ||
>> ||[[#t20060404]]04.04.2006 ||      || Holiday     ||
>> ||[[#t20060411]]11.04.2006 ||20.00 || Party-Time  ||
>> ||[[#t20060419]]19.04.2006 ||15.00 || Teatime     ||
>> ||[[#t200605]]|| || ||
> 
> Try a special-purpose markup variable.  First, you can see it
> working at http://www.pmwiki.org/wiki/Test/NextEventAnchor .
> 
> The code to enable this is:
> 
>     $FmtPV['$NextEventAnchor'] = 'NextEventAnchor($pn)';
> 
>     function NextEventAnchor($pagename) {
>       global $Now;
>       $npat = '[[:alpha:]][-\\w]*';
>       $page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT);
>     
>       $todayanchor = strftime('#t%Y%m%d', $Now);
>       if ($page
>           && preg_match_all("/\\[\\[(#$npat)\\]\\]/", $page['text'], $alist)) {
>         foreach($alist[1] as $a)
>           if ($a >= $todayanchor) { return "$pagename$a"; }
>       }
>       return "$pagename#noevent";
>     }
> 
> What this does is define a special purpose markup variable called
> "{$NextEventAnchor}" that returns the first anchor of the page that 
> comes on or after todays date (where anchors are formatted as 
> "#tyyyymmdd").  Thus, if the "Events" page contains:
> 
>     ||[[#t20060330]]03.30.2006 ||08.00 || Lunch       ||
>     ||April 2006 ||||||
>     ||[[#t20060401]]01.04.2006 ||20.00 || Pizzaeating ||
>     ||[[#t20060404]]04.04.2006 ||      || Holiday     ||
>     ||[[#t20060411]]11.04.2006 ||20.00 || Party-Time  ||
>     ||[[#t20060419]]19.04.2006 ||15.00 || Teatime     ||
>     ||May 2006 ||||||
> 
> then {Events$NextEventAnchor} will return "Events#t20060401"
> until April 1st, starting April 2nd it will return "Events#t20060404",
> starting April 5th it will return "Events#t20060411", etc.
> 
> This page variable can then be used with (:include:), thus:
> 
>   - display the next event
> 
>         (:include {Events$NextEventAnchor}:) 
> 
>   - display the next three events
> 
>         (:include {Events$NextEventAnchor}# lines=3:) 
> 
> 
> Pm
> 
> 




More information about the pmwiki-users mailing list