Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

BlogCalendar

Summary: small calendar for blogs showing highlighted links to date-named blog pages
Version: 2008-10-02
Prerequisites: PmWiki 2.2.0
Status: new
Maintainer: HansB
Discussion: BlogCalendar-Talk
Categories: Blog CMS Links PIM Calendar

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

See discussion at BlogCalendar-Talk

User notes : 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 September 02, 2012, at 04:07 PM