Recent Changes - Search:




Summary: Calendar designed for PmWiki where each day is a separate wiki page.
Version: 1.0rc12
Status: Stable
Prerequisites: pmwiki-2.0
Maintainer: ccox
License: GPL2+
Categories: PIM Calendar

Users: +6

Discussion: PmCalendar-Talk


A web based calendar which uses PmWiki markup for display.


pmcal.phpΔ - Adds a large Calendar that is designed to work with PmWiki. It's possible it could be ported to other wikis.
PmCal.cssΔ - Sample css theme showing how easy it is to customize the look and feel (rename to match the Group where your PmCalendar resides and move it to the pub/css/ directory).
PmCal-Red.cssΔ - Red style theme.
PmCal-Blog.cssΔ - For a blog text view.
PmCal-Mini.cssΔ - For tiny calendars... see Cjc example.

The following is a version which is fixed for PHP 5.3 and PHP 5.5. KathrynAndersen June 24, 2015, at 10:04 PM


Click here to see a live example at PmCal.
Exemple de calendrier perpétuel en français (by sfley)! (deadlink)


Place pmcal.php (this file) into your cookbook directory (e.g. /srv/www/htdocs/pmwiki/cookbook)

Include the cookbook in your local/config.php


Create a new Group called, for example, PmCal. You will need something on the default page of the group, let's say just

 ! This is My Calendar 

Or... you could just have comment on the page. Just as long as a default page exists. For example: (:comment placeholder:), as used on Holidays?action=source

Create a GroupFooter page in that Group with just


Upload the desired CSS file (see above). Rename it to match the Group where your PmCalendar resides (PmCal.css) and move it to the pub/css/ directory.

The entries on the individual days are shown on the calendar but it defaults to show the first paragraph using (:include YYYYMMDD paras=1:)

This will allow you to create a table of contents of sorts... not the (:toc:) recipe though.



