Help:Calendar format

From semantic-mediawiki.org

Jump to: navigation, search

The calendar format is a format for inline queries, defined within the Semantic Result Formats extension. It displays results in a monthly calendar in which a user can scroll forward and backward through time; its output matches that of the old Semantic Calendar extension.

Contents

Usage

A query in calendar format is called in the normal fashion; for example, it could look like:

{{#ask:[[Category:Events]]|? Has date|format=calendar}}

However, there are two issues that should be kept in mind:

The caching issue

The calendar format does not display correctly on a page that is cached. This is for two reasons: it will not be able to read the special CSS file for Semantic Calendar, and it will not be able to get the values for the month and year from the URL query string. There are three ways to get around this issue:

1. Disable all caching on your wiki, by adding the following two lines to anywhere in your "LocalSettings.php" file:

$wgEnableParserCache = false;
$wgCachePages = false;

2) Install the MagicNoCache extension, and add the string "__NOCACHE__" to any page that contains a calendar.

3) Disable caching only for those pages that have calendars on them. If, for instance, you have a page named "Events calendar", you could have the following in your "LocalSettings.php" file:

if (strpos($_SERVER['REQUEST_URI'], 'Events_calendar')) {
  $wgEnableParserCache = false;
  $wgCachePages = false;
}

There are two downsides to this approach: first, it's a hack, and second, any time you want to add or rename calendar pages, you will have to change this file again.

Changing the results limit

The calendar format requires all values to be "displayed" at the same time, since moving from month to month involves making the same query each time. If the number of events you need to display on the calendar is greater than 50, add a 'limit=' parameter to the query, with a number greater than the number of events. An example is:

{{#ask:[[Category:Events]]|? Has date|format=calendar|limit=10000}}

If the number of events to be displayed is greater than 500, though, you will need to take a second step - add the following line to your LocalSettings.php file, after the inclusion of Semantic MediaWiki:

$smwgQMaxInlineLimit = 10000;

(The value can be any number greater than the number of events you have.)

Example

The calendar format cannot be shown here, because it is not activated for this site. However, it can be seen at this calendar page on Discourse DB.

Personal tools