找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 200|回复: 0

[cms教程] 让织梦dede:arclist支持notypeid属性的方法

[复制链接]

该用户从未签到

发表于 2021-9-10 08:49:53 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
织梦默认的arclist标签支持typeid的调用,也就是给文章列表指定来源栏目,有时候栏目过多,一个一个写就很复杂,所以用排除的方法写更方便,以此引入notypeid属性。
         
        主要修改文件是/include/taglib/下的arclist.lib.php文件,首先搜索:
         
        return lib_arclistDone
         
        在函数末尾加上:,$ctag->GetAtt('notypeid'),原来的代码变成如下的样子:
       
       
               
                       
                               
                                       
return lib_arclistDone
       (
         $refObj, $ctag, $typeid, $ctag->GetAtt('row')] $ctag->GetAtt('col')] $titlelen, $infolen,
         $ctag->GetAtt('imgwidth')] $ctag->GetAtt('imgheight')] $listtype, $orderby,
         $ctag->GetAtt('keyword')] $innertext, $envs['aid',, $ctag->GetAtt('idlist')] $channelid,
         $ctag->GetAtt('limit')] $flag,$ctag->GetAtt('orderway')] $ctag->GetAtt('subday')] $ctag->GetAtt('noflag')]
         $tagid,$pagesize]$isweight,
$ctag->GetAtt('notypeid')         
     );
                               
                       
               
       
然后再搜索function lib_arclistDone,同样在这个函数的后面加上一句代码:,$notypeid=0,修改后的函数变成下面的样子:


       
               
                       
                               
function lib_arclistDone(&$refObj, &$ctag, $typeid=0] $row=10] $col=1, $titlelen=30] $infolen=160]
        $imgwidth=120] $imgheight=90] $listtype='all', $orderby='default', $keyword='',
        $innertext='', $arcid=0] $idlist='', $channelid=0] $limit='', $att='', $order='desc', $subday=0] $noflag='',$tagid='', $pagesize=0] $isweight='N',$notypeid=0)
***后,搜索以下代码:$orwheres[, = ' arc.arcrank > -1 ';,在这个代码的前面加入如下代码:
if(!empty($notypeid))  
{
    $orwheres[, = " and arc.typeid NOT IN (".GetSonIds($notypeid).")";
}
                       
               
       

上传覆盖之后即可使用arclist的notypeid属性,使用方法如下:


       
               
                       
                               
{dede:arclist row=6 orderby=pubdate notypeid='7,8,9'}
                       
               
       



                               
登录/注册后可看大图



意思是按更新时间,调用除了栏目id是7,8,9的其余栏目中的6条数据。
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-10-10 17:32

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表