Re: [SMARTY-DEV] feature request: isa operator
| From: | Andrei Zmievski | Date: | Wed, 18 Jun 2003 13:45:26 +0000 |
| Subject: | Re: [SMARTY-DEV] feature request: isa operator | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1613@lists.php.net to get a copy of this message | ||
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. *