40 min thinkphp loop nesting print out a list of parent and child classes, what to do with

Source: Internet
Author: User
40 min. thinkphp Loop nesting prints out a list of parent and child classes
Hello everybody, I am learning thinkphp frame In recent time, I want to make a data list in 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 am using form layout, format such as:


Introduction to Category names

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 .....


Ask how to achieve with volist, or there is no better way, please advise, grateful!!


------Solution--------------------
The return of the land is used to traverse it.

------Solution--------------------
You can try it: for the first time, I'll find all the parent_id. Then write down the total amount of the Recordset Parent_count, and then loop parent_count down, and so on ...
------Solution--------------------
 



{$vo. depa_id}
!--? php if ($vo [' depa_default '] = = 1)
echo ' [Main Page] ';? >{$vo. Depa_title
{$vo. Label_count}
{$vo. model_name}
{$vo. de Pa_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.