0.2: Went ahead and renamed Day pages to just YYYYMMDD to be compatible with Wikilog in case you just want to use PmCalendar instead.
0.3: Pass month/day/year get vars to day pages.
0.4: Fix bad date logic when figuring up day of week names.
0.5: Commented out style attributes on cells to allow better CSS customization... likewise you can uncomment them if you like it the way it was. Added table border=1 so it doesn't look horrible without a css file.
Added a Today link in case you get lost.
0.6: Mostly CSS related. Changed cjccaldaytitle to cjccaldayofweektitle and change added alternate prefix pmcal (I didn't intend to release this with cjcal intact). PmCal.css makes a bit more sense... I'm not a CSS expert. Defaults are now smaller and PmCal.css is also reduced to look better on smaller screen sizes.
0.7: Added the ability to include other calendars into a calendar.
Added the ability parse arguments to (:pmcal var=...:):
     day=1..number of days in month
          Where Calendar1.Calendar1 is a page with (:pmcal:) on it somehow
          (e.g. in the Calendar1.GroupFooter)
Made better comments in PmCal.css.
Could have lots of includes if you use cals= Not sure how to handle this...
     $MaxIncludes = 500;
Set this in your local config.php for now.
Better comments in code.
0.8: Lots of code changes. Added caltype, monthsahead, monthsback.
     caltype=[normal|text] (defaults to normal)
     monthsahead=0..60 (can show as many as 5 years more months ahead)
     monthsback=0..60 (can show as many as 5 years more months back)
The GroupFooter for your PmCalendar Group page can now contain:
     [[PmCal?monthsahead=1&monthsback=1&caltype=text|Event Diary]]
     (:pmcal cals=Holidays,Cjc:)
0.9: Code cleanup. Some minor formatting changes. Stylized inclusions just not possible without nested divs. PmCal.css is now more MSIE friendly. $MaxIncludes now increments for you.
0.10: Hah! ...I know, it looks like 0.1. You'd think I'd learn how to do versioning. Force a new block for day text. This means that the space beside the day number in the default skin won't have anything. But also may make blocking the daynumber easier. Big features is locales, use locale= and optionally set isodate='true' if you want to force ISO date format. If test='css', then you can set styles=PmCal,Other where,... where PmCal and Other are examples of CSS file names. Firefox users can use View->Page Style to switch. There is now a pmcaltodaynumber.
The page name of the form YYYYMMDD is now used as the default date for any (:pmwiki:) markup on the page, otherwise it still defaults to "today".
0.11: Won't set locale by default.. my mistake (duh). Fixed a syntax problem preventing uploadable themes from working (I think). Most everything on the url line remembered and used for other links (illusion of state?).
0.12: Added a week start offset. Normally a week starts with day zero, which is Sunday. A weekstart=1 implies your week starts with Monday. Fixed a MAJOR problem with caltype=text where the days were hard coded to 1. Fixed references to cals= calendars to not specify a page name (let pmwiki find it). I recommend that everyone upgrade.
0.13: Added pmcalzebra div to text display.
0.14: 2 new features (sorry). The one that was truly necessary is the ability to reverse the calendars. Making it display the most recent day/month first. Set that with reverse=true. For example, you might want to use the calendar to create a diary (or perhaps blog) in which you want the most recent items first. The second feature is the ability to disable variable settings made on the url line. Set overrides=false in the :pmcal: markup itself. One major bug fix with regards to how monthtitles were processed, the array of names is filled in... but since it's now populated with strftime values, the monthtitles are supposed to be more dynamic, always needs to be recalculated. Had a type where monthsahead (missing the s) was not being passed on the url line. Alot of code changes were needed to support the reverse feature. I hope this is the last major delta before 1.0.
1.0rc1: Removed all cjccal ids for css use, use pmcal ones. Fixed ampersands to use correct & inside of URL links (should pass w3c check). Added a textlinks boolean to control the textlinks when caltype=text is used. Even though you could control their visibility with css, recipes like pagetoc could still see them.
1.0rc2: Changed misspelled directive type to <include instead. Added support for anniversary recurring data via year=ACAL. Also included acals= parameter to specify anniversary data to include from a PmCalendar with anniversary data. Also added callinks= to be able to turn off the links at the top of the calendar for Today and any included calendars via cals=.
1.0rc3: Added calfmt and textcalfmt to control the text displayed as a heading for and included calendar entry. Added expire flag. Set this and entries before today's date are not shown in caltype=text display.
1.0rc4: Fixed bug in included calendar when it's an anniversay calendar. Added option for expire to be a delta of days, positive or negative, to expire from today's date.
1.0rc5: Overloaded textlinks= to allow the value nolinks. This includes the text for the dates listed without making them links to the page data when caltype=text.
1.0rc6: Added lines= and paras=. All includes default to paras=1. Remember if you use lines= that lines have to have a carriage return. Added my own pmcalcreatetextlink class. Current version of PmWiki 2.1.beta26, changes behavior of links to where links with parameters are always "true" links.
1.0rc7: Added stopafter=. Similar to expire=, except this controls display of caltype=text entries after delta days offset from today.
1.0rc8: Added alwaystoday=. Ensures that it is always today. Useful for having a This Week's Events text diary on the same page with a normal calendar. Also added onedate=. This will prevent using multiple date textlinks when several caltype=text calendar entries are being displayed for a given day. May want to set textcalfmt=''. In addition the variables $PmCalTextLinkMark, $PmCalIncludeTextLinkMark, $PmCalACALTextLinkMark now exist that can be set by the local admin to control the PmWiki markup used for textlinks (they all default to !!).
1.0rc9: Added onedate=showcals and added $PmCalSubIncludeTextLinkMark and $PmCalSubACALTextLinkMark for the markups associated with entries on the same day using onedate=showcals that are not the primary (first one) entry. Also added acalfmt and textacalfmt for consistency. Hopefully fixed the mktime bug for php 5.1 (not tested).
1.0rc10: Fixed a bug in the computing monthtitle. If a month only has 30 days in it and you say it has 31 days, printing a formatted month will show the next month. Changed the code to use '1' instead of the current day.
1.0rc11: Added extra today classes for included calendars.
1.0rc12: Fixed issue where you could not set a constant year=ACAL. Now

you can set year=ACAL in the markup or on the URL line and it will stay in the ACAL context when you navigate to next/previous months.

     year=              defaults to today's year (year=ACAL to add dates that can be used with acals=).
     month=             defaults to today's month.
     day=               defaults to today's day.
     acalfmt=           Formatted display of included ACAL calendar name.  Defaults to calfmt (below).
                          Substitutes the calendar name for %s (see also textacalfmt).
     acals=             anniversary date calendars to include (normal calendars with year=ACAL entries).
     alwaystoday=       defaults to false.  If true, they date is always today.  Useful for viewing
                          upcoming events when on a page containing a calendar viewing a different date.
     calfmt=            Formatted display of included calendar name.  Defaults to %s.  Substitutes
                          the calendar name for %s (see also textcalfmt).
     callinks=          defaults to true, includes links to Today and included calendars via cals=
     cals=              calendars to include: Holidays,Cjc,...
     caltype=           normal (default) or text.
     dayofweektitlefmt= default to %a (processed with strftime).
     dayofweektitle=    hardcode your own days of the week array (processed with strftime):
     expire=            defaults to false, when set, do not display entries before today. Can also
                          be an integer delta number of days from today.
     includes=          Do includes, default is true.
     isodate=           YYYY-MM-DD, defaults is false (obsolete, textdatefmt=%Y-%m-%d).
     lines=             Set to an integer value for number of lines to include from a given
                        day in a display.  This overrides paras below.
     locale=            A system valid LC_TIME locale.
     monthsback=        Can display as many as 5 years of months back (60 months)
                          (might kill your browser though)
     monthsahead=       Can display as many as 5 years of months ahead (60 months)
                          (might kill your browser though)
     monthtitlefmt=     defaults to %B %Y (processed with strftime).
     monthtitle=        hardcode your own month names (processed with strftime):
                           New Year,Lovers Month,Lions Month,Showers Month,
     navnext=           defaults to &raquo; (processed with strftime)
     navprev=           defaults to &laquo; (processed with strftime)
     onedate=           defaults to false.  On caltype=text, if true, don't repeated date entry text links
                           more than once if same date.  If set to showcals, show the calendar of origin
                           for included calendar entries after the first one.
     overrides=         (in markup only) defaults to true.  If false, disallow URL variables.
     paras=             Set to an integer value for number of paragraphs to include from a given
                        day in a display.
     cssprefix=         Create css style/divs with this prefix.  Defaults to pmcal.
     reverse=           months start with the end and go backwards.
     stopafter=         days (positive or negative) from today for which no more entries will
                        be displayed in caltype=text.  If stopafter=5, show entries for the month
                        stopping with entries beyond 5 days from today (see also expire).
     styles=            (experimental) css style selections, first is preferred.
                           e.g. PmCal,PmCal-Red
     textacalfmt=        Analagous to acalfmt, except for caltype=text display.  Defaults to
     textcalfmt=        Analagous to calfmt, except for caltype=text display.  Defaults to
     textdatefmt=       for caltype=text, defaults to %x, used for dates with caltype=text
                           (processed with strftime)
     textlinks=         defaults to true, include a dated link in caltype=text before
                           included entry.  If set to nolinks, same as true, but text
                           displayed will not be links.
     weekstart=         defaults to 0.  With 0=Sunday.  Set to the day of the week in which
                           your week starts.


For 1.0:

  • Just bug fixes until 1.0!! Thanks to everyone for all the help with regards to features and fixes.
  • This recipe was last tested on PmWiki version: pmwiki-2.0.beta.55
  • This recipe requires at least PmWiki version: unknown

See Also




Questions & Comments

Q: How do you create each new appointment?

Click on the number on the day. It is a link. If you have edit rights, you should be able to edit the page. --Ccox

Q: Is there an easy way to edit/delete an item ?

Normal page deletion works. Go to the day page by cliking on the number on that day and use the "delete" string you have setup for your site. By default, "delete" on a page by itself will remove it. --Ccox

Q: Is there a way to see a live demo? A screenshot is fine but obviously not enough. By the way, this is a remark common to many cookbook recipes: authors should be able to provide a sandbox where visitors could get the feel of the new feature ...

There's a live demo at PmCal. --Pm

Q: Is there an easy way to specify anniversaries or repeating events ? Thanks! -rru?

Not at this time. PmCalendar exploits the features of PmWiki. A full scheduler would likely require the ability to create PmWiki content in native (binary) form. I can't consider this feature for 1.0.

Q2: Note by the questioner:
I found this solution suitable for me: For anniversaries I create calendar pages without the year in their names, e.g. pmcal.0125 for Jannuary 25th (simply by specifying their name as URL-Parm, e.g. ...?n=PmCal.0125).

Then I patched pmcal.php:

      for ($i=1; $i<=$totaldays; $i++) {
        $dayindex = $d % 7;
       // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

       if ($caltype == 'normal') { ...


       if ($includes != 'false' && PageExists($pmcalpagename)) {
         $out.=sprintf("\\\\\n\n(:include %s paras=1:)\n",$pmcalpagename);

       // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
       if ($includes != 'false' && PageExists($anniversarypagename)) {
         $out.=sprintf("\\\\\n\n(:include %s paras=1:)\n",$anniversarypagename);
       } ...

Now the content of this anniversary pages gets included every year. A very simple approach, but it works for me ... what do You think of it? rru?

ccox responds: I like that! That's a simple way of dealing with anniversary dates. And it's pretty much inline with PmCalendar philosophy... elegant, simple and stupid (stupid in a good sense).

ccox update: I'm implementing this with a year=ACAL. This means that anniversaries can be stored inside a calendar group. And I'm adding acals=name1,name2,... to allow you to include anniversary information from multiple calendars. Thus you might have for PmCal/PmCal markup like (:pmcal acals=PmCal,Cjc:) which includes the anniversary days inside of PmCal and Cjc into the normal PmCal view.

Great, I'm looking forward to the next release - thanks! rru?

Q: After having installed the recipe pmcal I get the following message:

 Warning: Cannot modify header information - headers already sent by
 (output started at ./cookbook/pmcal.php:755)
 in /Users/pascallambrechts/Sites/pmwiki/pmwiki.php on line 709

at top of each of my wiki pages. Is this a reported bug? Thanks, pascal? October 15, 2005, at 05:45 PM

Are you running the latest version of pmcal.php? I know a problem similar to this was fixed quite some time ago. It's possible that some other recipe is interfering with this as well. Try experimenting with the placement of (:pmcal:). I guess I need more information on this one.
Well... I have reset the installation of the recipe and now it works perfectly. I guess that the other file was corrupted. Thanks! pascal?

Q: I installed the calendar but it appears twice on the same page... Is there anyone that can help me ? Bye.

A: I am guessing that you installed (:pmcal:) into your Group.GroupFooter page? If so, realize that viewing that page will show the calendar twice. Normally, you would view Group.Group or Group.HomePage. Can you give us a URL?

Q2: Thank you for your reply. I can't give you a url because it's a corporate wiki that can't be accessed from outside the company. First i created a group called Calendar. Then i created a page called Calendar.GroupFooter where i put (:pmcal:). I also created a page called Calendar.calendar where i put the same thing. Maybe i should delete one of the two pages ? If so, which one should i keep ? Thank you again. Bye.

A: Personally, I like the calendar to show up on any calendar page, so I'd keep the one in GroupFooter and either put a (:comment something:) in the Group homepage or perhaps a name for the calendar there.

Q: I'd like to use PmCalendar to keep track of the occupation of different offices, say Office 1 (needs its own calendar), Office 2 (also needs its own calendar), etc. But I see that when I make a modification in the calendar of Office 1 it shows also in the calendar of Office 2. In short, is there a way I could make each page have its own calendar? Thank you. Alex.

A: You need to place a (:pmcal:) markup in different groups. On this site, for example, there is the PmCal/PmCal calendar, the Cjc/Cjc calendar and the Holidays/HomePage calendar. The PmCal calendar includes the Cjc and Holidays calendar groups as part of its markup, for example, (:pmcal cals=Holidays,Cjc:). This allow you to have separate calendars and yet have a super calendar that includes the entries from other calendars. PmCalendars are setup by Group, not by page.

Q: Has this capability been implemented yet to where single pages can have their own calendars? This calendar looks phenominal and I would like to implement it on my wiki where people can have their own personal calendars to which they fill in their own information within their wikipage. -Chris 8-25-08

No... not exactly, but you may find somethings work ok. Until I fix things, you can either find the patches somebody else submitted on the talk page... or why not give each user their own group?? Just trying to suggest workarounds for now.

Q: Hello, how to create a calendar like CJC example? Thanks!

A: This is what I have in my Calendar.GroupFooter which gives results similar to the CJC example:

 %lfloat%The main [[Calendar/Calendar]] page.
 (:if false:)
 (:div style='float:right;width:70%;border:4px double #bbbbbb;background-color:darkslateblue':)
 !%center%Upcoming Events
 (:pmcal styles=PmCal-Mini caltype=text monthsahead=2 expire=true zebra=false textdatefmt='%A, %B %d, %Y':)
 (:pmcal styles=PmCal-Mini monthsback=1 monthsahead=2 includes=false:)
--Feral February 10, 2006, at 07:21 PM

Q: After giving long names to two of my calendars, I'm having formatting problems with the names being too long when I include both of those calendars in a third. I can get calfmt=abrrevname to work for one calendar but how would I write my group footer for the third calendar so that the headers of both included calendars are abbreviated?

A: Not really an answer.... I would try to shorten the Group names associated with your calendars. You should be able to move/rename all your data fairly easily for a calendar. The calfmt is just to adjust the formatting of the included calendar name... not really for replacing the name itself on a calendar group by calendar group basis. ccox

Q: 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 to show. Is it possible to have a weeksahead or daysahead variable? Alternatively, and probably less elegant, could monthsahead=.25 for 1 week? (Thanks for "stopafter" -- it works great!) ~Steve

A: This feature added to 1.0rc7, called stopafter which is a delta day offset from today. For example, stopafter=7 would not display entries in caltype=text for entries beyond 7 days from today.

Q: I encounter serious problems with the ACAL feature. I think I don't really understand how to use the year= and acal= and cals= parameters together. I thought I made a good copy of the examples you gave, but it does not seem to work at all... Would you have a look to ?

A: If you are wanting to see anniversary entries, you can pull in the ACAL entries from any Calendar with acals=CalendarName. So for your calendar:

(:pmcal acals=MonCalendrier :)

Should pull in the ACAL entries from MonCalendrier. You see an example at PmCal-Examples, but there I'm pulling in a foreign calendar with cals=... you do not need that unless there is another calendar on your system and you want its entries to show up inside your calendar.

Q: Is there a way to enter events that span over multiple days. For example a vacation calendar. Possible notation could be "PmCal.060820-060828". Is that feasible?

A: Not easily done. Sorry.

Q: I have created a Support.Calendar GroupFooter page with a link to Support.Calender. In that Support.Calender link I have a line (:pmcal styles=PmCal-Mini:) . When I click the Calender in my Group Footer I get the Calender fine, however the Calender Prev / Next month >> point to Support.HomePage (Instead of Support.Calender). I cannot see a parameter to :pmcal that allows me to change the name?

Have I done something silly? New to Wikis so quite possible!.
I took this approach as we would rather have a Calendar per Group linked from the footer.

A: Currently (and this may change), PmCalendar is meant to be inside of a Group.. So you can create an empty Group.HomePage (or Group.Group) with something in it... could be (:comment whatever:)... just as long as there is something in it. Then put the markup (:pmcal:) inside of the Group.GroupHeader or Group.GroupFooter. I have received some patches that will make it work like you want (I think). But I have not implemented them yet. Right now, a PmCalendar wants to reside inside of its own Group. Hope that's enough explanation.

Q: Hi, great cookbook, thx. Just a question. I'd like to use it as in the cjc example. I reused the code provided here, but anyway, whatever is the configuration, I never manage to have the dates displayed. I took a look at the .php and .css and I didn't find any "explanation". The dates are present in the html page but are not displayed. Any idea ? Thank you.

A: Found it. In fact I've been using before the PmCal.css renamed with my Group Name. It looks like it was confusing the script. Deleted it and now it's fine, but it leads me to another question below.

Q: How can I use simultaneously the PmCal and PmCal-Mini in 2 different pages (see previous topic) in regards of the .css renaming problem ? Thank you.

Here is a possible answer. Take a look at PmCal/Mini. If you edit a value or display, the page will revert to the big calendar look though. I just made sure that both css files were in my PmCal group. PmCal lets you specify what css to use and it CAN look in the upload directory.

Q: Hi, we are from Germany. It's a nice program. Is it possible to get an german language-translation file. Or an example "what is do do" to translate it in an other language. Thank you.

You can try locale=de_DE and see if that is sufficient. Depends on the locale support of the server that PmWiki is running on. If that does not work, then you can create your own overrides for month and day of week names. See the GroupFooter source for the PmCal group at: GroupFooter?action=source and look at the Pig Latin example.

Q: Hi, is it possible to use this as an event management calendar? So eg. I want to book a laptop out from the pool for four days. Could an 'event' be logged on the calendar that would show for four days? Also, when I tested this I found that I could only make one entry per day. It would be nice to have multiple pages per day. eg the calendar shows times 9.00 9.30 10.00 10.30 etc and clicking on a time allows you to edit a page for that time of day. Maybe I'm asking too much. Thanks

PmCalendar does not directly support events per se. As you have noticed, you can just put multiple entries on a single day. You can use a bulleted list so that only the bulleted items show up on a given day e.g. PmCal/20061205. There is no way to create a single item that repeats for so many days or on certain days... at least not yet.

Works perfect. Yet, in the CSS file there are three unimportant errors. In each case it should read font-weight:bold instead of font-style:bold... Cheers

Q: I love this recipe and am currently trying to implement a calendar patterned after Cjc. I have a slight CSS problem, though, as it seems the calendar CSS is overridden by my standard CSS (specifically, for the <h2> tags and the <a href ...> tags), and my standard CSS is very hard to read when there is a link in a link in an <h2> headline. Is there a way to make the calendar CSS override my standard pmwiki CSS here? Or do I have to create a separate CSS for the calendar group? --Henning February 16, 2007, at 01:20 PM

Right now, css styles are searched for in the pub/css directory as well as the download directory associated with the Group context the calendar resides in. This may answer this question somewhat as well (?).

Thanks for the explanation! I couldn't quite figure out the CSS requirements, and finally "solved" it by hard-coding the headline to a lower hierarchical level. (My headlines are set up somewhat unusually for historical reasons :-) --Henning March 19, 2007, at 08:47 AM

Q: Does something need to be changed in the css file paths to load the style sheets across a Wiki Farm? Francis

Right now, css styles are searched for in the pub/css directory as well as the download directory associated with the Group context the calendar resides in.

Ah yes, I see now that Cookbook:SharedPages#css also answers this. Thanks, Francis

Q: I get to each day page the eg "20070325" title, with really I hate it, more even beacuse I speak spanish, where/how should I change in order to get somethihg to "25-03-07"? Thanks in advance!

The YYYYMMDD format is ISO standard (really... it is!). So... the ACTUAL page name cannot be changed. HOWEVER, it is possible to change the displayed title for the page. Consider adding to your GroupFooter or GroupHeader:

 (:title {$PmCalDName:Calendar %d-%m-%y}:)

Q: Regarding the same topic as above: Could you post please more of the "%d,%m,etc.-Variables".
More explicitly: I would like a title such as "Freitag, 14. April 2008", using the "monthtitle=" and "dayofweek=" I provided.
Thanx in Advance (beautiful script though!!)

Should be able to use any of the macros from strftime from PHP. See:

Q: Is there anyway to customize this not run off the system clock, but to allow me to make a calender that contains 5 days in a week and 8 months in a year, each named as I desire to, I would also like to be able to have it run of different time. Reason is, I run a MUD and our time system contains 8 hours in each day, 5 days per week, 20 days per month, and 8 months a year.

Even a limited function calender would be fine, just so I could create dates and events, and have them displayed in the main calender page.?

My initial thought is that this would be VERY difficult to do. Sorry.

Is there a way to display the Cjc calenders sideways - like 3 mini calenders side-by-side across the page? May 2008 - June 2008 - July 2008

Thanks CC

Hi. I noticed that pmcaltodaynumber is missing from PmCal.css and PmCal-mini.css (maybe the others too? i didn't check them...). In fact, it appears it's just a typing error - if you look closely and search for 'table.pmcal span.pmcaldaynumber a.wikilink', you'll see that it's has been duplicated. the 2nd iteration, however, is only different in that it 'bolds' the text. simply change the 2nd iteration to 'table.pmcal span.pmcaltodaynumber a.wikilink', and you'll have control over the link formatting for 'today'...

overtones99 September 04, 2008, at 09:33 AM

The results from the current download for pmcal.php don't seem to match those found on PmCal/PmCal or on Cjc/Cjc -- all of my days are marked as existing days/events, even when they haven't been created yet. Plus, all the empty days are linking to something like Calendar/20080905?year=2008&month=9&day=5, rather than to an edit-page like Calendar/20080905?action=edit. I'm noticing two main problems in the code which I think must've been inadvertently changed or removed by someone:

1. there's no code at all for linking to ?action=edit pages... (though it must be there in the version that PmCal/PmCal is using for it to work)
2. all links are now spitting out as class='wikilink', which is causing all to display as existing events (at least when using PmCal-Mini.css - I haven't checked the others) due to a missing or changed css class definition.

Earlier versions of PmCal must have had code to deal with this, but the current one doesn't. Here are the fixes I came up with. If someone has the original code and finds it much simpler than this, then please let me know/re-integrate it.

Here's the fix for the links in pmcal.php:

	if (!PageExists($pmcalpagename)) {
		// Bizarre hack added due to PmWiki change.
		//$dn=$dn . " ${PmCalPrefix}createtextlink";  // typo? pmcalcreatetextlink & createtextlink don't exist
		$dn=$dn . " createlinktext";  // createlinktext DOES exist in the css files
		$dnlink = "[[$group.%s%02d%02d?action=edit|%s]]";
		$dnlink = sprintf("$dnlink\n",$year,$month,$iday,$iday);
	} else { // LINK FMT IF DAY **DOES** EXIST
		$dnlink = "[[$group.%s%02d%02d?year=%s&amp;month=%s&amp;day=%s%s|%s]]";
		$dnlink = sprintf("$dnlink\n",$year,$month,$iday,$year,$month,$iday,$urladd,$iday);
	$out.=sprintf("(:$ctype class='%s' height=80px :)\n",$cl);

and in PmCal-Mini.css add the following to cause all non-existing day-links to display correctly:

	table.pmcal td.pmcalday span.createlinktext a.wikilink {

	table.pmcal td.pmcaltoday span.createlinktext a.wikilink {

overtones99 September 04, 2008, at 10:25 AM

pmcalincludetodaytextlink's for today not receiving today css

just noticed that css class pmcalincludetodaytextlink is not represented in PmCal-Mini.css (and perhaps in others? i haven't checked). the result is that if nothing is happening today in the main calendar, but an event in an included calendar IS, the format for today's event listing defaults to the normal color scheme of any old day. if you want today's events from included calendars to match the formatting of the main calendar, just amend the following css code with a span.pmcalincludetextlink a, and so forth (note, the example below contains my own formatting, not the default from PmCal-Mini.css, so just pay attention to the first line of each declaration):

	span.pmcalincludetextlink a,   /* <= need to add this line */
	span.pmcaldaytextlink a {
		border-bottom:2px solid #ddbbdd;
		border-top:3px solid #ffffff;

	span.pmcalincludetextlink a:hover,   /* <= need to add this line */
	span.pmcaldaytextlink a:hover {
		border-top:3px solid #ddbbdd;

	span.pmcalincludetodaytextlink a,   /* <= need to add this line */
	span.pmcaltodaytextlink a {
		border-bottom:2px solid #aaddaa;
		border-top:2px solid #ffffff;

	span.pmcalincludetodaytextlink a:hover,   /* <= need to add this line */
	span.pmcaltodaytextlink a:hover {
		border-top:2px solid #aaddaa;

overtones99 September 04, 2008, at 08:13 PM

Use calendars on any page of a group
If you insert the :pmcal: markup on a normal page (lets say $Group.somepage) the calendar ist displayed there. If you then click on a month or on the forward / backward buttons you will be redirected to the default page of the group ($DefaultName).

This happens, because the link, wich is produced by the pmcal.php script ommits the name of the page (here somepage).

I think this is faulty, so I changed the following lines in pmcal.php, so the behavior is corrected:

Basically I added .$name to each of the red lines below.

// It's necessary to force a line break before the (:pmcal:) output.
if ($callinks != 'false' && $caltype == 'normal') {
// Output Today link

$out.="[[$group.$name?year=$PmCaltyear&amp;month=$PmCaltmonth&amp;day=$PmCaltday$urladd|"; //changed line
$out.="[[$group?year=$PmCaltyear&amp;month=$PmCaltmonth&amp;day=$PmCaltday$urladd|"; //original line


// Large one liner broken up into multiple appends
$out.="%class='${PmCalPrefix}navlinks ${PmCalPrefix}navlinksprev'%";

$out.="[[$group.$name?month=$prevmonth&amp;day=1&amp;year=$prevyear$urladd|$navprevout]] %%"; //changed
$out.="[[$group?month=$prevmonth&amp;day=1&amp;year=$prevyear$urladd|$navprevout]] %%"; //original
$out.="%class='${PmCalPrefix}navlinks ${PmCalPrefix}navlinksnext'%";
$out.=" [[$group.$name?month=$nextmonth&amp;day=1&amp;year=$nextyear$urladd|$navnextout]]%%\n"; //changed
$out.=" [[$group?month=$nextmonth&amp;day=1&amp;year=$nextyear$urladd|$navnextout]]%%\n"; //original

Markus Schoenen? November 25, 2008, at 08:45 AM

Q: How can I see the text of the entry in the calendarviw itself and how can I get the boxes bigger like in you PmCal-Sample? (I stored your sample PmCall.css.)
I use for displaying my calendar:
(:pmcal cal=InstiKal styles=PmCal monthsahead=1 monthsback=0 includes=false:)

Q: Hi, the "Annual Events" do not work on my calendar. I have the latest version and I can see/edit PmCal?year=ACAL&acals= but it does not affect the normal calendar.
Robert Wanz? August 07, 2009, at 12:07

A: In order for your Annual Events calendar to show up in your main calendar, the main calendar must reference it (:pmcal acals=AnnualEvents .... While it is possible to have your annual events stored as part of the main calendar (:pmcal acals=PmCal ..., I think it usually makes more sense to have them as a separate calendar.

If a calendar entry is larger than the calendar cell it continues on multiple lines. Good. But could be the line spacing be reduced? I tried every CSS trick I know (that is, very few of them), I can change everything except line spacing... Can you help me? Otherwise it is exactly what I need.
Mario Valle? October 22, 2009


Adding the following lines to local/css/local.css partially solved the problem. Now the problem is the spacing between the month number and the text.

td.pmcalday p { line-height: 1.2em; }
td.pmcalday p span.pmcaldaynumber { line-height: 120%; }
td.pmcaltoday p { line-height: 1.2em; }
td.pmcaltoday p span.pmcaldaynumber { line-height: 120%; }

I'd like to implement pmcal into a normal group, where dates and other pages coexists side by side, but I dont want to setup the groupfooter as usual in a cal-group. Is there a way to refer - while creating dates - to a pagetemplate. Lets say:

[[20100213?action=edit&template=NewDate|13]], where NewDate is located local in group and contains sth like


where the pmcal-command holds all the configurations of includes etc. Keep in mind, if I don't include the pmcal-statement, the cal vanishes by clicking just at the date and it's hard to navigate.

At the other hand, one can include a small cal into the sidebar, right?

Is it possible to change the background color only for Saturdays and Sundays via CSS? I think it would be helpful if Sundays or Saturdays and Sundays have a different color as the normal working days.

I've replaced on pmcal.php following line


with these lines

        if($dayindex == 0) {
        } elseif($dayindex == 6) {
        } else {

and add to the CSS following:

        td.pmcalsunday { ... }
        td.pmcalsatruday { ... }

And it works on my side very well ...

Anyone know how to make the three mini-calendars show up side-by-side instead of stacked vertically?
-- Dave February 08, 2013, at 10:47 AM

Category: Calendar

User notes +6: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on August 12, 2015, at 02:34 PM