Home >CMS Tutorial >DEDECMS >How to use the submenu label in the dedecms secondary menu
How to determine the submenu label in the dedecms secondary menu?
I recently worked on a project that required the use of the secondary menu of dedecms. In it, I needed to determine which first-level menus had submenus. Some of them would display pop-up drop-down boxes, and others would not. You can Use js to implement it, but if you haven’t used js for a long time, you will almost forget it, so you can simply use dedecms’ own tags to make a judgment. The code is as follows.
The code is as follows:<ul id="nav">
<li><a href="{dede:global.cfg_cmsurl/}/">Home</a></li>
{dede:channelartlist typeid={dede:field.typeid/}
<li>
<a href="{dede:field name='typeurl'/}" class="level">{dede:field name='typename'/}</a>
{dede:global name='itemindex' runphp='yes'}if(@me==1)@me="<ul class='nav-submenu'>"; else @me='';{/dede:global}
{dede:channel type='son'}
<li class="level0 nav-[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]"><a href="[field:typelink/]"><span>[field:typename/]</span></a></li>
{/dede:channel}
{dede:global name='itemindex' runphp='yes'}if(@me==1)@me="</ul>";else @me='';{/dede:global}
</li>
{/dede:channelartlist}
</ul>
The itemindex is required for the top-level column. It is known that only the first column has a drop-down menu, and the itemindex is incrementally increased from 1, so when itemindex=1 It is the column that needs to display the secondary menu
The above is the detailed content of How to use the submenu label in the dedecms secondary menu. For more information, please follow other related articles on the PHP Chinese website!