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!!
Reply to discussion (solution)
Khan, do you know what the contents of his parents and subclasses are?
The return of the land is used to traverse it.
Bullshit Frame
CodeIgniter, who used this framework, now want to interview you, say your use after the speech! Your words all affect your back.
(LZ sorry, I have no points, can only occupy your own)
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 ...
{$vo. depa_id}
[Main Page] ';? >{$vo. Depa_title} {$vo. label_count} { $vo. Model_name} {$vo. Depa_order}
{$ SON.DEPA_ID} {$son. Depa_title} {$son. label_count} { $son. Model_name} {$son. Depa_order}
Template is not good recursion, the better way is to recursively in the program logic in the approximate tree structure, template control style.
It's not quite clear, is there a more detailed solution?
I was actually trying to achieve this effect:
Output a list of parent and child classes:
Who can teach me exactly how to do ah, thank you!
Seek expert guidance!!!!
Using the correlation model
{$vo. TypeName} {$vo. typedescription}
{$value. typename}{$value. typedescription}
This is generally done in conjunction with MySQL, usually in the database set up, first set the parent class with the child of the same field Val, and then add a child class to save the parent class ID field, and then the Web page loop out of the line
Do you still need it? I got a way!
You can refer to my filter box, and of course I want to find inspiration for using recursion. This is not far from recursion, forgive me lazy.
= = Large Address <{$vo .address_name}> <{$voa .address_name}>