拓展channel标签实现limit功能
由于网站栏目多次需要调用同一栏目下的栏目比如顶级栏目6 下级栏目5.4.3.2.1 需要分两次分别调出543和21 感觉channel就比较吃力了全部写SQL又太多,可能是我还不知道有其他方法吧。row调用不出这种效果所以就把row改为了Limit用法了比较方便 修改文件include\taglib/下面的channel.lib.php 在函数lib_channel里面加上
//limit条件
$limit = trim(eregi_replace('limit','',$limit));
if($limit!='') $limitsql = " limit $limit ";
else $limitsql = " limit 0,7 ";
$orwhere = '';
if(isset($orwheres[0])) {
$orwhere = join(' And ',$orwheres);
$orwhere = ereg_replace("^ And",'',$orwhere);
$orwhere = ereg_replace("And[ ]{1,}And",'And ',$orwhere);
}
if($orwhere!='') $orwhere = " where $orwhere ";//二次开发
--------------------------------------------------------------------------------
把上面的代码,添加到函数lib_channel(具体位置为:)
function lib_channel(&$ctag,&$refObj)
{
global $dsql;
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$line = empty($row) ? 100 : $row;
----------------------------------------------------------
这段代码后面
所有查询条件的limit 0,$row改为$limitsql OK 保存
//limit条件
$limit = trim(eregi_replace('limit','',$limit));
if($limit!='') $limitsql = " limit $limit ";
else $limitsql = " limit 0,7 ";
$orwhere = '';
if(isset($orwheres[0])) {
$orwhere = join(' And ',$orwheres);
$orwhere = ereg_replace("^ And",'',$orwhere);
$orwhere = ereg_replace("And[ ]{1,}And",'And ',$orwhere);
}
if($orwhere!='') $orwhere = " where $orwhere ";//二次开发
--------------------------------------------------------------------------------
把上面的代码,添加到函数lib_channel(具体位置为:)
function lib_channel(&$ctag,&$refObj)
{
global $dsql;
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$line = empty($row) ? 100 : $row;
----------------------------------------------------------
这段代码后面
所有查询条件的limit 0,$row改为$limitsql OK 保存
免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。
来源:网友投稿 关注:
时间:2016-01-13 17:20
☉首先声明,只要是我们的vip会员所有源码均可以免费下载,不做任何限制(了解更多)
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
相关织梦教程:
- dedecms SQL注入漏洞 member/album_add.php 修复
- dedecms cookies泄漏导致SQL漏洞 /member/article_add
- Windows虚拟主机指定目录禁用脚本执行权限方法
- 西部数码虚拟主机设置禁止脚本执行权限
- 阿里云主机设置织梦程序禁止脚本执行权限及禁止写入
- dedecms织梦导致CPU峰值现象的解决办法
- 织梦程序网站被挂马或快照劫持终极解决办法
- 阿里云提醒/member/reg_new.php注入漏洞解决办法
- 织梦安全:更改plus名称
- 织梦栏目属性增加链接rel、nofollow和新窗口target
- 织梦问答模块PHP7报错解决方法
- dedecms解决移动端首页不自动更新问题