search
HomeCMS TutorialEmpire CMSHow to use the empire label to highlight the current column

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 =user_GetTopBclassid($GLOBALS[navclassid])?> 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> 
<!--灵动标签结束-->

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 =user_GetTopBclassid($GLOBALS[navclassid])?>

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.