RE: [SMARTY] Variables and math

From: Date: Fri, 01 Nov 2002 18:49:45 +0000
Subject: RE: [SMARTY] Variables and math
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6304@lists.php.net to get a copy of this message
How about this: As a plug-in (check the smarty manual and check the syntax... this is untested): smarty_function_multiply($params, &$smarty){ echo $params[factor1]*$params[factor2]; } in your template: {multiply factor1=$foo factor2=16} Or if you need the result, add an assign param... or maybe make it a modifier function so you can do {assign var=foo_squared value=$foo|times:2} -- Josh -----Original Message----- From: Victor [mailto:vboivie@home.se] Sent: Friday, November 01, 2002 1:44 PM To: smarty-general@lists.php.net Subject: [SMARTY] Variables and math 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. Thanks in advance, Victor -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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