Questions about array parsing in the smarty Template

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.