feature request: isa operator
| From: | boots | Date: | Sat, 14 Jun 2003 13:37:34 +0000 |
| Subject: | feature request: isa operator | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-1580@lists.php.net to get a copy of this message | ||
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 :)
xo boots
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com