Difference between revisions of "Template:When"

From Organic Design wiki
(embed time related stuff with {{time}})
 
m
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
<table class=document-code><tr><td>
+
This template is not actually used, the ''#when'' parser-function is used to add time information to articles. Just add a single parameter which can be arbitrarily formatted time information, for example:
*[[News]] | [[Special:Recentchanges|Recent Changes]]
+
:<tt><nowiki>{{#when:2009/4/24}}</nowiki></tt> ''- best to do dates backwards like this otherwise it tries to use some weird American format''
*[[:Category:Milestones|Milestones]] | [[:Category:Completed Milestones|Completed Milestones]]
+
:<tt><nowiki>{{#when:24 apr 2009}}</nowiki></tt>
*[[Calendar]] | [[:Category:Dates|Date articles]]
+
:<tt><nowiki>{{#when:24 apr, 4:30pm}}</nowiki></tt> ''- current year is used here since not specified''
*[[2002]] | [[2003]] | [[2004]] | [[2005]] | [[2006]] | [[2007]]
+
The function expands to a set of category links to categorise the article into year, month, day-of-month, full-weekday-name and time (24 hour HH:MM:SS format). Articles exhibiting time can then be matched with a DPL query, for example:
</table>
+
:<tt><nowiki>{{#dpl:category=2006|category=April}}</nowiki></tt>
 +
The parser function which adds this is very simple consisting of the following [[when.php]] code in the ''LocalSettings.php'' file.

Latest revision as of 21:24, 22 May 2008

This template is not actually used, the #when parser-function is used to add time information to articles. Just add a single parameter which can be arbitrarily formatted time information, for example:

{{#when:2009/4/24}} - best to do dates backwards like this otherwise it tries to use some weird American format
{{#when:24 apr 2009}}
{{#when:24 apr, 4:30pm}} - current year is used here since not specified

The function expands to a set of category links to categorise the article into year, month, day-of-month, full-weekday-name and time (24 hour HH:MM:SS format). Articles exhibiting time can then be matched with a DPL query, for example:

{{#dpl:category=2006|category=April}}

The parser function which adds this is very simple consisting of the following when.php code in the LocalSettings.php file.