Debug Console

Luca Borrione <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Hello to anyone,

one year and half ago I posted a code for a new debug console,
maybe someone could remember it.

Well some people recently asked me an update of it,
so I took the last stable version of Smarty and done it.
I post it again to the group: I hope someone will find it useful,
and maybe it could be added in the future release of Smarty or as
a contributed code.

You can find a working demo online at
[ http://www.dgtmedia.com/pub/lubo/smarty/demo.php ]

You can download an archive of this demo at
[ http://www.dgtmedia.com/pub/lubo/Smarty-2.6.5_mod.rar ]

To test it by your own you just have to copy its content
as is to any path and do
CHOWN apache:apache and CHMOD 755 to
/templates_c
/cache
/debug/debug.html

Inside it you'll find a pdf in which I list all the modification
I like to do to any version of Smarty before using it,
included the ones needed to use the new debug console.
The version of smarty included in this archive has all the modifications
listed in this pdf and nothing more!

Once installed the console can be used by a boolean smarty variable
- debug_console_altmode (true: alternative mode | false: classic mode)
Edit demo.php to see it working.

Just to prevent some question:
1) The idea is to write an HTML file (debug.html) which is contained
in the debug dir I put under SMARTY_DIR. When the user ask to open
the console, this HTML is opened in a new browser window.
So: the HTML file must be writable by apache and reachable by an HTTP URL.
It's not recommended to put the SMARTY_DIR under the web server document 
root, and anyway to use the templates/templates_c/cache dirs as they
are used in this demo. My main purpose is to create a stand-alone demo.
You might change the path to reach debug.html to where you think safe.
To done it
- edit debug.tpl and change $debug_file on line 5
- change the last modification listed in my pdf (the one to 
core.display_debug_console.php) according to your new path
Ofcourse this may be regulated by a smarty variable, but it's not 
implemented at the moment.


2) The message added to the page "TO OPEN SMARTY DEBUG CONSOLE: etc"
when the console is activated is only a demo, it can be altered or 
deleted by editing debug.pl and modifing the last lines.


3) If you want to change the keycode shortcut you must edit debug.tpl
at line 132. The first value is for netscape 4 users, the second for any 
other browser users.


4) Editing plugins/function.debug_build.php you can access to some 
configuration variable of the debug console, to control its behaviour
edit debug/treeview.js


The console uses a cookie to open the last opened node any time you
reopen the console.

I wrote every single line of any code posted, if you think to use
by your own please don't remove the copyright headers, if you think
to introduce it in Smarty or destribute it as a contributed code,
please contact me: I'll be happy to give something back to the net for free.

I hope you'll find it useful and easy to understand and to use,
because I really don't have time enough to support you.

Have a nice time
Luca

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.