手机
当前位置:查字典教程网 >CMS教程 >帝国cms >帝国cms相关链接无内容时调用当前栏目最热信息的方法
帝国cms相关链接无内容时调用当前栏目最热信息的方法
摘要:帝国cms相关链接,这里以帝国cms7.0为例具体代码在/e/class/functions.php$keyboardtext='';可以看...

帝国cms相关链接,这里以帝国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])?>';可以看到相关链接的信息是通过GetKeyboard得到,找到 GetKeyboard修改一下就可以了,也是在/e/class/functions.php

//取得相关链接

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");//取得相关链接模板

$temp_r=explode("[]",$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('[]',$i,$text);

$text=str_replace('[]',$link_r[state],$text);

$text=str_replace('[]',$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");//取得相关链接模板

$temp_r=explode("[]",$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('[]',$i,$text);

$text=str_replace('[]',$link_r[state],$text);

$text=str_replace('[]',$link_r[lastvolume],$text);

$keyboardtext.=$text;

//$keyboardtext.=RepOtherTemp($temp_r[1],$link_r,$tr);

}

$keyboardtext=$temp_r[0].$keyboardtext.$temp_r[2];

}

else //没有关键字的时候读取人气最高的几条信息 2013/5/17 星期五 zhuxianfei.com

{

$add="";

$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相关链接模板

$temp_r=explode("[]",$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('[]',$i,$text);

$text=str_replace('[]',$link_r[state],$text);

$text=str_replace('[]',$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;

}

原来的官方代码

在没有关键字的时候直接就给出

$keyboardtext=$fun_r['NotLinkNews'];

这显示无相关信息

我做了一个无keyid的时候再去获取一次keyid,

$keyid=GetKeyid($keyboard,$classid,0,$link_num);

确实没有关键字的时候读取人气最高的几条信息

$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");

【帝国cms相关链接无内容时调用当前栏目最热信息的方法】相关文章:

帝国CMS使用二级域名并解决顶一下的方法

帝国cms灵动标签里的序号实现方法

帝国ECMS注册会员去掉“选择注册会员类型”的方法

帝国cms 二级域名绑定栏目的最完美的解决方案

帝国CMS订单、反馈信息、投稿与留言发邮件通知管理员的方法

帝国cms的灵动标签判断栏目ID的方法

帝国CMS实现反馈信息内容发送到邮箱的方法

帝国cms 封面模板标题调用栏目别名的方法

帝国CMS根据不同会员组显示不同内容的方法

帝国cms安装在二级目录步骤

精品推荐
分类导航