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}