Re: [phplib] HTML_Template From: Richard Archer (rha <email protected>)
Date: 07/22/01

At 3:17 PM +0200 22/7/01, Björn Schotte wrote:

>could some of you with experience from PHPLIB's Template system have
>a look at
>
> http://rent-a-phpwizard.de/phplibpear.tgz
>
>? It consists of:
>
>template.php
>template.xml
>test.php
>test.tpl
>
>test.php is a small test script quick hack. Everything seems to work
>fine, including template blocks. Please verify the code if it conforms
>to the guidelines.

Hi Björn,

I don't know about PEAR guidelines, but unfortunately you have based
your port on a buggy version of PHPLIB's template.inc.

Try replacing "BLUBB" with "$3000.00" and see what happens.

The full list of bugs:

failure to check for empty strings if passed an array of filenames
set_block unnecessarily requires a newline
set_var is missing a set of braces
debug output prints raw HTML -- should be escaped
'$' in replacement text is stripped
pparse should call this->finish
get_vars should use a call to get_var rather than this->varvals
get_var should check for unset varname
I like debug statements in get_var and loadfile too :)
in finish, the replacement string references an unset variable
_loadfile does not need to use _filename as setFile already does

You can download a copy of your file with my fixes for these bugs from:
http://mel01.juggernaut.com.au/templates/phplib_pear/template.txt

Also, the way errors are handled is bogus. Error messages are never printed
and it never halts, even if HaltOnError is set. I'll leave this fix for you
:)

 ...Richard.

-- 
Abbestellen mit Mail an:   phplib-unsubscribe <email protected>
Kommandoliste mit Mail an: phplib-help <email protected>