We use print_r() in php to print the arrays recursively. If you're using smarty templating engine we can't use the same to print the arrays recursively. We have to assign the array value in a smarty variable in the corresponding php like this:
$smarty->assign('contacts', array('fax' => '555-222-9876', 'cell' => '555-111-1234'));
$smarty->display('index.tpl');
Then open index.tpl and use the variable contacts like this:
{$contacts|@debug_print_var}
Thats it! it'll print the arrays recursively same as print_r() in PHP !!
No comments:
Post a Comment