We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Math Plus

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

This plugin provides support for doing simple mathematical operations in templates.

There is already the plugin Simple Math which has the same purpose.

Math Plus plugin differs from Simple Math only in one feature: it is required to use a tag pair instead of single tag. Tag pair allows for better control of the parse order.

PARAMETERS

1) calculate - Required. Alows you to input a string consisting of numbers, symbols of mathematical operations and round brackets, e.g calculate = “(10 + 5) / 3”. Examples of symbols of supported mathematical operations are: + (addition), - (subtraction), * (multiplication), / (division), % (division remainder), ++ (increment), – (decrement).

2) invalid_input - Optional. Accepts two values: “alert” and “silence”. Default value is “silence”. If the value is “alert”, then in cases when the plugin has some problem with parameters, PHP alert is being shown; if the value is “silence”, then in cases when the plugin has some problem with parameters, it finishes its work without any alert being shown. Set this parameter to “alert” for development, and to “silence” - for deployment.

USAGE

Use this plugin as folllows:

{exp:math_plus calculate="(10 + 5) / 3"}
{math_plus_result}
{/exp:math_plus}
       
fjldude's avatar
fjldude
50 posts
16 years ago
fjldude's avatar fjldude

Thanks for creating Math Plus.

It was just what I needed for doing a calculation and passing the result to a another plugin (See this thread).

Cheers!

       
Santa Fe's avatar
Santa Fe
7 posts
15 years ago
Santa Fe's avatar Santa Fe

What version of EE was this plugin written for? I’m using EE 2.0 Public Beta and it doesn’t seem to be working. I just placed the sample code into a template and the page comes up blank.

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

This plugin is for EE 1.x

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.