Difference between revisions of "Template:BMI"

From blackwiki
Jump to navigation Jump to search
imported>Plastikspork
(+ optional coloring)
imported>Plastikspork
(para name)
Line 2: Line 2:
 
  |{{{{{|safesubst:}}}#if:{{{ft|}}}{{{in|}}}{{{cm|}}}{{{m|}}}
 
  |{{{{{|safesubst:}}}#if:{{{ft|}}}{{{in|}}}{{{cm|}}}{{{m|}}}
 
   |{{{{{|safesubst:}}}#if:{{{kg|}}}{{{lb|{{{lbs|}}}}}}
 
   |{{{{{|safesubst:}}}#if:{{{kg|}}}{{{lb|{{{lbs|}}}}}}
   |{{#if:{{{table|}}}
+
   |{{#if:{{{color|}}}
 
     |style="background:{{{{{|safesubst:}}}BMI/color|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}" {{{{{|safesubst:}}}!}}
 
     |style="background:{{{{{|safesubst:}}}BMI/color|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}" {{{{{|safesubst:}}}!}}
 
     }}{{{{{|safesubst:}}}BMI/pad|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}|
 
     }}{{{{{|safesubst:}}}BMI/pad|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}|

Revision as of 01:38, 8 May 2011

{{BMI}}

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

This template calculates a person's body mass index using their height and weight.

Usage

The person's height and weight must both be specified.

The weight can be specified using either of the following units:

  • kg= kilograms
  • lb= pounds

The height can be specified using one (or more) of the following units:

  • 0m= metres
  • cm= centimetres
  • ft= feet
  • in= inches

Examples

Code Result
{{BMI|m = 1.82|kg = 56}} 16.9
{{BMI|cm = 182|kg = 81}} 24.5
{{BMI|ft = 6|lb = 200}} 27.1
{{BMI|in = 72|lb = 250}} 33.9
{{BMI|ft = 6|in = 1|lb = 275}} 36.3
{{BMI|m = 1.62|lb = 250}} 43.2

Optional table coloring

Code Result
{{BMI|m = 1.82|kg = 56|color=y}} 16.9
{{BMI|cm = 182|kg = 81|color=y}} 24.5
{{BMI|ft = 6|lb = 200|color=y}} 27.1
{{BMI|in = 72|lb = 250|color=y}} 33.9
{{BMI|ft = 6|in = 1|lb = 275|color=y}} 36.3
{{BMI|m = 1.62|lb = 250|color=y}} 43.2

See also