帝国cms相关链接无内容时调用当前栏目最热信息的方法
帝国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("[!--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");//取得相关链接模板
$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 //没有关键字的时候读取人气最高的几条信息 2013/5/17 星期五 zhuxianfei.com
{
$add="";
$tr=$empire->fetch1("select otherlinktemp,otherlinktempsub,otherlinktempdate from ".GetTemptb("enewspubtemp")." limit 1");//取得相关链接模板
$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;
}
原来的官方代码
在没有关键字的时候直接就给出
$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根据内容正文字段[newstext]批量获取描述简介字段[smalltext]的
这篇文章主要介绍了帝国CMS根据内容正文字段[newstext]批量重新生成简介字段[smalltext]的方法,需要的朋友可以参考下2023-06-26
帝国CMS 7.2和7.5适用的火车头采集免登陆发布模块配置方法详解(亲测可
帝国cms7.2版本开始增加了金刚模式,登录发布有难度。亲测可用的帝国CMS 7.2/7.5适用免登陆新闻发布模块插件配合火车采集器,可以解决这类问题。堪称完美2022-04-21帝国cms高危SQL注入漏洞(盲注)系统自带RepPIntvar过滤函数使用方法
帝国cms开发的时候要注意一些危险的注入漏洞,防止被黑,RepPIntvar为系统自带函数可以起到过滤字符的作用,下面就为大家介绍一下使用方法2021-07-26
帝国cms后台启用SESSION验证所有的登录信息都是保存在服务器端的,尤其是公共场所登录用默认的cookies是不安全的2021-07-26
最近需要将老版本的帝国cms将7.2升级到7.5版本,参考这篇文章完美升级,特分享一下给需要的朋友2020-08-02
整理了一些常用的帝国CMS调用,灵动标签和万能标签的调用方法举例,包括幻灯片、标题、一级栏目、二级栏目、带模版的友情链接(下拉菜单)、判断内容页字段为空时是如何调用2020-02-04
这篇文章主要介绍了帝国cms网站地图sitemap.xml的制作方法,需要的朋友可以参考下2020-02-04
在使用帝国cms的时候有时候需要把前台数据都更新一下,那么就可以参考下面的文章了,要不漏掉了部分就达不到更新的目地了2020-02-04
今天接到网友询问怎么修改后台登录界面及后台界面,特把方法分享出来需要的朋友可以参考下2020-02-04
最近仿站团队接到很多仿站客户订单,这里面有一个这样的功能,表单提交,今天花时间写个教程给大家,需要的朋友可以参考下2020-02-02









最新评论