Difference between revisions of "Template:Add colon minutes"

From blackwiki
Jump to navigation Jump to search
blackwiki>Wikid77
(changed use of {str_rightc|{1}|2 |0} to immediately return param. 3 as zero, when each time parameter is empty, as perhaps 1,000x times faster)
blackwiki>Wikid77
(removed if-expression which bypasses 19-50 of {padleft: |...} at parameter 19)
Line 25: Line 25:
 
  + {{padleft:|{{#ifeq:{{substr|{{{17|0}}}|1|1}}|:|1|2}}|{{{17|0}}}}}
 
  + {{padleft:|{{#ifeq:{{substr|{{{17|0}}}|1|1}}|:|1|2}}|{{{17|0}}}}}
 
  + {{padleft:|{{#ifeq:{{substr|{{{18|0}}}|1|1}}|:|1|2}}|{{{18|0}}}}}
 
  + {{padleft:|{{#ifeq:{{substr|{{{18|0}}}|1|1}}|:|1|2}}|{{{18|0}}}}}
{{#if:{{{19|}}}|<!--if param. 19 exists, then check 19-50-->
 
 
  + {{padleft:|{{#ifeq:{{substr|{{{19|0}}}|1|1}}|:|1|2}}|{{{19|0}}}}}
 
  + {{padleft:|{{#ifeq:{{substr|{{{19|0}}}|1|1}}|:|1|2}}|{{{19|0}}}}}
 
  + {{padleft:|1|{{{20|0}}} }} <!--
 
  + {{padleft:|1|{{{20|0}}} }} <!--
Line 58: Line 57:
 
--> + {{padleft:|1|{{{49|0}}} }} <!--
 
--> + {{padleft:|1|{{{49|0}}} }} <!--
 
--> + {{padleft:|1|{{{50|0}}} }} <!--
 
--> + {{padleft:|1|{{{50|0}}} }} <!--
-->}}<!--endif {{{19|}}} exists--
 
 
--> ) + ( <!--
 
--> ) + ( <!--
 
--------------------------------------- Plus carried minutes
 
--------------------------------------- Plus carried minutes

Revision as of 07:14, 8 May 2010

Expression error: Unrecognized punctuation character ":".:Expression error: Unrecognized punctuation character "[".

Template documentation[view] [edit] [history] [purge]

The Template:Add_colon_minutes adds times of minutes/seconds (in format "mm:ss") and displays the total (as mmm:ss). A typical usage would be to add the times of music tracks for an album. Each time is specified as a parameter (up to 50 parameters).

Usage:

{{add colon minutes|1:01|2:02|3:03}}     → 6:06
{{add colon minutes|3:30|2:40|20:07}}    → 26:17

The template cannot handle times with dots (".") due to checking the position of the colon, in the calculations. The total time is calculated using the MediaWiki parser function "padleft" and the highly complex substring template {{str_rightc}}.

See also