Help:Recurring events

From semantic-mediawiki.org
Jump to: navigation, search
Recurring events
What:
Silently set recurring semantic data in a wiki page
Provided by:
Semantic MediaWiki
Min version:
1.5.0
Max version:
still supported
Function implementation:
Yes
Tag implementation:
No
Name:
#set_recurring_event

A recurring event is any event that occurs more than once, according to a pre-defined rule: examples are weekly meetings, anniversaries and birthdays. In Semantic MediaWiki, the dates for a recurring events are defined using the #set_recurring_event parser function, which is placed on the page that represents the event. This function takes the following arguments, in any order:

If no end date is set, a fixed number of dates is simply saved; this number is defined by the variable $smwgDefaultNumRecurringEvents, which has a default value of 100. There is also a maximum number of dates that can be saved using this function, regardless of the start and end date specified. This number is set by the variable $smwgMaxNumRecurringEvents, which has a default value of 500. Both values can be modified in one's LocalSettings.php file.

Examples

The following call would define the set of all Mondays between January 4, 2010 and June 8, 2011, with the exception of March 15, 2010 and March 22, 2010, both of which are replaced by the following Tuesday:

{{#set_recurring_event:property=Has date
|start=January 4, 2010
|end=June 8, 2011
|unit=week
|period=1
|include=March 16, 2010;March 23, 2010
|exclude=March 15, 2010;March 22, 2010
}}

The following call defines all birthdays of a person, starting with his or her date of birth; it is done by picking up the date entered on a page for the defined "Property:Has date of birth":

{{#set_recurring_event:property=Has birthday
|start={{#show:{{PAGENAME}}|?Has date of birth}}
|unit=month
|period=12
}}

If such a call were placed in a template, and the date of birth were entered as a template field, the code could be made even simpler:

{{#set_recurring_event:property=Has birthday
|start={{{Date of birth|}}}
|unit=month
|period=12
}}

Storing each event separately

The approach of #set_recurring_event is convenient, but due to SMW's querying syntax, it leads to limitations: most notably, you can't query or display only those occurrences that fall within a certain date range. There is an alternative function that you can use, that allows for more precise querying: #set_internal_recurring_event, defined in the Semantic Internal Objects extension. See here for more information.



This documentation page applies to all SMW versions from 1.5.0 to the most current version.
     

Help:Recurring events en 1.5.0


Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox