DEDE怎么挪用父栏目名称,DEDE挪用子栏目里的父栏目名称
怎么在dede栏目列表可能dede子栏目列表挪用DEDE挪用父栏目名称? 要领如下: 新建一个php文件,定名为:parentcannel.lib.php,然后在此文件写入以下代码:
<?php { global $_sys_globals,$dsql; $attlist = "row|100,nosonmsg|,col|1"; FillAttsDefault($ctag->CAttribute->Items,$attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = $ctag->GetInnerText();
$reid = 0; $topid = 0; //假如属性里没指定栏目id,从引用类里获取栏目信息 if(empty($typeid)) { if( isset($refObj->TypeLink->TypeInfos['id']) ) { $typeid = $refObj->TypeLink->TypeInfos['id']; $reid = $refObj->TypeLink->TypeInfos['reid']; $topid = $refObj->TypeLink->TypeInfos['topid']; } else { $typeid = 0; } } //假如指定了栏目id,从数据库获取栏目信息 else { $row2 = $dsql->GetOne("SELECT * FROM `dede_arctype` WHERE "); $typeid = $row2['id']; $reid = $row2['reid']; $topid = $row2['topid']; $issetInfos = true; }
FROM `dede_arctype` WHERE reid='$typeid' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 1"; $dsql->SetQuery($sql); $dsql->Execute(); $totalRow = $dsql->GetTotalRow();
//And id<>'$typeid' $row = $dsql->GetOne("SELECT id,typename,reid,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE "); if(!is_array($row)) return ''; if($totalRow==0){ $typeid = $row['reid']; $row = $dsql->GetOne("SELECT id,typename,reid,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE "); if(!is_array($row)) return ''; } if(trim($innertext)=='') $innertext = GetSysTemplets("part_type_list.htm");
$dtp->SetNameSpace('field','[',']'); $dtp->LoadSource($innertext); if(!is_array($dtp->CTags)) { unset($dtp); return ''; } else { $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row); foreach($dtp->CTags as $tagid=>$ctag) { if(isset($row[$ctag->GetName()])) $dtp->Assign($tagid,$row[$ctag->GetName()]); } $revalue = $dtp->GetResult(); unset($dtp); return $revalue; } } ?> 然后在htm模板文件里用以下代码举办挪用:-598080707.net
{dede:parentchannel}[field:typename/]{/dede:parentchannel} 此要领可以用在栏目列表页中按照是否有下级栏目表现父级栏目名称。 注:想相识更多更好的站长信息资源请上 织梦喜爱者
责任编辑:艾山站长
|