Home > CMS Tutorial > Empire CMS > How to use the empire label to highlight the current column

How to use the empire label to highlight the current column

藏色散人
Release: 2019-12-13 09:16:08
Original
2469 people have browsed it

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; 
}
Copy after login

2. Next, use the smart label to call the navigation part, and use 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={&#39;select classid,classname,classpath,bclassid,bname from [!db.pre!]enewsclass where bclassid=0 order by classid&#39;,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> 
<!--灵动标签结束-->
Copy after login

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template