List Info

Thread: default modifier




default modifier
user name
2006-02-05 06:15:53
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


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)}$whateverfoo{/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.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFD5ZgZtyx3EHt/UjARAl7NAJ44M7hFraBE5rBivAWk+R/+LVp5QwCf
S+t8
2veHNmORiN+qzAeMX1Tx5z8=
=Z69k
-----END PGP SIGNATURE-----

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

default modifier
user name
2006-02-05 09:57:52
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:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> 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)}$whateverfoo{/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.
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

> 
>
iD8DBQFD5ZgZtyx3EHt/UjARAl7NAJ44M7hFraBE5rBivAWk+R/+LVp5QwCf
S+t8
> 2veHNmORiN+qzAeMX1Tx5z8=
> =Z69k
> -----END PGP SIGNATURE-----
> 
> -- 
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

default modifier
user name
2006-02-05 10:36:05
-----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)}$whateverfoo{/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+AJ4gR85MoX2wP85x40RTPHFcZjO6PACd
EwKR
SJphaWh48SeiwuN1xgHoPrU=
=spAj
-----END PGP SIGNATURE-----

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )