Phpcms V9 Add level two navigation ideas

Source: Internet
Author: User
Today read Phpcms write to level two navigation when found point problem, query navigation bar information returned when the $r[arrchildid] and their imagination, the document is returned sub-column ID but a little different.

The beginning of the idea:

Home

{pc:content action= "category" catid= "0" num= "siteid=" $siteid "order=" Listorder ASC "} {Loop $data $r} {if $r [Arrchildid]} {$r [catname]} {pc:content action= "category" catid= "$r [catid]" num= "siteid=" $siteid "order=" Listorder ASC "return=" Data2 "} {Loop $data 2 $v} {$v [catname]} {/loop} {/PC} {/if} {/loop} {/PC}

General idea: Query whether there is a sub-column ID under the document, if any, output level two navigation. The 5th line in the code is to detect if there is a sub-column ID in the column, but I found that when there is no sub-column will return the current column ID resulting in the judgment can not achieve the desired effect, so change the idea, the code is as follows:

Home

{pc:content action= "category" catid= "0" num= "siteid=" $siteid "order=" Listorder ASC "} {Loop $data $r} {if $r [arrchildid]! = $r [CATID]} {$r [catname]} {pc:content action= "category" catid= "$r [catid]" num= "siteid=" $siteid "order=" Listorder ASC "return=" Data2 "} {Loop $data 2 $v} {$v [catname]} {/loop} {/PC} {Else} {$r [catname]} {/if} {/loop} {/PC}

Determines whether the obtained sub-column ID is equal to the column ID, is equal to the absence of sub-columns, does not mean that there are sub-columns and display sub-columns

The above is a small series to introduce you to the Phpcms V9 add two-level navigation of the idea of detailed, I hope that we have some help, if you have any questions please give me a message, small series will promptly reply to you. Thank you very much for the support of the Scripting House website!

Related articles:

How to set the title of Phpcms V9 SEO

Phpcms V9 two times development and use of various problem solving solutions

Phpcms V9 two times how to develop custom paging functions

  • 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.