Home  >  Article  >  CMS Tutorial  >  How to highlight the current column in Empire CMS

How to highlight the current column in Empire CMS

藏色散人
藏色散人Original
2019-12-10 09:22:342109browse

How to highlight the current column in Empire CMS

How does empire cms highlight the current column?

The example in this article describes how Empire CMS uses smart tags to highlight the current column. Share it with everyone for your reference. The specific analysis is as follows:

It is recommended to study "Empire cms Tutorial"

Method 1:

Empire cms, use smart tags to highlight the current column, as follows The code is used in the header of the public template variable and is referenced by other templates. The code is as follows:

The code is as follows:

<ul class="clearfix"> 
<li><a href="[!--news.url--]" title="首页">首页</a></li> 
[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=0 order by myorder,classid asc",0,24,0}] 
<?php 
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址 
$class=""; 
if($GLOBALS[navclassid]){ 
$fcr=explode(&#39;|&#39;,$class_r[$GLOBALS[navclassid]][featherclass]); 
$topbclassid=$fcr[1]?$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的一级栏目ID 
if($bqr[classid]==$topbclassid) 
{ 
$class="selected"; 
} 
} 
?> 
<li class="<?=$class?>"><a href="<?=$classurl?>"><?=$bqr[classname]?></a></li> 
[/e:loop] 
</ul>

For the sql annotation, the column name in the enewsclass table is taken. ,$dbtbpre means table prefix, desc is used to sort the results when querying the results, in descending order, and asc is in ascending order.

Method 2:

First put the following Add the paragraph statement to the e/class/userfun.php file. The code is as follows:

The code is as follows:

//高亮当前栏目 
function currentPage($classid,$thisid){ 
global $class_r; 
$fr=explode(&#39;|&#39;,$class_r[$classid][featherclass]); 
$topbclassid=$fr[1]?$fr[1]:$classid;//取得第一级栏目id 
if ($topbclassid==$thisid) { 
echo "class=&#39;menuon&#39;"; 
} 
else { 
} 
}

The smart label calling code is as follows:

The code is as follows:

<ul> 
<li><a href="[!--news.url--]">首页</a></li> 
[e:loop={&#39;select classid,classname,classpath from [!db.pre!]enewsclass where bclassid=0 and showclass=0 order by myorder&#39;,0,24,0}] 
<li id="cid<?=$bqr[classid]?>" <?=currentPage($GLOBALS[navclassid],$bqr[classid])?>> 
<a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" title="<?=$bqr[classname]?>" target="_self" ><?=$bqr[classname]?></a> 
</li> 
[/e:loop] 
</ul>

Define css, which is ".menuon". If it is enough, you can also use "#cid*" to decide. You should understand it without explaining it. If you still don't understand it, you should learn CSS carefully. .

The above is the detailed content of How to highlight the current column in Empire CMS. 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