Re: [SMARTY] Int incr/decr on the fly

From: Date: Mon, 19 Jan 2004 09:24:59 +0000
Subject: Re: [SMARTY] Int incr/decr on the fly
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10839@lists.php.net to get a copy of this message
Luca Borrione wrote [edited]:
Hi all, assuming I use a generic tag: {tag var="$myvar"} assuming $myvar is an integer, I would like only to increment or decrement its value by 1 without previously use a math tag. {tag var="$myvar++"} How is it the correct syntax for it?
{tag var=$myvar++} Does the trick.
Further more, it could be an idea to create a math modifier for more complex equation: {tag var="$myvar|math:x+6"} where x is assumed to be $myvar.
Variables can already be used in equations, eg: {tag var=$myvar+6} or {tag var="$myvar+6"} see the docs at: http://smarty.php.net/manual/en/language.math.php -- Mark Gibson <gibsonm@cromwell.co.uk> Web Developer & Database Admin Cromwell Tools Ltd. Leicester, England.

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