Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18

织梦artlist标签增加notypeid属性过滤掉某些栏目

dedecms教程:织梦教程artlist标签增加notypeid属性过滤掉某些栏目!最近在对自己做的小站的栏目进行扩展和细分,由原来的七个一级栏目变成十二个一级栏目,每个一级栏目再细分为四到八个二级栏目,以便更好的管理内容。

dedecms教程:织梦教程artlist标签增加notypeid属性过滤掉某些栏目!最近在对自己做的小站的栏目进行扩展和细分,由原来的七个一级栏目变成十二个一级栏目,每个一级栏目再细分为四到八个二级栏目,以便更好的管理内容。

但我遇到了一个问题,其中一个栏目我不想让它在首页的最新文章列表中显示,按照织梦现有的办法,就是在arclist标签的typeid属性里把想显示文章的栏目ID全部设置上,但这样做栏目ID太多了,以后维护起来也麻烦。

于是我想既然arclist支持flag和noflag,那么应该也要支持typeid 和notypeid吧?经过一番测试,再跟踪了一下源码,发现织梦并不支持notypeid,那怎么办?

打开/include/taglib/arclist.lib.php文件,找这段代码(大概在130行):

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')

然后再找到这一段代码(大概在168行):

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 type='image.' imgwidth='108' imgheight='150' channelid='1' notypeid='9'}
温馨提示:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA赞赏
共{{data.count}}人
人已赞赏
编程技巧

PbootCMS报错提示PHP Warning: Unknown: open_basedir restriction

2021-11-8 0:00:00

编程技巧

EcShop如何指定某些商品的价格显示为“面议”

2021-11-10 0:00:00

0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索