Debug formatting.

This commit is contained in:
andrey
2001-10-26 19:16:06 +00:00
parent 85e1f567d4
commit 8b225eb072
3 changed files with 18 additions and 18 deletions

View File

@@ -710,10 +710,10 @@ function smarty_func_assign_debug_info($args, &$smarty_obj) {
\*======================================================================*/ \*======================================================================*/
function smarty_mod_debug_print_var($var, $depth=0, $length=40) { function smarty_mod_debug_print_var($var, $depth=0, $length=40) {
if (is_array($var)) { if (is_array($var)) {
$results = "<b>Array (".count($var).")</b>".'<br>\r'.$results; $results = "<b>Array (".count($var).")</b>";
foreach ($var as $curr_key => $curr_val) { foreach ($var as $curr_key => $curr_val) {
$return = smarty_mod_debug_print_var($curr_val, $depth+1); $return = smarty_mod_debug_print_var($curr_val, $depth+1);
$results .= str_repeat('&nbsp;',$depth*2)."<b>$curr_key</b> =&gt; $return".'<br>\r'; $results .= '<br>\r'.str_repeat('&nbsp;', $depth*2)."<b>$curr_key</b> =&gt; $return";
} }
return $results; return $results;
} else { } else {

View File

@@ -15,7 +15,7 @@
{/section} {/section}
_smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>"); _smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>");
{section name=vars loop=$_debug_keys} {section name=vars loop=$_debug_keys}
_smarty_console.document.write("<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td><tt><font color=green>{$_debug_vals[vars]|@debug_print_var}</font></tt></td></tr>"); _smarty_console.document.write("<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td nowrap><tt><font color=green>{$_debug_vals[vars]|@debug_print_var}</font></tt></td></tr>");
{sectionelse} {sectionelse}
_smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>"); _smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>");
{/section} {/section}

View File

@@ -15,7 +15,7 @@
{/section} {/section}
_smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>"); _smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>");
{section name=vars loop=$_debug_keys} {section name=vars loop=$_debug_keys}
_smarty_console.document.write("<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td><tt><font color=green>{$_debug_vals[vars]|@debug_print_var}</font></tt></td></tr>"); _smarty_console.document.write("<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td nowrap><tt><font color=green>{$_debug_vals[vars]|@debug_print_var}</font></tt></td></tr>");
{sectionelse} {sectionelse}
_smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>"); _smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>");
{/section} {/section}