[pmwiki-users] PMCal Question

Firefly stealth at fireflyuk.net
Tue Apr 4 04:04:35 CDT 2006


I have made a not so elegant but functional
Week ahead code, after many words of inspiration and lots of help from PM
and Hans.

Here I show you. Put this code on the page that wants to show the events.
(it shows the Next 5 Days worth of events) 

%center%Upcoming Events\\
(:if exists Caln.{$Today}:)[[Caln.{$Today}|{$Weekday}]] - (:include
Caln.{$Today} lines=1:)\\(:ifend:)
(:if exists Caln.{$Todaya}:)[[Caln.{$Todaya}|{$Weekdaya}]] - (:include
Caln.{$Todaya} lines=1:)\\(:ifend:)
(:if exists Caln.{$Todayb}:)[[Caln.{$Todayb}|{$Weekdayb}]] - (:include
Caln.{$Todayb} lines=1:)\\(:ifend:)
(:if exists Caln.{$Todayc}:)[[Caln.{$Todayc}|{$Weekdayc}]] - (:include
Caln.{$Todayc} lines=1:)\\(:ifend:)
(:if exists Caln.{$Todayd}:)[[Caln.{$Todayd}|{$Weekdayd}]] - (:include
Caln.{$Todayd} lines=1:)(:ifend:)
%center%[[Caln.Calendar|Add an Event]]

This will show the dates for the next 5 days, if you have them, it also give
a little link to the calendar page but that’s a simple link, if you want it
to show all the time use

%center%Upcoming Events\\
[[Caln.{$Today}|{$Weekday}]] - (:include Caln.{$Today} lines=1:)\\
[[Caln.{$Todaya}|{$Weekdaya}]] - (:include Caln.{$Todaya} lines=1:)\\
[[Caln.{$Todayb}|{$Weekdayb}]] - (:include Caln.{$Todayb} lines=1:)\\
[[Caln.{$Todayc}|{$Weekdayc}]] - (:include Caln.{$Todayc} lines=1:)\\
[[Caln.{$Todayd}|{$Weekdayd}]] - (:include Caln.{$Todayd} lines=1:)
%center%[[Caln.Calendar|Add an Event]]

You also need to add this to your config.

$FmtPV['$Today'] = 'strftime("%Y%m%d", time())';
$FmtPV['$Todaya'] = 'strftime("%Y%m%d", time()+86400)';
$FmtPV['$Todayb'] = 'strftime("%Y%m%d", time()+172800)';
$FmtPV['$Todayc'] = 'strftime("%Y%m%d", time()+259200)';
$FmtPV['$Todayd'] = 'strftime("%Y%m%d", time()+345600)';
$FmtPV['$Weekday'] = 'strftime("%A", time())';
$FmtPV['$Weekdaya'] = 'strftime("%A", time()+86400)';
$FmtPV['$Weekdayb'] = 'strftime("%A", time()+172800)';
$FmtPV['$Weekdayc'] = 'strftime("%A", time()+259200)';
$FmtPV['$Weekdayd'] = 'strftime("%A", time()+345600)';

PM said that on daylight savings you loose and gain an hour that way, and to
do the calculations a bit better use..

    list($sc, $mn, $hr, $dy, $mo, $yr) = localtime();
    
    $tomorrow = strftime('%Y-%m-%d', 
                         mktime($hr, $mn, $sc, $mo, $dy+1, $yr));

    $oneweek = strftime('%Y-%m-%d',
                         mktime($hr, $mn, $sc, $mo, $dy+7, $yr));

    $onemonth = strftime('%Y-%m-%d'
                         mktime($hr, $mn, $sc, $mo+1, $dy, $yr));

but ive not sorted that yet.

This assumes your PMCal page/event names are Caln.yyyymmdd so you should
change the group name to what ever your calendar name is, and if your page
name format isn’t in the same date style, which it should be, chante the
%Y%m%d order till it suite (%Y = 4 digit year eg 2006 %m = 2 digit month eg
04 and %d = 2 digit day eg 04 so %Y%m%d = 200060404)

Hope I explained everything. 

-----Original Message-----
From: pmwiki-users-bounces at pmichaud.com
[mailto:pmwiki-users-bounces at pmichaud.com] On Behalf Of Chris Cox
Sent: 04 April 2006 00:12
To: pmwiki users
Subject: Re: [pmwiki-users] PMCal Question

Steve Rowe wrote:
> I'm a first time poster, so please forgive me if I'm
> not following protocol.
> 
> In the PMCal
> recipe(http://www.pmwiki.org/wiki/Cookbook/PmCalendar),
> I'm using Feral's CJC-like arrangement, but sometimes
> the number of appointments on the right text is too
> long. I'd like just 1 week of appointments in text to
> show. Is it possible to have a weeksahead or daysahead
> variable? Alternatively, and probably less elegant,
> could monthsahead=.25 for 1 week? Have I missed some
> other more obvious way to achieve this?
> 
> My webpage in question is
>
this:(http://www.bethlehemcommunitychurch.com/pmwiki/pmwiki.php?n=Calendar.C
alendar

PmCalendar doesn't support this currently,  I have had other requests
for a week-based view though (so you're not alone... not that it helps
knowing
that).

I'll see what I can do.


_______________________________________________
pmwiki-users mailing list
pmwiki-users at pmichaud.com
http://host.pmichaud.com/mailman/listinfo/pmwiki-users

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/300 - Release Date: 03/04/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/300 - Release Date: 03/04/2006
 





More information about the pmwiki-users mailing list