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

Dec 13, 2019 am 09:16 AM

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!

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

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

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1671
14
PHP Tutorial
1276
29
C# Tutorial
1256
24