Re: [SMARTY-DEV] simple math
| From: | Jimmy Harlindong | Date: | Fri, 02 May 2003 16:58:28 +0000 |
| Subject: | Re: [SMARTY-DEV] simple math | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1317@lists.php.net to get a copy of this message | ||
Monte,
I love this idea!
As for abuse, you just leave that to us he hehe :)
Jim
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Smarty Dev" <smarty-dev@lists.php.net>
Sent: Saturday, May 03, 2003 2:48 AM
Subject: [SMARTY-DEV] simple math
> As an experiment :-) I committed simple math operators on variables.
>
> examples:
>
> {$var}
> {$var+1}
> {$var-1}
> {$var*2}
> {$var/4}
> {$var++}
> {$var--}
> {$var+3.45}
>
> It can be put on the end of any valid varname:
>
> {#var#+1}
> {$var[foo].bar+1}
> {$obj->foo+1}
>
> Realize that $var++ increments the variable _after_ displayed. Also,
> there is no checking the validity of $var, so putting $var++ on a string
> is the same as $var++ on a string in PHP.
>
> We'll see if this causes any problems, but it look pretty harmless. I
> know this is another double-edge sword thing... it is very handy,
> but also opens doors for template abuse.