Find ThinkPHP cyclically nested to print out the list of parent classes and child classes. how can this problem be solved?

Source: Internet
Author: User
Calculate the ThinkPHP nested loop by 40 minutes to print out the list of parent classes and child classes. Hello, I have been learning the thinkPHP framework recently. I want to print out a data list cyclically on the template page, the format is: first, the parent class category name, then print the corresponding subclass list, then print another parent class name, and then print the corresponding subclass of the parent class, and so on... I used table formatting. the format is as follows: & nbsp; 40: calculate ThinkPHP loop nesting to print out the list of parent and child classes.
Hello everyone, I have been studying the thinkPHP framework recently. I want to print out a data list cyclically on the template page. the format is: first, the parent category name, then print out the corresponding subclass list, then print another parent class name, then print the corresponding subclass of the parent class, and so on... I use table layout. the format is as follows:


Category name overview

  Parent class name 1......
Subclass name 1 .....
Subclass name 2 .....
Subclass name 3 .....
Parent class name 2......
Subclass name 1 .....
Subclass name 2 .....
Subclass name 3 .....


Could you tell me how to implement it with volist, or is there any better way? thank you !!


------ Solution --------------------
You can use the return Field for traversal.

------ Solution --------------------
You can try it: for the first time, I will find all parent_id and write down the total parent_count of the record set. then I will loop down with parent_count, and so on ......
------ Solution --------------------




{$ Vo. depa_id}
Echo' [Homepage]';?> {$ Vo. depa_title}
{$ Vo. label_count}
{$ Vo. model_name}
{$ Vo. depa_order}



{$ Son. depa_id}
------ Solution --------------------
-"Title ="
------ Solution --------------------
-"/> {$ Son. depa_title}
{$ Son. label_count}
{$ Son. model_name}

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.