Re: [Phplib-users] Template Bugs..
Brought to you by:
nhruby,
richardarcher
|
From: anze <an...@vo...> - 2002-05-13 21:44:37
|
Hi!
> The template.inc from the development tree has much nicer debugging
> than the -stable one.
Because the code you assign to variables is often (well, always) HTML code I
suggest you subclass Template and change set_var and similar functions to:
function set_var($varname,$value)
{
echo "VAR '$varname' set to: ".htmlentities($value);
Template::set_var($varname,$value);
}
Why? Assign something like '<input type="select"...' to some var and you'll
see. PHPlib debugging capability outputs exactly what is assigned to the var,
but your browser interprets it as HTML - not goot for debugging unless you
check HTML source every time (which is too cumbersome for me).
Or maybe you can find where debug is inspected and add that htmlentities()
around the var value... I didn't do it cause I subclassed Template anyway to
add parameters passing capability to it (so the designer can pass parameters
to the developer) and there was minimum hassle to add debugging.
The code above is just an example, it was written from the head and without
testing. I have used similar code when debugging though - but I don't have it
here. If you need more, let me know.
Have fun!
Anze
|