帝國cms相關(guān)鏈接無內(nèi)容時調(diào)用當(dāng)前欄目最熱信息的方法

帝國cms相關(guān)鏈接,這里以帝國cms 7.0為例具體代碼 在/e/class/functions.php
$keyboardtext='<?=GetKeyboard($ecms_gr[keyboard],$ecms_gr[keyid],$ecms_gr[classid],$ecms_gr[id],$class_r[$ecms_gr[classid]][link_num])?>';可以看到相關(guān)鏈接的信息是通過GetKeyboard得到,找到 GetKeyboard修改一下就可以了,也是在/e/class/functions.php
//取得相關(guān)鏈接
function GetKeyboard($keyboard,$keyid,$classid,$id,$link_num){
global $empire,$public_r,$class_r,$fun_r,$dbtbpre;
if($keyid&&$link_num)
{
$add="id in (".$keyid.")";
$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相關(guān)鏈接模板
$temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]);
$key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic,lastvolume from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num");
while($link_r=$empire->fetch($key_sql))
{
//=========================================================2012-12-25 4usky.com
$text=RepOtherTemp($temp_r[1],$link_r,$tr);
$text=str_replace('[!--no--]',$i,$text);
$text=str_replace('[!--state--]',$link_r[state],$text);
$text=str_replace('[!--lastvolume--]',$link_r[lastvolume],$text);
$keyboardtext.=$text;
//$keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr);
}
$keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2];
}
else
{
//-------------生成的時候加載一次keyid zhuxianfei.com 2013/5/17 星期五
$keyid=GetKeyid($keyboard,$classid,0,$link_num);
if($keyid)
{
$fsql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]."_data_1 set keyid='$keyid' where id='$id'");
$add="id in (".$keyid.")";
$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相關(guān)鏈接模板
$temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]);
$key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic,lastvolume from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num");
while($link_r=$empire->fetch($key_sql))
{
//=========================================================2012-12-25 4usky.com
$text=RepOtherTemp($temp_r[1],$link_r,$tr);
$text=str_replace('[!--no--]',$i,$text);
$text=str_replace('[!--state--]',$link_r[state],$text);
$text=str_replace('[!--lastvolume--]',$link_r[lastvolume],$text);
$keyboardtext.=$text;
//$keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr);
}
$keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2];
}
else //沒有關(guān)鍵字的時候讀取人氣最高的幾條信息 2013/5/17 星期五 zhuxianfei.com
{
$add="";
$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相關(guān)鏈接模板
$temp_r=explode("[!--empirenews.listtemp--]",$tr[otherlinktemp]);
$key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic,lastvolume from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where order by onclick desc limit $link_num");
while($link_r=$empire->fetch($key_sql))
{
//=========================================================2012-12-25 4usky.com
$text=RepOtherTemp($temp_r[1],$link_r,$tr);
$text=str_replace('[!--no--]',$i,$text);
$text=str_replace('[!--state--]',$link_r[state],$text);
$text=str_replace('[!--lastvolume--]',$link_r[lastvolume],$text);
$keyboardtext.=$text;
//$keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr);
}
$keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2];
}
//----------------------------------------------------------------------------------------------
//$keyboardtext=$fun_r['NotLinkNews'];
}
return $keyboardtext;
}
原來的官方代碼
在沒有關(guān)鍵字的時候直接就給出
$keyboardtext=$fun_r['NotLinkNews'];
這顯示無相關(guān)信息
我做了一個無keyid的時候再去獲取一次keyid,
$keyid=GetKeyid($keyboard,$classid,0,$link_num);
確實(shí)沒有關(guān)鍵字的時候讀取人氣最高的幾條信息
$key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic,lastvolume from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where order by onclick desc limit $link_num");
相關(guān)文章
帝國CMS根據(jù)內(nèi)容正文字段[newstext]批量獲取描述簡介字段[smalltext]的
這篇文章主要介紹了帝國CMS根據(jù)內(nèi)容正文字段[newstext]批量重新生成簡介字段[smalltext]的方法,需要的朋友可以參考下2023-06-26帝國CMS 7.2和7.5適用的火車頭采集免登陸發(fā)布模塊配置方法詳解(親測可
帝國cms7.2版本開始增加了金剛模式,登錄發(fā)布有難度。親測可用的帝國CMS 7.2/7.5適用免登陸新聞發(fā)布模塊插件配合火車采集器,可以解決這類問題??胺Q完美2022-04-21帝國cms高危SQL注入漏洞(盲注)系統(tǒng)自帶RepPIntvar過濾函數(shù)使用方法
帝國cms開發(fā)的時候要注意一些危險(xiǎn)的注入漏洞,防止被黑,RepPIntvar為系統(tǒng)自帶函數(shù)可以起到過濾字符的作用,下面就為大家介紹一下使用方法2021-07-26- 帝國cms后臺啟用SESSION驗(yàn)證所有的登錄信息都是保存在服務(wù)器端的,尤其是公共場所登錄用默認(rèn)的cookies是不安全的2021-07-26
帝國CMS7.2版升級到7.5版的詳細(xì)步驟方法(已測)
最近需要將老版本的帝國cms將7.2升級到7.5版本,參考這篇文章完美升級,特分享一下給需要的朋友2020-08-02帝國cms常用標(biāo)簽調(diào)用方法(靈動標(biāo)簽和萬能標(biāo)簽的調(diào)用方法)
整理了一些常用的帝國CMS調(diào)用,靈動標(biāo)簽和萬能標(biāo)簽的調(diào)用方法舉例,包括幻燈片、標(biāo)題、一級欄目、二級欄目、帶模版的友情鏈接(下拉菜單)、判斷內(nèi)容頁字段為空時是如何調(diào)用2020-02-04帝國cms網(wǎng)站地圖sitemap.xml的制作方法
這篇文章主要介紹了帝國cms網(wǎng)站地圖sitemap.xml的制作方法,需要的朋友可以參考下2020-02-04帝國CMS數(shù)據(jù)更新中心設(shè)置教程(更新網(wǎng)站細(xì)節(jié))
在使用帝國cms的時候有時候需要把前臺數(shù)據(jù)都更新一下,那么就可以參考下面的文章了,要不漏掉了部分就達(dá)不到更新的目地了2020-02-04- 今天接到網(wǎng)友詢問怎么修改后臺登錄界面及后臺界面,特把方法分享出來需要的朋友可以參考下2020-02-04
- 最近仿站團(tuán)隊(duì)接到很多仿站客戶訂單,這里面有一個這樣的功能,表單提交,今天花時間寫個教程給大家,需要的朋友可以參考下2020-02-02