Plugin

Developer
Supported

Simple Math

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

You must be logged in to post.

Simple Math throws error with EE2.5.2 update

Support Request

Versa Studio
Versa Studio

Hi,

I have this code in a template which worked prior to updating EE to 2.5.2.

{if "{exp:simple_math calculate='{row_count}%2'}" != 0}
 
<div class="boxRow">
{/if} 

Now it throws this kind of error:

A PHP Error was encountered

Severity: User Warning
Message: Invalid EE Conditional Variable: {if “exp:simple_math calculate=“4%2”}
Filename: libraries/Functions.php
Line Number: 2843

Thx,

Ben

Versa Studio
# 1
Versa Studio

Hi,

Could you take a look at this post please? Thx.

Laisvunas
# 2
Developer
Laisvunas

Hi,

It seems that EllisLab changed XSS filtering code and because of that your code now fails in EE 2.5.2.

But Simple Math add-on was never supposed to work in the code as yours. You should never use EE tags such as {exp:some_tag} inside conditionals; inside conditionals you can use only variables as {some_variable}.

So, how to fix this. To fix your code you should use Math Plus instead of Simple Math. Math Plus has similar syntax, but uses tag pair instead of single tag. Your code will be as this:

{exp:math_plus calculate='{row_count}%2' parse='inward'}

{if 
"{math_plus_result}" != 0}
 
<div class="boxRow">
{/if} 

{
/exp:math_plus} 
Versa Studio
# 3
Versa Studio

OK, thanks.