Archive:Calendar format 1.4.0 - 1.5.6

From semantic-mediawiki.org


This documentation page applies to all SMW versions from 1.4.0 to 1.5.6.
Other versions: ≥ 1.6.0      

Help:Calendar format en 1.4.0 1.5.6


Calendar format 1.4.0 - 1.5.6
Displays time-associated pages on a calendar
Further Information
Provided by: Extension "Semantic Result Formats"
Added: 1.4.0
Removed: still supported
Requirements: none
Format name: calendar
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: Yaron Koren
Categories: time
Table of Contents

The calendar format is a format for inline queries, defined within the Extension "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 now-obsolete Semantic Calendar extension.

Usage[edit]

A query in calendar format should be called in the following way:

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

...in other words, the date property being queried against should also be used to filter dates: #calendarstartdate and #calendarenddate will return the first and last date (actually, the day after the last date), respectively, for any specific month. This is done so that only those dates that are within the current month, instead of all of them, are passed in to be displayed by the calendar.

Two notes on creating such queries:

  • Make sure to include the colon, ':', in the #calendarstartdate and #calendarenddate parser function calls; otherwise, they won't work.
  • Don't worry that the comparison operators are '<' and '>' instead of '<=' and '>='; the return values of the parser functions are set so that this will not be an issue

The caching issue[edit]

For previous versions of Semantic Result Formats, calendars did not display correctly unless MediaWiki caching was manually disabled on at least those pages that contained calendars. This has now been fixed in the code; if it's still a problem for you, please upgrade to the latest version of SRF.

Changing the results limit[edit]

The default limit of results displayed by an inline query is 50. If you have more than 50 events in any month, you should add a 'limit=' parameter to the query, with a number greater than the maximum number you have. An example is:

{{#ask:
  [[Category:Events]]
  [[Has date::>{{#calendarstartdate:}}]]
  [[Has date::<{{#calendarenddate:}}]]
  |? Has date
  |format=calendar
  |limit=300
}}

If the number of events you have in any month 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 = 1000;

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

Example[edit]

You can see an example of the calendar format in use on this calendar page on Discourse DB.