mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
Debug formatting.
This commit is contained in:
@@ -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(' ',$depth*2)."<b>$curr_key</b> => $return".'<br>\r';
|
$results .= '<br>\r'.str_repeat(' ', $depth*2)."<b>$curr_key</b> => $return";
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -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}
|
||||||
|
@@ -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}
|
||||||
|
Reference in New Issue
Block a user