Kornel Lesinski wrote:
On Thu, 12 Jun 2008 05:07:40 +0100, zou guangxian <[EMAIL PROTECTED]> wrote:

After $tpl->getContext()->noThrow(true) was invoked

Thanks for detailed report, but noThrow() isn't supposed to be used that way.

getContext() method is only for use by macros and triggers and isn't supposed to be used elsewhere. noThrow() is strictly for the generated template code only.

Sorry for the confusion. Unfortunately I can't mark these methods as private/protected (they have to be accessed from template code that doesn't inherit any of these classes), but I've added comments to the code to make that clearer.

You should be using "| nothing" in TALES expression or check variable existence with tal:condition="exists:variable".

If you want to implement such feature, then saving of default noThrow value isn't the way to go - it unneccessarily imposes penalty at run time and separates this setting from templates that will rely on it.

Likely a better way to do this would be to add a custom attribute, like phptal:errors="ignore" which would change the way PHP template code is generated and ignore exceptions in that element only (see phptal:tales - it works in a similar way).

If I remember well, there's a tal:on-error attribute to catch exceptions:



Laurent Bedubourg

PHPTAL mailing list

Reply via email to