Summary: small calendar for blogs showing highlighted links to date-named blog pages
Version: 2008-10-02
Prerequisites: pmwiki 2.2.0 (beta)
Status: new
Questions answered by this recipe
Is there a calendar like used on blog sites to show links to archived pages?
Description
This recipe adds a new markup which displays as a small calendar for blogs showing highlighted links to date-named blog pages.
Screenshot of blogcal in main page
Screenshot of blogcal in 'clip' RightBar div in Triad skin 'seagreen' color.
Installation
Download blogcal.phpΔ and copy to cookbook folder, download blogcal.cssΔ, create a folder named blogcal in your pub/ folder, and copy file to it. Add to config.php:
include_once("$FarmD/cookbook/blogcal.php");
Usage
Add markup (:blogcal:) to a wiki page to show a small calendar as a view of the current month. By default any pages in the current group with names of ISO date format YYYY-MM-DD like 2008-07-18 will appear as highlighted links in the calendar.
You can customise the calendar in various ways:
- Setting defaults in config.php prior of including the script.
- Customisation of the markup.
- Customisation of the look by editing the css stylesheet file.
Setting defaults in config.php
-
$BlogCal['weekstart'] = 1; - First day of the week will be Monday. Default is 0: week starts with Sunday.
-
$BlogCal['basename'] = 'PrefixName'; - prefix to ISO-date pagenames of blog group, like PrefixNameYYYY-MM-DD
-
$BlogCal['isobasic'] = 1; - ISO-dates used in page names will be basic, without hyphen, format YYYYMMDD, or basenameYYYYMMDD. Default is with hyphen separator: YYYY-MM-DD.
-
$BlogCal['defaultgroup'] = 'MyBlogGroup'; - blogcal will look in 'MyBlogGroup' instead of the current group to find matching ISO-date pages.
-
$BlogCal['pastonly'] = 1; - No link to a future month will be shown in the calendar caption. Default shows such link.
-
$BlogCal['daynames'] = array('Sun','Mon', etc. ); - Setting array for abbreviated daynames. By default this is set automatically according your locale settings for different languages (as are the month names displayed).
Setting optional parameters in the markup
-
base=PrefixName - prefix to ISO-date pagenames of blog group, like PrefixNameYYYY-MM-DD
-
isobasic=1 - ISO-dates used in page names will be basic, without hyphen, format YYYYMMDD, or basenameYYYYMMDD. Default is with hyphen separator: YYYY-MM-DD.
-
group=MyBlogGroup - blogcal will look in 'MyBlogGroup' instead of the current group to find matching ISO-date pages.
-
pastonly=1 - No link to a future month will be shown in the calendar caption. Default shows such link.
Setting static calendar views:
-
month=M - displays month number M of current year, or year specified with year= parameter.
-
year=YYYY - display current month, or month specified with month= parameter, in year YYYY
-
tooltip=description or tooltip=Description - display blog page description (given in
(:description ..:) markup) as link tooltip. Default is page title, if present, or page name.
-
tooltip=ptvname - display blog page ptv value as link tooltip; ptvname is name of ptv (without $: prefix). Default is page title, if present, or page name.
Setting additional calendar views:
You can use several instances of the (:blogcal:) markup to display several months.
-
shift=X - for X use number 1, -1, 2, -2 3, -3, etc to show next and previous months; each view shows month shifted by that number from the standard calendar view. Example: 3 months displayed, floated side by side:
%lfloat%(:blogcal shift=-1:)
%lfloat%(:blogcal:)
(:blogcal shift=1:)
Months displayed with shift= parameter do not contain links to next or previous month.
Customising the look
Just change values for the bcal table classes defined in the css style sheet.
Notes
Release Notes
- 2008-10-02: Changed a few HTML elements to make output XHTML strict.
- 2008-08-08: Added tooltip= parameter option.
- 2008-07-18: Initial release.
Thanks to Feral for FeralSimpleCalendar providing the base for this script
and to Chris Cox for PmCalendar providing parts for it.
If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".
See Also
Contributors
Comments
2008-08-08 Hi Hans. This is a fine cookbook, and works well for me. Is there some way I can modify tooltips to provide a short description of the blog entry for the date over which the cursor is hovering, to aid the user in selecting the blog entry of interest...perhaps using your excellent LinkCssToolTip? Ray.
Here is a possible solution, which needs modifying the script:
At present the tooltip for an existing blog page is the full PageName. when you look at the script code, near the end in the last else {...} block, you find twice title='$pname' as part of the <a> (link) tag.
Say your blog pages got a Summary page text variable. To display it's value as tooltip change title='$pname' to
title='".PageTextVar($pname,'Summary')."'
(watch for all the quotes and dots!).
If you use (:description ...:) markup and want to display that as tooltip, replace instead with
title='".PageVar($pname,'$Description')."'
- Maybe I should make a more generic solution, allowing for arbitrary page text variable specification in the markup, or the description markup text. - HansB August 08, 2008, at 12:11 PM
Now implemented in latest update. - HansB August 08, 2008, at 01:00 PM
2008-08-11 Hi Hans. title markup text works perfectly. Thanks for this, and for your extra-ordinary support. Click on my name for working example, in a blog context...Ray.
2008-09-30 I installed BlogCal yesterday and I love it. Today I noticed that my site no longer validates at http://validator.w3.org/ due to the BlogCal recipe. Can we get this wonderful recipe updated so that it doesn't break validation?
Fixed now in latest update. Thanks for the alert! - HansB October 02, 2008, at 07:20 AM
I'd be interested in learning more about which blog recipes this calendar works with. In other words, I'd like to hear some success stories about setting up blogs.
I'm still a little bit confused about the situation of blog recipes for PmWiki. Many of them are incomplete or discontinued (e.g., Fox Blog). Are people waiting for blogs to be released as a core feature of PmWiki? What is the best option at the moment for setting up a bliki using PmWiki?
Any tips would be greatly appreciated.
matt October 07, 2008, at 11:44 AM