Re: [SMARTY-DEV] variable catenation
| From: | Jason Sweat | Date: | Sun, 23 Feb 2003 03:58:23 +0000 |
| Subject: | Re: [SMARTY-DEV] variable catenation | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-830@lists.php.net to get a copy of this message | ||
Hi Monte,
Not that uncommon to see
"before" & $after
And a concatenation operator only an oracle sql coder could love :)
"before" || $after
Jason
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Smarty Dev" <smarty-dev@lists.php.net>
Sent: Friday, February 21, 2003 12:13 PM
Subject: [SMARTY-DEV] variable catenation
> I've been playing with variable catenation to see if it is even
> possible, and there are some problems.
>
> First, I was trying to resolve it for function attributes:
>
> {foobar foo=foo."bar" foo=$foo.$bar foo=$foo.bar}
>
> You can see there is a conflict of what "." means. Is $foo.bar a
> catenated value or an associative array? is $foo.$bar catenated or
> dynamic associative array?
>
> So then I decided to try "+" instead of ".", much like the javascript
> way of catenating strings.
>
> {foobar foo=foo+"bar" foo=$foo+bar foo="foo"+"bar"}
>
> Everything seems to work OK (even embedded + in quotes works as
> expected), you just can't put spaces around the + signs or else it is
> unclear where the next attribute starts.
>
> So, now moving on to IF statments.
>
> {if $foo+bar eq "blah" and 1+2=3}
>
> Another conflict, is + a string catenation operator or a math operator?
>
> I'd kind of like to stick to the PHP way of doing things with ".",
> except for the syntax conflicts... unless someone comes up with a good
> solution. Ideas?
>
> Othewise we go with the clunky cat modifier.
>
>
> Monte
>
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>