Today I looked at the phpcms write to level two navigation found a problem, query the navigation bar information returned $r[arrchildid] and their own imagination, the document said to return the sub-column ID but a little different.
The beginning of the idea:
<ul class= "Nav navbar-nav" >
<li class= "active" ><a href= "{SiteURL ($siteid)}" > Home </a>< /li>
{pc:content action= "category" catid= "0" num= "ten" siteid= "$siteid" order= "Listorder ASC"}
{loop $data $ R}
{if $r [Arrchildid]}
<li class= "dropdown" >
<a href= "{$r [url]}" class= "Dropdown-toggle" child = "{$r [Arrchildid]}" data-toggle= "dropdown" >{$r [catname]}<b class= "Caret" ></b></a>
< UL class= "Dropdown-menu" >
{pc:content action= "category" catid= "$r [catid]" num= "" siteid= "$siteid" order= " Listorder ASC "return=" Data2 "}
{loop $data 2 $v}
<li><a href= ' {$v [url]} ' >{$v [catname]}</a ></li>
{/loop}
{/pc}
</ul>
</li>
{/if} {
/loop} {
/PC}
</ul>
General idea: Query the document whether there is a child column ID, if there is output level two navigation. The 5th line in the code is to detect whether there is a sub column ID, but I found that when there is no sub-column will return the ID of the current column causes the judgment can not achieve the desired effect, so change the idea, the code is as follows:
<ul class= "Nav navbar-nav" >
<li class= "active" ><a href= "{SiteURL ($siteid)}" > Home </a>< /li>
{pc:content action= "category" catid= "0" num= "ten" siteid= "$siteid" order= "Listorder ASC"}
{loop $data $ R}
{if $r [Arrchildid]!= $r [CATID]}
<li class= ' dropdown ' >
<a href= ' {$r [url]} ' class= ' Dropdown-toggle "child=" {$r [Arrchildid]} "data-toggle= dropdown" >{$r [catname]}<b class= "Caret" ></b ></a>
<ul class= "Dropdown-menu" >
{pc:content action= "category" catid= "$r [catid]" num= "10" Siteid= "$siteid" order= "Listorder ASC" return= "Data2"}
{loop $data 2 $v}
<li><a href= ' {$v [url]} ' >{$v [catname]}</a></li>
{/loop}
{/pc}
</ul>
</li>
{Else}
<li><a href= "{$r [url]}" >{$r [catname]}</a></li>
{/if}
{/loop}
{/PC}
</ul>
To determine whether to get the child column ID equal to the column ID, equal to means that there is no sub column, does not mean that there is a child column and display sub columns
The above is a small set to introduce the PHPCMS V9 add two level of navigation ideas to explain, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!