RE: [SMARTY] Variables and math

From: Date: Fri, 01 Nov 2002 19:20:44 +0000
Subject: RE: [SMARTY] Variables and math
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6307@lists.php.net to get a copy of this message
> Hi everybody, > > I want to do this more or less: > > {$foo * 16} > > where foo is a number. Actually my real code is a bit more > complex, but this should be enough to see what I want to do. > The custom function "math" is not the correct answer. Anyway, > the *16-part is completely ignored by Smarty and I don't know > what to do. > I'm curious.....why does Smarty not give you the "correct" answer? Have you tried casting $foo to an int or a float in your PHP script, as it is assigned to the Smarty variable? I use the following in one of my templates, and it works fine: {math equation="2 + $foo"} sl _________ Simon Lee --- LeapForward --- creative intelligence for the networked economy 167a Clapham High Street, London SW4 7SS t: +44(0)70 9234 1503 f: +44(0)70 9234 1787 e: simon.lee@leapforward.net www.leapforward.net

« previous php.smarty.general (#6307) next »