PHPcodearray ('id' = & gt; 1, 'pid '= & gt; 0, 'name' = & gt; 'level 1 1 ', 'child '= & gt; array (2 = & gt; array (question about the array parsed by the smarty Template
PHP code
Array ('id' => 1, 'pid '=> 0, 'name' => 'Level 1 1 ', 'child '=> array (2 => array ('id' => 2, 'pid' => 1, 'name' => 'second 11 ',), 3 => array ('id' => 3, 'pid '=> 1, 'name' => 'second-level 12 ',), 9 => array ('id' => 9, 'pid '=> 1, 'name' => 'second-level 13 ', 'child '=> array (4 => array ('id' => 4, 'pid' => 9, 'name' => 'third-level 11 ', 'child '=> array (5 => array ('id' => 5, 'pid' => 4, 'name' => 'level 4 13 ',), 7 => array ('id' => 7, 'pid '=> 4, 'name' => 'l4 11 ',), 8 => array ('id' => 8, 'pid '=> 4, 'name' => 'level 4 12 ', 'child '=> array (10 => array ('id' => 10, 'pid' => 8, 'name' => 'Level 5 category ', 'child '=> array (11 => array ('id' => 11, 'pid' => 10, 'name' => 'Level 6 category',), 6 => array ('id' => 6, 'pid '=> 9, 'name' => 'Level 3 21 ',),),),),)
How can this array be processed into a tree structure in smarty ??
------ Solution --------------------
Is it done with JS? if smarty can do it, PHP can
------ Solution --------------------
I want to know why
------ Solution --------------------
Smarty2 is not allowed
Smarty3 is acceptable, and recursive functions in the template