Join Now

Click here to join our
growing community:



Welcome Tour
Pro Modules

Copyright © 2020
Terms of Use
Privacy Policy



This command/function allows you to perform basic mathematical functions and return the data.

To use it, enter a simple math expression like:

[(math "(3+5)/4")]

This will return the number 2. The math expression can not include spaces.

The only allowed characters are "+-*/()" and numbers (including decimal point). If any other characters are included the function will fail and send back a warning message.

You can however insert variables and even variable functions into the expression, as long as they resolve to numbers or other appropriate characters. If you had two variables with values 2 and 3 respectively, the following would return 5:

[(math "{var1}+{var2}")]

If the math command attempts to evaluate an expression that results in an error, such as dividing a number by 0, it will abort and send back a warning.

If you think you will need a calculated value more than once, you can assign it an id and then retrieve that value at a later point. For example, both of these lines will return the number 5.

[(math 2+3 id=remember)]
[(math id=remember)]

Notes: Keep in mind markup processing order when trying to remember values for this function. Values may be remembered across skin zones if they are called in a zone that appears earlier in your skin, and remembered in a later zone. Values called in the footer zone cannot be remembered in the header zone for example, but they will work the other way around.

The Math Command

When used as a command, you can calculate user input. Consider the following form:

Math Expression: [text input '{?input}'] [submit CALCULATE]
[command math {=input}]
[command passdata input,math]

This form allows the user to input a basic math expression and then outputs the results. Pretty cool.

Decimals are automatically trimmed (not rounded) to two places by default. You can change that by setting the decimal parameter to the number of places you want to appear after the decimal.

Remember your basic math order of operations. That is, 2+3*4 equal 14 not 20. Or to avoid confusion, use (2+3)*4.