Php advanced implementation of unlimited classification 4_PHP tutorial

Source: Internet
Author: User
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...

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.