Re: [SMARTY-DEV] default modifier

[email protected] (Danilo Buerger) Sun, 05 Feb 2006 11:36:05 +0100
Newsgroups php.smarty.dev
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Thats not what i meant. My error handler is already set up to do that. I
just made a suggestion that i noticed this. If you can avoid throwing
errors, why not do it ;)? Also a simple isset call might be quicker then
all the code that is produced by the default modifier.

Best Regards,

Danilo Buerger

messju mohr schrieb:
> make your error handler handle the @-error-control operator, just
> check for $errno == 0 inside it.
> 
> greetings
> messju
> 
> On Sun, Feb 05, 2006 at 07:15:53AM +0100, Danilo Buerger wrote:
> 
> Hello,
> 
> when using the default modifier (for example {$whatever|default:'foo'})
> you will get a E_NOTICE (or was it E_USER_NOTICE? - i know this is
> suppressed by smartys error_reporting setting, but that doesn't work
> when using a custom error handler) because of the following code (this
> is from a compiled template):
> 
> <?php echo ((is_array($_tmp=@$this->_tpl_vars['whatever'])) ?
> $this->_run_mod_handler('default', true, $_tmp, 'foo') :
> smarty_modifier_default($_tmp, 'foo')); ?>
> 
> This is alright because this is how a modifier works. However to avoid a
> E_NOTICE why not just implement the default modifier just like {if
> isset($whatever)}$whatever{else}foo{/if} would work? Or maybe change the
> way modifiers are compiled by including an isset?
> 
> Best Regards,
> 
> Danilo Buerger
> 
> PS: This is on PHP 5.1.2.
> 
> 
>>
- --
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFD5dUVtyx3EHt/UjARAhn+AJ4gR85MoX2wP85x40RTPHFcZjO6PACdEwKR
SJphaWh48SeiwuN1xgHoPrU=
=spAj
-----END PGP SIGNATURE-----