Re: [SMARTY] Re: PHP Error Reporting E_ALL
| From: | messju mohr | Date: | Fri, 31 Oct 2003 17:26:38 +0000 |
| Subject: | Re: [SMARTY] Re: PHP Error Reporting E_ALL | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10485@lists.php.net to get a copy of this message | ||
On Fri, Oct 31, 2003 at 05:58:54PM +0100, Thorsten Suckow-Homberg wrote:
> > what notices from the template do you wan't to retrieve if not the
> > ones about undefined variables?
>
> The notices force you to keep your code clean. Think about this: You
> fetch data out of a db and want to assign those values to your
> template-placeholder.
>
> What if this data does not exist? You could do the following:
>
> if ($bDataExists) {
>
> $oTemplate->assign("data0", $aData[0]);
> .
> .
> .
> $oTemplate->assign("data[n]", $aData[[n]]);
> } else if (!$bDataExists) {
> $oTemplate->assign("data0", "");
> .
> .
> .
> $oTemplate->assign("data[n]", "");
> }
i meant *in the template*.
> Since I'm a friend of the "keep-it-short"-way, this would blow up
> some of my files, and this is why I want to let smarty look for
> unset indexes.
... and this is why smarty does prevent E_NOTICES when debugging is disabled.
> > why don't you just turn off E_NOTICES before you call fetch() or
> > display() and turn them on again after that?
>
> Nah, I don't like that, looks like an "ugly" workaround (don't take it
> personal.... ;) )
in a subclass of smarty encapsulated in an overloaded
fetch()-function? that doesn't look ugly to me at all but YMMV.