Add secondary navigation to PHPCMSV9

Source: Internet
Author: User
Today, I looked at the issue that occurs when phpcms writes to the second-level navigation. The $ r [arrchildid] returned when querying the navigation bar information is inconsistent with what I imagined. in this document, the subtopic id is returned, but it is somewhat different. Today, I looked at the issue that occurs when phpcms writes to the second-level navigation. The $ r [arrchildid] returned when querying the navigation bar information is inconsistent with what I imagined. in this document, the subtopic id is returned, but it is somewhat different.

First thought:

Home page {pc: content action = "category" catid = "0" num = "10" siteid = "$ siteid" order = "listorder ASC"} {loop $ data $ r} {if $ r [arrchildid] }{$ r [catname]} {pc: content action = "category" catid = "$ r [catid]" num = "10" siteid = "$ siteid" order = "listorder ASC" return = "data2"} {loop $ data2 $ v} {$ v [catname]} {/loop} {/pc} {/if} {/loop} {/pc}

General Idea: query whether there is a subtopic id under this document. If yes, the second-level navigation is output. Row 5th in the code checks whether there is a subtopic id under this topic. However, I found that when there is no subtopic, the id of the current topic will be returned, leading to the failure of the judgment to achieve the expected results. so I changed my mind, the code is as follows:

Home page {pc: content action = "category" catid = "0" num = "10" siteid = "$ siteid" order = "listorder ASC"} {loop $ data $ r} {if $ r [arrchildid]! = $ R [catid]} {$ r [catname]} {pc: content action = "category" catid = "$ r [catid]" num = "10" siteid = "$ siteid" order = "listorder ASC" return = "data2"} {loop $ data2 $ v} {$ v [catname]} {/loop} {/pc} {else} {$ r [catname]} {/if} {/loop }{/ pc}

Determine whether the obtained subtopic id is equal to the topic id. if it is equal to or not, no subtopic is displayed. if it is not equal to or not, a subtopic is displayed.

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.