婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 網站建設 > 建站知識 > 修改dede源碼,讓dede:channelartlist排除指定typeid

修改dede源碼,讓dede:channelartlist排除指定typeid

POST TIME:2021-05-25 02:22

找到 include aglibchannelartlist.lib.php, 查找$attlist


$attlist = 'typeid|0,row|20,cacheid|';
修改為:
$attlist = 'typeid|0,row|20,cacheid|,notypeid|0'; [此處添加了一個所要排除typeid的參數---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");

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

//否定指定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;
}
?>
?



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 松江区| 鄂温| 修水县| 怀化市| 漳浦县| 白朗县| 顺平县| 怀集县| 青河县| 耒阳市| 四子王旗| 北京市| 原阳县| 瓦房店市| 宜丰县| 凤阳县| 安康市| 靖安县| 长垣县| 望城县| 新沂市| 琼中| 建阳市| 西和县| 高唐县| 满洲里市| 巴彦县| 斗六市| 伊吾县| 洛阳市| 柳州市| 青铜峡市| 塘沽区| 宕昌县| 彰化县| 星子县| 长垣县| 廊坊市| 那坡县| 岱山县| 淅川县|