雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網(wǎng)!

帝國cms

當(dāng)前位置:主頁 > CMS教程 > 帝國cms >

用帝國自定義標(biāo)簽實(shí)現(xiàn)當(dāng)前欄目高亮

來源:本站原創(chuàng)|時間:2020-01-11|欄目:帝國cms|點(diǎn)擊:

一番測試下來,雪①找到了自己覺得方便的方法, 特記錄在此。
1、因?yàn)橐玫阶远x標(biāo)簽,所以首先要在\e\class\userfun.php 加入一個自定義函數(shù), 即

復(fù)制代碼
代碼如下:

//取得頂級欄目ID函數(shù)
function user_GetTopBclassid($classid){
global $class_r;
$fr=explode('|',$class_r[$classid][featherclass]);
$topbclassid=$fr[1]?$fr[1]:$classid;//取得第一級欄目id
return $topbclassid;
}

2、接下來用靈動標(biāo)簽調(diào)用導(dǎo)航部分,用<?=user_GetTopBclassid($GLOBALS[navclassid])?>動態(tài)獲取當(dāng)前欄目id以及父欄目id。

復(fù)制代碼
代碼如下:

<ul class="menu">
<li id="current"><a href="/">首頁</a></li>
<!--靈動標(biāo)簽開始-->
[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"><!--加入動態(tài)css樣式-->
<!--
#menu #current<?=user_GetTopBclassid($GLOBALS[navclassid])?> /*---動態(tài)獲取當(dāng)前欄目id -*/
{background:url(/images/2008a/bg_menu_on_left.gif) no-repeat; font-weight:bold;}
#menu #current<?=user_GetTopBclassid($GLOBALS[navclassid])?> a,#menu&nbsp;#current<?=user_GetTopBclassid($GLOBALS[navclassid])?> a:hover{color:#000; background:url(/images/2008a/bg_menu_on_right.gif) no-repeat right;}
-->
</style>
<!--靈動標(biāo)簽結(jié)束-->


3、在模板變量中制作一個變量, 如 [!--temp.tab--] 在其中加入第2步的代碼, 就可以在首頁及列表頁調(diào)用啦,

引用wc在論壇的一個回復(fù) <?=user_GetTopBclassid($GLOBALS[navclassid])?>
當(dāng)為首頁的時候當(dāng)前欄目是為空即channle
當(dāng)前為一級欄目時,則為channle當(dāng)前欄目id
當(dāng)有欄目為非一級欄目,則為channle一級父欄目id

封面模板、列表模板、內(nèi)容模板下都有效

上一篇:帝國Cms 分配欄目管理權(quán)限的設(shè)置教程

欄    目:帝國cms

下一篇:帝國cms網(wǎng)站管理系統(tǒng)V4.7 DIGG的實(shí)現(xiàn)(頂踩實(shí)現(xiàn))

本文標(biāo)題:用帝國自定義標(biāo)簽實(shí)現(xiàn)當(dāng)前欄目高亮

本文地址:http://www.jygsgssxh.com/a1/diguocms/12583.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有