帝国cms相关链接无内容时调用当前栏目最热信息
更新时间:2013年5月17日 22:51 点击:1399
帝国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");
上一篇: 返回列表
相关文章
- 是否提取 getfirsttitlepic 1 缩略图宽度 getfirsttitlespicw 105 缩略图高度 getfirsttitlespich 118...2014-10-17
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 帝国CMS显示指定时间内更新的信息数...2016-11-01
- 用灵动标签(e:loop)可以实现各种幻灯效果,本节讲解制作幻灯的基本方法。 如本站JS焦点图频道里的大部分幻灯图片效果都可以用灵动标签调用的。 ...2015-12-30
帝国CMS把[!--list.pageno--]就替换成“第[!--list.pageno--]页
/*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 打开:e\class\functions.php 修改 $s...2017-07-06- 刚升级一会就出现 Multiple primary key definedalter table ***_ecms_infoclass_shop change classid classid int(10) unsigned NOT NULL default '0', DROP INDEX clas...2013-05-20
帝国CMS登录后台提示"您的Cookie没有开启,不能登陆成功"的解决方法
如果没有动过文件特别是/e/config/config.php文件的话!请按照如下操作肯定就OK了! 到你的主机或者服务器环境里找到php.ini文件(如果不知道在哪联系你的空间商就行了) 找到如下...2016-05-19- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 用灵动标签调用最新最多评论文章: [...2016-08-27
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) php随机文章 方法1、WC写的高效随...2017-07-06
- 帝国CMS安装以及恢复数据模板视频教程,主要讲解了墨鱼出品的帝国CMS源码的安装以及数据库模板的回复过程,请大家注意视频里的一些操作细节。选择超清模式播放!...2016-05-08
帝国CMS灵动标签调用当前父栏目下所有子栏目-支持选中状态/高亮
帝国CMS实现灵动标签调用当前父栏目下所有子栏目-支持选中状态及当前栏目高亮,支持栏目自定义排序。最适用于内容模板,显示父栏目下的子栏目。 支持静态栏目页与动态栏目页 代...2016-05-19- 商品加入购物车链接地址为:[!--news.url--]e/ShopSys/doaction.php?enews=AddBuycar&classid=[!--classid--]&id=[!--id--]...2015-12-30
- 给帝国CMS任意模型加上百度地图标注功能。 第一步:首先在模型建立三个字段: 字段名:map_x 字段类型:DOUBLE 字段名:map_y 字段类型:DOUBLE 字段名:map_z 字段类型:TINYINT...2016-05-19
- 针对帝国CMS7.0:有得同学开启了后台登陆验证码,但是由于种种原因后台验证码没有显示,然而不填写验证码又无法登陆后台关闭后台验证码,墨鱼给同学们一个解决方案用工具(一定要用工...2016-05-08
- 因为帝国CMS 7.0信息页不再有ztid字段,所以直接是查询不到的,但是可以用灵动标签sql调用,具体调下方法如下:灵动标签sql调用:select ztid from phome_enewsztinfo where classid=...2015-12-30
- 任意页面动态调用购物车数量,不用刷新数据。 同时适用于帝国CMS6.6、7.0 新建一个buycarjs.php文件放在/e/shopsys/buycar/下,代码如下: <?phprequire("../../class/co...2016-05-19
- 您是不是期待此插件很久了,帝国论坛上终于有用户开发出来了,首先非常感谢他,在此我整理收集了过来,此插件非常适合一些信息发布的站点使用,如果您正好有此类站点,不凡试试看或许能...2015-12-30
- 6、下载不采用弹出窗口式说明 ...2016-05-19
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 帝国cms简单修改实现TAGS以TAGID的方...2016-08-27
- 帝国CMS功能确实非常强大。但为啥子做个单页面就这么麻烦呢。 在论坛找了很久,一般来有以下几个方法: 一、其实栏目有个“页面内容式”。但悲催的是居然不支持绑...2016-05-19
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 如下图所示,先填写购买数量,再添加购物...2016-11-01