Home >CMS Tutorial >Empire CMS >How to use the empire label to highlight the current column
How to highlight the current column using the empire tag?
Use Empire custom tags to highlight the current column
After some testing, I found a method that I find convenient, and I record it here.
1. Because you need to use custom tags, you must first add a custom function to \e\class\userfun.php, that is
Recommended to study "Empire cms tutorial 》
The code is as follows:
//取得顶级栏目ID函数 function user_GetTopBclassid($classid){ global $class_r; $fr=explode('|',$class_r[$classid][featherclass]); $topbclassid=$fr[1]?$fr[1]:$classid;//取得第一级栏目id return $topbclassid; }
2. Next, use the smart label to call the navigation part, and use 5d6652f3e23d11ca2c26c39f8faa1fc5 to dynamically obtain the current Column id and parent column id.
The code is as follows:
<ul class="menu"> <li id="current"><a href="/">首页</a></li> <!--灵动标签开始--> [e:loop={'select classid,classname,classpath,bclassid,bname from [!db.pre!]enewsclass where bclassid=0 order by classid',0,24,0}] <li id="current<?=$bqr[classid]?>"><a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" title="<?=$bqr[bname]?>" target="_self" ><?=$bqr[classname]?></a></li> [/e:loop] <style type="text/css"><!--加入动态css样式--> <!-- #menu #current<?=user_GetTopBclassid($GLOBALS[navclassid])?> /*---动态获取当前栏目id -*/ {background:url(/images/2008a/bg_menu_on_left.gif) no-repeat; font-weight:bold;} #menu #current<?=user_GetTopBclassid($GLOBALS[navclassid])?> a,#menu #current<?=user_GetTopBclassid($GLOBALS[navclassid])?> a:hover{color:#000; background:url(/images/2008a/bg_menu_on_right.gif) no-repeat right;} --> </style> <!--灵动标签结束-->
3. Create a variable in the template variable, such as [!--temp.tab--] and add the code in step 2 to it, and you can display it on the homepage And the list page is called,
quotes a reply from wc in the forum 5d6652f3e23d11ca2c26c39f8faa1fc5
When it is the homepage, the current column is empty That is, when channel
is currently a first-level column, it is channel’s current column id
When there is a column that is not a first-level column, it is channel’s first-level parent column id
Valid under cover template, list template, and content template
The above is the detailed content of How to use the empire label to highlight the current column. For more information, please follow other related articles on the PHP Chinese website!