$smarty->debugging and {debug} consoles--best of both worlds

From: Date: Tue, 02 Dec 2003 01:30:00 +0000
Subject: $smarty->debugging and {debug} consoles--best of both worlds
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1946@lists.php.net to get a copy of this message
Setting $smarty->debugging = true results in a debug console being generated at the end of the html body that contains the templates used, but only the variables available to the main template. Stamping out {debug} results in a debug console being generated inline that does not contain any templates used, but has all the variables used in the page up to that point. Doing both, results in two debug consoles being generated. The second, generated from the $smarty->debugging = true is the same as always, and since it writes to the same window, it obliterates the output from the first which was generated by the {debug}. However, if you block the second one, interestingly enough, the console stamped out inline by the {debug} tag has _both_ all the templates used, and all the variables available up to that point. So, here's a little patch to get just that one every time: --- /home/nick/smarty/Smarty-2.6.0/libs/core/core.display_debug_console.php 2003-10-11 02:55:53.000000000 -0600 +++ core.display_debug_console.php 2003-12-01 18:09:50.000000000 -0700 @@ -16,6 +16,12 @@ */ function smarty_core_display_debug_console($params, &$smarty) { + static $alreadyDone = false; + + if ($alreadyDone) + return; + $alreadyDone = true; + // we must force compile the debug template in case the environment // changed between separate applications. I'm sure there's a better way to do this, but I'm not interested in delving into Smarty internals right now--I just need this output for my development. So, if anyone does take the time to create a better/more correct solution, please send it my way. Nick

« previous php.smarty.dev (#1946) next »