Home  >  Article  >  CMS Tutorial  >  How to use the submenu label in the dedecms secondary menu

How to use the submenu label in the dedecms secondary menu

藏色散人
藏色散人Original
2019-12-28 09:27:252466browse

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=&#39;typeurl&#39;/}" class="level">{dede:field name=&#39;typename&#39;/}</a> 
{dede:global name=&#39;itemindex&#39; runphp=&#39;yes&#39;}if(@me==1)@me="<ul class=&#39;nav-submenu&#39;>"; else @me=&#39;&#39;;{/dede:global} 
{dede:channel type=&#39;son&#39;} 
<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=&#39;itemindex&#39; runphp=&#39;yes&#39;}if(@me==1)@me="</ul>";else @me=&#39;&#39;;{/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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn