栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > dedecms

拓展channel标签实现limit功能

dedecms 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

拓展channel标签实现limit功能

由于网站栏目多次需要调用同一栏目下的栏目比如顶级栏目6 下级栏目5.4.3.2.1 需要分两次分别调出543和21 感觉channel就比较吃力了全部写SQL又太多,可能是我还不知道有其他方法吧。row调用不出这种效果所以就把row改为了Limit用法了比较方便 修改文件includetaglib/下面的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 保存
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/9136.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号