Re: [SMARTY-DEV] feature request: isa operator
| From: | Monte Ohrt | Date: | Wed, 18 Jun 2003 19:11:29 +0000 |
| Subject: | Re: [SMARTY-DEV] feature request: isa operator | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1616@lists.php.net to get a copy of this message | ||
So you are making the presumption that objects == business logic? I
don't think so. Objects are extremely useful but you have to be careful
how you use them, this is no different than custom functions.
Now this isa stuff... I don't see its practicality for the core. If you
want it, build your own functions & prefilters.
Monte
On Wed, 2003-06-18 at 08:45, Andrei Zmievski wrote:
> Stop. Putting. Business. Logic. In. The. Templates.
>
> I've always been against calling object methods from templates anyway,
> and now this? Please, god, tell me when it's going to stop.
>
> On Sat, 14 Jun 2003, boots wrote:
> > Hi all.
> >
> > After using the recent template object features I've noticed the lack
> > of an isa operator. I realize that some may see this as a slippery
> > slope so I offer the following rather gently.
> >
> > The only need I have for an isa operator is to allow my templates to
> > determine if they support a given object:
> >
> > {if $BLOCK isa PageBlock}
> > The PageBlock interface is supported.
> > {/if}
> >
> > The supported syntax is:
> >
> > {if var isa [not] type} where:
> > var - reference to a template variable
> > type - either 'Object' or a classname
> >
> > I had to patch the Smarty class to add a generic is_a function to
> > support PHP < 4.2. The changes in Smarty_Compiler follow the existing
> > _is* code. This patch was made against the June 10th CVS. My apologies
> > if I made the patch incorrectly -- but it seems to work for me :)
>
> -Andrei
> * I wish life had an UNDO function. *