Difference between revisions of "Template:When"

From Organic Design wiki
m
(how to use #when with #dpl)
Line 1: Line 1:
<noinclude>
+
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:
This template will be used to add time information to an article. It will probably be implemented as a parser function rather than a template so that we can convert any arbitrary date format easily, for example <tt>{</tt><tt>{#when:d=*|h=6|m=30}}</tt> or <tt>{</tt><tt>{#when|27 Jan}}</tt>. This template should allow friendly input with useful defaults for unspecified parameters, the whole thing expanding to a collection of category statements which DPL can query, such as ''Monday'', '':30'', ''06:00'', ''2007'' etc. DPL can query categories more efficiently and offer more flexible ways of selection such as regular expressions. For complex time information, any number of time statements could be added to a page.
+
<tt><nowiki>{{#when:2009/4/24}}</nowiki></tt> ''- best to do dates backwards like this otherwise it tries to use some weird American format''
  
Also the ability to specify a duration with each time statement should be included too, maybe ''t'' for time. The default value would be zero which is a point in time with no duration.
+
<tt><nowiki>{{#when:24 apr 2009}}</nowiki></tt>
{{info|
 
;New time categories
 
*[[:Category:Years]]
 
*[[:Category:Months]]
 
*[[:Category:Weeks]]
 
*[[:Category:Days]]
 
*[[:Category:Hours]]
 
*[[:Category:Minutes]]
 
*[[:Category:Seconds]]
 
  
;Other time-related articles
+
<tt><nowiki>{{#when:24 apr, 4:30pm}}</nowiki></tt> ''- current year is used here since not specified''
*[[News]] {{!}} [[Special:Recentchanges|Recent Changes]]
+
 
*[[:Category:Milestones|Milestones]] {{!}} [[:Category:Completed Milestones|Completed Milestones]] {{!}} [[Road Map]]
+
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:
*[[Calendar]] {{!}} [[:Category:Date|Date articles]]
+
 
*[[2002]] {{!}} [[2003]] {{!}} [[2004]] {{!}} [[2005]] {{!}} [[2006]] {{!}} [[2007]]
+
<tt><nowiki>{{#dpl:category=2006|category=April}}</nowiki></tt>
}}
 
</noinclude>
 

Revision as of 11:43, 25 April 2007

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}}