Dream of the template in general is written dead, do not participate in the navigation tag loop call, so generally can not set the highlight properties, the following methods can solve this problem:
DEDECMS column navigation calls are generally like this:
The code is as follows |
Copy Code |
<li><a href= ' {dede:global.cfg_cmsurl/}/' ><span> home </span></a></li> {dede:channel type= ' top ' row= ' currentstyle= ' <li class= ' hover ' > <a href= ' ~typelink~ ' ~rel~><span>~typename~</span></a></li>} <li><a href= ' [field:typeurl/] ' [field:rel/]><span>[field:typename/]</span></a>< /li> {/dede:channel} |
If you need to achieve "home" highlighting, we need to add a section of code to determine whether the current column is the home page, if it is the first page to add highlighting CSS, if it is not added.
The code below (where current in class= ' current is your custom highlight style):
The code is as follows |
Copy Code |
{Dede:field Name=typeid runphp= "Yes"} (@me = = "")? @me = "class= ' current '": @me = ""; {/dede:field} |
The use method is:
The code is as follows |
Copy Code |
<li{dede:field Name=typeid runphp= "Yes"} (@me = = "")? @me = "class= ' current '": @me = ""; {/dede:field}><a href= ' {dede:global.cfg_cmsurl/}/' ><span> home </span></a></li> {dede:channel type= ' top ' row= ' currentstyle= "<li class= ' hover ' ><a href= ' ~typelink~ ' ~rel~><span >~typename~</span></a></li> "} <li><a href= ' [field:typeurl/] ' [field:rel/]><span>[field:typename/]</span></a>< /li> {/dede:channel} |
This way when the current page is the homepage, when the row can be highlighted.