梦幻好运11选5,专注郑州seo,郑州网站优化,百度seo优化,提供免费seo诊断方案。seo外包照料QQ:931519643,电话15617834052。
Loading
0

修改dede源码,让dede:channelartlist扫除指定typeid

好运11选5找到 \include\taglib\channelartlist.lib.php, 查找$attlist


$attlist = 'typeid|0,row|20,cacheid|';
修改为:
$attlist = 'typeid|0,row|20,cacheid|,notypeid|0'; [此处添加了一个所要扫除typeid的参数---notypeid]

查找:
好运11选5 $dsql->SetQuery("Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath from `dede_arctype` where $tpsql order by sortrank asc limit $totalnum");

在其前面添加(注重是在前面添加):

//否认指定ID
if($notypeid!=0) {
$tpsql = $tpsql."and not(id in($notypeid)) ";
}

模板挪用:
{dede:channelartlist typeid ='114' notypeid='123,124,125,126,127,128'}
其中notypeid='123,124,125,126,127,128' 中的 123,124,125,126,127,128为114的子栏目

修改后的channelartlist.lib.php

<?php

if(!defined('DEDEINC')) exit('Request Error!');

require_once(DEDEINC.'/arc.partview.class.php');

function lib_channelartlist(&$ctag,&$refObj)

{

global $dsql,$envs,$_sys_globals;

//处置赏罚标志属性、innertext

$attlist = 'typeid|0,row|20,cacheid|,notypeid|0';

FillAttsDefault($ctag->CAttribute->Items,$attlist);

extract($ctag->CAttribute->Items, EXTR_SKIP);

$innertext = trim($ctag->GetInnerText());

$artlist = '';

//读取牢靠的缓存块

$cacheid = trim($cacheid);

if($cacheid !='') {

$artlist = GetCacheBlock($cacheid);

if($artlist!='') return $artlist;

}

if(empty($typeid))

{

$typeid = ( !empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0 );

}

if($innertext=='') $innertext = GetSysTemplets('part_channelartlist.htm');

$totalnum = $row;

if(empty($totalnum)) $totalnum = 20;

//获得种别ID总数的信息

$typeids = array();

if($typeid==0 || $typeid=='top') {

$tpsql = " reid=0 And ispart<>2 And ishidden<>1 And channeltype>0 ";

}

else

{

if(!ereg(',',$typeid)) {

$tpsql = " reid='$typeid' And ispart<>2 And ishidden<>1 ";

}

else {

$tpsql = " id in($typeid) And ispart<>2 And ishidden<>1 ";

}

}

//否认指定ID

if($notypeid!=0) {

$tpsql = $tpsql."and not(id in($notypeid)) ";

}

$dsql->SetQuery("Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath

from `dede_arctype` where $tpsql order by sortrank asc limit $totalnum");

$dsql->Execute();

while($row = $dsql->GetArray()) {

$typeids[] = $row;

}

if(!isset($typeids[0])) return '';

$GLOBALS['itemindex'] = 0;

$GLOBALS['itemparity'] = 1;

for($i=0;isset($typeids[$i]);$i++)

{

$GLOBALS['itemindex']++;

$pv = new PartView($typeids[$i]['id']);

$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);

$pv->SetTemplet($innertext,'string');

$artlist .= $pv->GetResult();

$GLOBALS['itemparity'] = ($GLOBALS['itemparity']==1 ? 2 : 1);

}

//注销情形变量,以防止后续挪用中被使用

$GLOBALS['envs']['typeid'] = $_sys_globals['typeid'];

$GLOBALS['envs']['reid'] = '';

if($cacheid !='') {

WriteCacheBlock($cacheid, $artlist);

}

return $artlist;

}

?>

?

本站文章均来自互联网,若有侵权请实时联系郑州seo。并发送侵权证实至邮箱931519643@qq.com,证实后连忙删除。
鞭笞我吧!鞭笞我吧! 鞭笞我吧!鞭笞我吧!

若是你以为不错,不如打赏一下!

最后编辑于:2019/5/7作者: 王鹏飞SEO

好运11选5王鹏飞seo,专注郑州SEO网站优化,分享百度SEO优化知识,提供免费seo优化方案。

暂无谈论

揭晓谈论

电子邮件地址不会被果真。 必填项已用*标注

arrow grin ! ? cool roll eek evil razz mrgreen smile oops lol mad twisted wink idea cry shock neutral sad ???

扫一扫,获取免费seo诊断!

好运11选5扫一扫,获取免费seo诊断!