EE 1
EE 2
Math
Developer
3rd Party (Free)
111 downloads (last 90 days)
Download v1.3.0
Compatibility
- Multi Site Manager
- Stand Alone Entry Form
- Low Variables
- Better Workflow
- Matrix
Requirements
- jQuery for the Control Panel
Categories
Plugin
Tags
Use Math to execute PHP supported math formulas.
Parameters:
formula = ‘(5 * 2) / [1]’ // math formula (required) supports the following operators as well as bitwise + - * / % ++—< > <= => != <> ==
params = ‘{var}|{var2}’ // pipe delimited list of numeric parameters to be replaced into formula, recommended due to use of PHP eval (default: null)
decimals = ‘2’ // sets the number of decimal points (default: “0”)
decimal_point = ‘.’ // sets the separator for the decimal point (default: “.”)
thousands_seperator = ‘,’ // sets the thousands separator; (default: “,”)
absolute = ‘yes’ // return the absolute number of the result (defaults: “no”)
round = ‘up|down|ceil’ // whether to round the result up or down (defaults: no rounding)
numeric_error = ‘Error’ // message returned when non-numeric parameters are provided (default: “Invalid input”)
trailing_zeros = ‘yes’ // include trailing 0 decimal places (defaults: “no”)
Usage:
{exp:math formula=“10 - 12” absolute=“yes”} outputs 2
{exp:math formula=”((4 * 5) / 2)” decimals=“2”} outputs 10.00
{exp:math formula=”([1] + 1) / [2]” params=”{total_results}|2” round=“down”} outputs 5 where {total_results} is 10
{exp:math formula=“2/3” decimals=“2” round=“up”} outputs 0.67
Changelog:
# 1.3.0
2013-05-08
- Added DevDemon Updater compatability
# 1.2.0
2013-01-13
- Resolved issue with deimal padding and rounding
# 1.1.0
2013-01-04
- Plugin now strips non-numeric characters out of passed parameters
Download Math
| EE Version | Downloads | Add-On Version | Release Date |
|---|---|---|---|
| 2.+ | Download | 1.3.0 | 2013-05-08 03:06 PM |
Math Links
This entry was created June 7, 2012, 11:56 am.
This entry was last updated May 13, 2013, 10:49 am.
Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!
4 Reviews:
marviq 05.13.13
Great little tool for doing math without exposing PHP to your templates. I presume the earlier reviews were before the latest update as I couldn’t find fault with it. 5-stars!
Tim FitzGerald 02.06.13
Important to note that decimals=x only seems to pad zeroes, and round=up|down rounds to the nearest integer. {... formula=2/3 decimal=2} gives 0.6666… and {... formula=2/3 decimals=2 round=up} gives 1.00.
To round decimals, use {... formula=round(2/3,2)} for 0.67.
abed 09.08.12
Did not make use of this extensively. It seems to be an excellent plugin for arithmetic, however, there doesn’t seem to be a way to nullify the thousands_operator so I was stuck with results in ###,### format. Gave MX Calculation a try as Daniel Kandi said.
If the separator is a plus, use this.
Daniel Kandi 06.08.12
nice add-on, but you need to look on MX Calculation - is add-on is build without eval, so is more secure.