Tree-type cyclic output, which has not been completed for several days. please refer to it for help.

Source: Internet
Author: User
Tree-type cyclic output, which has not been completed for several days. please refer to the database for help.

How to output
111111*121212*3232323222222222*333333**44444444***555555***werwerwer**6565656*23232323**324234234


How can a tree-like html loop be achieved by a sonclass that contains a subclass id? I will only output a layer of data that cannot be repeatedly output to such a subcategory.


Reply to discussion (solution)

You don't need a child id here. you just need a parent id. you just need to query the Child id based on classid.

With the parent id, featherclass = classid, you can get to the lower level of classid

What do you want to do ??

With the parent id, featherclass = classid, you can get to the lower level of classid


Can you write down the specific points? thank you !!

$ Class = $ this-> tclass-> get_all_class ($ this-> tbname); $ json_class = Array (); $ json_class2 = array (); foreach ($ class as $ key => $ value) {if ($ class [$ key] ['sonclass']) // if a subcategory {$ json_class [$ key] ['id'] = $ value ['classid ']; $ json_class [$ key] ['text'] = $ value ['classname']; $ son_arr = $ this-> tclass-> get_son_class ($ value ['class'], $ this-> tbname); foreach ($ son_arr as $ k => $ v) {$ json_class1 [$ k] ['id'] = $ v ['classid ']; $ json_class1 [$ k] ['text'] = $ v ['classname'];} $ json_class [$ key] ['Children '] = $ json_class1 ;}}


In this way, I can only obtain the parent and a layer of sub-classes. how can I cyclically obtain sub-classes?

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.