Php advanced implementation of unlimited Classification 4. 4. path tracking ------------------------------------------------------------ describes how to create a category. the rout_id and rout_char are recorded in the classification table. path tracing ---------------------------------------------------------- describes how to create a category. in the classification table, information about the two storage paths rout_id and rout_char is recorded without any processing, the program can only be sorted to the bottom-layer classification and cannot be regressed (of course, the back key of the browser can be used for regressing, but this is incomplete for the program ), therefore, the information of rout_id and rout_char must be decomposed to complete the actual path indication. the specific procedure is as follows: id: 4 uid: 2 type: development tool rout _ Id: 0: 1: 2: 4 rout_char: System: linux: development tool when the program goes to the classification development tool, in addition to displaying the path information, you must be able to go to any category on the path. how can this problem be solved? The explode () function is used here. because rout_id corresponds to rout_char, you can break them down: $ path = explode (":", $ rout_id); $ path_gb = explode (":", $ rout_char); at this time, all the classification information is broken down. now, we need to restore the path information in a link: for ($ I = 0; $ I ++) {$ a = $ I + 1; echo "", $ path_gb [$ I], ":"; if (empty ($ path_gb [$ I]) {break ;}} the code above implements the link restoration path function, because there is no limit to the implementation of unlimited classification, therefore, there is no range limit in for ($ I = 0; $ I ++), and the condition for setting loop exit is that the value in $ path_gb [$ I] is null, insert this code into the program block of the category display layout: After this function block is completed, you can continue to display the classification information... <全文完>
Before ------------------------------------------------------------ I have already introduced how to create a category. in the classification table, the rout_id and rout_char are recorded...