Form output and table output for unlimited Classification

Source: Internet
Author: User
// Obtain the infinitus category of the SELECT statement $ all data of Data $ PID parent level ID. The third is the default value. The fourth is the interval.
Public Function gettree_select ($ data, $ PID, $ default, $ space) {$ html = ''; $ space_nbsp =''; $ nbsp = "& nbsp; & nbsp; "; if ($ space) {for ($ I = 0; $ I <$ space; $ I ++) {$ space_nbsp. = $ nbsp;} $ space_nbsp. = 'privacy-';} else {$ space_nbsp = '';} $ space ++; foreach ($ data as $ k => $ V) {if ($ V ['adpid '] = $ PID) {if ($ default = $ V ['adsortid']) {$ selected = 'selected = "selected" ';} else {$ selected = '';} $ HTML. = "<option $ Sel Ected> ". $ space_nbsp. $ V ['subobject']. "</option>"; $ HTML. = $ this-> gettree_select ($ data, $ V ['adsortid'], $ default, $ space) ;}return $ HTML;} public function is_sub ($ data, $ PID) {$ bean = 0; foreach ($ data as $ k => $ v) {if ($ V ['adpid '] = $ PID) {$ bean = 1 ;}}return $ bean;} // use the tr class_one in the obtained table to indicate that class_two with an expanded graph is the public function gettree_tr without an expanded graph ($ data, $ PID, $ space) {$ html = ''; $ class_one = 'class =" t Dbg "'; $ class_two = 'class =" tdbg1 "'; $ class = $ class_one; $ padding = 15; $ space_nbsp =''; $ nbsp = "& nbsp; & nbsp; "; if ($ space) {$ class = $ class_two; if ($ space> 1) {$ p_left = $ padding * $ space; $ p_left. = 'px '; $ space_nbsp = "style = 'margin-left: $ p_left'";} else {$ space_nbsp = "style = 'margin-left: 15px '";}} else {$ space_nbsp ='';} $ space ++; foreach ($ data as $ K =>$ V) {if ($ V ['adpid '] ==$ PID) {if ($ this-> is_s UB ($ data, $ V ['adsortid']) | $ pid = 0) {$ class = $ class_one;} else {$ class = $ class_two ;} $ HTML. = '<tr> <TD> '. $ V ['adsortid']. '</TD> <TD align = "Left"> <strong> <span '. $ class. ''. $ space_nbsp. '> '. $ V ['subobject']. '</span> </strong> </TD> <a href = "/Goods/AD/adcat_add.html? Adsortid = '. $ V ['adsortid'].' "> modify </a> | <a href ="/Goods/AD/adcat_delete.html? Adsortid = '. $ V ['adsortid'].' "onclick =" Return confirm (\ 'Are you sure you want to delete it? \ ') "> Delete </a> </TD> </tr>'; $ HTML. = $ this-> gettree_tr ($ data, $ V ['adsortid'], $ space) ;}} return $ HTML ;}

 

Form output and table output for unlimited Classification

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.