Re: [SMARTY-DEV] objects: one more approach
| From: | Dennis Gearon | Date: | Thu, 16 Jan 2003 17:24:06 +0000 |
| Subject: | Re: [SMARTY-DEV] objects: one more approach | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-559@lists.php.net to get a copy of this message | ||
I agree completely with the idea here, that it is up to the OBJECT to worry about access, not
Smarty. Smarty is a template engine, not a CMS, security system, or some such.
1/16/2003 2:00:45 AM, "Jan Rosier" <rosier@interstroom.nl> wrote:
>Hello again,
>
>
>----- Original Message -----
>From: "André Rabold" <arabold@nero.com>
>To: <smarty-dev@lists.php.net>
>Sent: Thursday, January 16, 2003 9:25 AM
>Subject: Re: [SMARTY-DEV] objects: one more approach
>
>
>> Hello,
>>
>[ ..... ]
>>
>> I still like the very first implementation {$foo->bar(1,2,3)} the best
>> because it was the easiest to learn syntax for all semi-programmers.
>> If you combine this syntax with the $smarty->register_object()
>> thing it would be the most powerful solution and it would be a clear
>> way. Object property support was already implemented in Smarty
>> and I'm sure some / alot of people are already using it. So modifying
>> the syntax wouldn't be too good.
>> Once again: The next logical step would be {$foo->bar($a,$b,$c)}
>> syntax for me. But I know you don't like it very much.
>>
>> * Syntax is common for all semi-programmers (to develop a
>> template also needs some programming skills)
>>
>> * Class methods are often methods which return a value. There's
>> a difference between returning a value like $foo->getBar() and
>> a normal Smarty Plugin which is outputting something. To retrieve
>> a method's return value using the above syntax you would need
>> to to something like this:
>> {capture name="bar"}{$foo->bar bar="1" blah="2"}{/capture}
>> {myFunction foo=$bar}
>> Using the {$foo->bar($a,$b)} syntax it would look like this
>> {myFunction foo=$foo->bar($a,$b)}
>>
>> * You could also use set-Methods of objects which can get
>> you in some trouble. But you this is not the problem of
>> {$foo->bar($a,$b,$c)} but also if you use
>> {$foo->bar bar=$a blah=$b}. So this is no real argument.
>>
>>
>> bye,
>> André
>>
>
>Hmm... André has some points here.
>
>I'm also wondering is it the task of Smarty to restrict access to methodes
>of objects?
>I think is't not.
>I tend to think when access restriction is important for an object. It
>should do it's own housekeeping to stay on top of things. Or when the object
>is not security aware one should use an wrapper as an gatekeeper.
>
>Maybe we could just go with the very first syntax?
>{$foo->bar($a,$b,$c)}
>
>I'm guessing. Looking at performance, it's also the fastest syntax, right?
>
>Greetings,
>Jan Rosier
>
>All those who believe in psychokinesis raise my hand.
>
>
>
>--
>Smarty Development Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>