About the photo... I was originally going to take a photo of something related
to numbers or math, but as I was leaving work, I saw a kind of cool shot...
Arithmetic
"Arithmetic"
is a Movable Type plugin that provide
ssimple arithmetic operations (addition, subtraction, multiplication,and division).
Information
- Version
- 1.0.1
- Last Modified
- 30 November 2005
- Download
- arithmetic-1.0.1.zip
- License
-
This work is licensed under a Creative Commons License.
Requirements
The "arithmetic" plugin depends on the
"Expressions" plugin by
Adam Kalsey (http://kalsey.com/blog/2003/01/expressions/).
Installation
Copy arithmetic.pl into the plugins directory under your Movable Type
installation directory.
Your installation should look like this:
(mt home)/plugins/arithmetic.pl
Tag Reference
- <MTAdd> - adds one number to another
- <MTSubtract> - subtracts one number from another
- <MTMultiply> - multiplies one number by another
- <MTDivide> - divides one number by another
- <MTSetVar2> - assigns a value to a variable
- <MTGetVar2> - obtains the value of a variable
- <MTAddVar> - adds a number to the value in a variable
- <MTSubtractVar> - subtracts a number from the value in a variable
- <MTMultiplyVar> - multiplies a value in a variable by a number
- <MTDivideVar> - divides a value in a variable by a number
<MTAdd>
Outputs the result of adding one number (y) to another (x).
Attributes:
- x - the first number
- y - the second number
<MTSubtract>
Outputs the result of subtracting one number (y) from another (x).
Attributes:
- x - the first number
- y - the second number
<MTMultiply>
Outputs the result of multiplying one number (x) by another (y).
Attributes:
- x - the first number
- y - the second number
<MTDivide>
Outputs the result of dividing one number (x) by another (y).
Attributes:
- x - the first number
- y - the second number
<MTSetVar2>
Identical to the built-in <MTSetVar> tag, but is able to evaluate a nested MT tag.
Attributes:
- name - the name of the variable
- value - the value of the variable
<MTGetVar2>
Identical to the built-in <MTGetVar> tag, but is able to evaluate a nested MT tag.
Attributes:
- name - the name of the variable
<MTAddVar>
Adds a number (value) to the value already stored in a variable
(specified by name).
Attributes:
- name - the name of the variable
- value - the value to add
<MTSubtractVar>
Subtracts a number (value) to the value already stored in a variable
(specified by name).
Attributes:
- name - the name of the variable
- value - the value to subtract
<MTMultiplyVar>
Multiplies a value stored in a variable (name) by a specified number
(value).
Attributes:
- name - the name of the variable
- value - the value by which to multiply
<MTDivideVar>
Divides a value stored in a variable (name) by a specified number
(value).
Attributes:
- name - the name of the variable
- value - the value by which to divide
Examples
<MTAdd x="2" y="2"> results in "4" being output.
<MTSetVar2 name="foo" value="2"> followed by <MTAddVar name="foo" value="2">
followed by <MTGetVar2 name="foo"> results in "4" being output.
<MTSetVar2 name="foo" value="2"> followed by <MTAddVar name="foo" value="[MTMultiply x='2' y='20']">
followed by <MTGetVar2 name="foo"> results in "42" being output.