Re: [SMARTY-DEV] variable catenation
| From: | Roberto Bertó | Date: | Fri, 21 Feb 2003 18:21:02 +0000 |
| Subject: | Re: [SMARTY-DEV] variable catenation | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-806@lists.php.net to get a copy of this message | ||
There are some chars can be used:
& -> can conflict with AND
~ -> looks nice to me, but, isn`t usual
# -> since it is used to commend code and Smarty doenst use it as a
commend, can be used.
.= -> PHP use it to concat. Why not?
On Fri, 2003-02-21 at 15:13, Monte Ohrt wrote:
> 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
--
Atenciosamente,
---------------------------------------------------------
Roberto Berto - roberto@desenvolve.com.br
Gerente de Contas / Desenvolve
Hospedagem a R$ 7,60 por mês, com toda a nossa qualidade!
Confira: http://www.desenvolve.com.br
DESENVOLVE Soluções de Internet
http://www.desenvolve.com.br
TEL/FAX: 51 32270599 Rua Duque de Caxias, 1594 conj. 204
CEP 90010-281 - Porto Alegre - RS
---------------------------------------------------------