View Single Post
  #1  
Old 05-08-2014, 06:25 AM
 
DBK Web Builder DBK Web Builder is offline
 

Advanced Member
  
Join Date: Apr 2014
Location: NJ
Posts: 67
 

Default integer math in a smarty template

I need to figure out when to restart a loop so I need to do this

<code>
{$ItemOrderby = 100}
{if $p.orderby gte "100" }
{$idiff = $ItemOrderby - $p.orderby }
IDIFF = {$idiff} <!-- just printing it out - it's alway blank ...
Difference = ITEM {$ItemOrderby} less current {$p.orderby} = {$idiff}

{if $idiff gte "100" }
</ul>
{$ItemOrderby = $p.orderby}
{/if}

</code>

but anyway - it's not doing the subtraction ... I found an old post from 2008 that said use {math}

but that it's slow ... and also 2008 was ages ago

what is the best way to do this now ?

thanks

DonnaNJ
__________________
4.6.2 and 4.6.3
http://www.DBKWebBuilder.com
Reply With Quote