Re: [SMARTY] Re: [SMARTY-DEV] Incompatibility to older versions again
| From: | Mark Rogers | Date: | Tue, 18 Feb 2003 18:38:19 +0000 |
| Subject: | Re: [SMARTY] Re: [SMARTY-DEV] Incompatibility to older versions again | ||
| References: | 1 2 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-730@lists.php.net to get a copy of this message | ||
> On an afterthought, I'm wondering if we should
> enforce good habits with OO programming.
> One issue is direct access to properties...
In PHP this should be encouraged (although Smarty can't enforce it there).
Proper programming is not something I would want to require of a template
designer, though. The designer should not need to know anything about PHP.
Personally, I think Smarty should make use of the fact that it can tell the
difference between an object and an array, and (to a lesser extent) between
an object method and property, and hide all that from the template designer.
Thus:
{$x.y.z}
.. would work regardless of whether $x/$y is an object or an array. For
backward compatibility $x->y->z should be also work, although probably
discouraged. In fact $x[y][z] should also work.
Also:
{somefunc value="$(x.y).z"}
.. should work intuitively (ie as $x["y"] . ".z"), resolving many of the
problems being seen.
Mark Rogers,
Quarella (More Solutions) Ltd
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003