找到 include/taglib/type.lib.PHP,复制, 重命名为 toptype.lib.PHP
查找 function lib_type(&$ctag,&$refObj)
修改为:
function lib_toptype(&$ctag,宋体;"> 查找 $row = $dsql->Getone
注释掉 //$row = $dsql->Getone("Select ID,topID,description,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typelitpic From `dede_arctype` where ID='$typeID' ");
添加3行:
$topID=$dsql->Getone("Select topID From `dede_arctype` where ID='$typeID' ");
$topID=$topID['topID'];
$row=$dsql->Getone("Select ID,typelitpic From `dede_arctype` where ID='$topID' ");
模板调用: {dede:toptype}[fIEld:typename/]{/dede:toptype}
修改后的toptype.lib.PHP
if
@H_502_32@(!defined('DEDEINC'
@H_502_32@))exit
@H_502_32@('Request Error!'
@H_502_32@);function
@H_502_32@lib_toptype(&$ctag
@H_502_32@,&$refObj
@H_502_32@) @H_502_32@{
global
$dsql
$envs
@H_502_32@;
$attList
@H_502_32@='typeID|0'
@H_502_32@;@H_502_32@FillAttsDefault(
->CAttribute->Items,monospace !important; padding: 0px !important; margin: 0px !important; color: black !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; wIDth: auto !important; Box-sizing: content-Box !important; Font-size: 1em !important; background: none !important;">);
extract(
$innertext
@H_502_32@= trim(->GetInnerText());
(
$typeID
@H_502_32@==0) {
$typeID
@H_502_32@= ( isset(->Typelink->TypeInfos[
'ID'
@H_502_32@]) ?] :
[
'typeID'
@H_502_32@] );}
(
empty
@H_502_32@))return
''
@H_502_32@;
//$row = $dsql->Getone("Select ID,typelitpic From `dede_arctype` where ID='$typeID' ");
$topID
@H_502_32@=->Getone(
"Select topID From `dede_arctype` where ID='$typeID' "
@H_502_32@);'topID'
@H_502_32@];$row
"Select ID,typelitpic From `dede_arctype` where ID='$topID' "
@H_502_32@);
(!
is_array
@H_502_32@;]==0){
]=
];}
(trim(
$innertext
@H_502_32@)==)
= GetSystemplets(
"part_type_List.htm"
@H_502_32@);
$dtp
@H_502_32@=new
@H_502_32@DedeTagParse();$dtp
@H_502_32@->SetnameSpace('fIEld'
'['
']'
@H_502_32@);->LoadSource(
);
->CTags))
{
@H_502_32@unset(
);
;
}
else
{
'typelink'
@H_502_32@] ='typeurl'
@H_502_32@] = GetoneTypeUrlA();
foreach
@H_502_32@->CTagsas
$tagID
@H_502_32@=>)
{
(isset(
[
->Getname()]))
->Assign(
->Getname()]);
}
$revalue
@H_502_32@=->GetResult();
);
return
$revalue
@H_502_32@;}
@H_502_32@}@H_502_32@?>
@H_502_32@如果想获取任一栏目的上级栏目,可将topID---->改为--->reID,最后记得改函数名和文件名
retype.lib.PHP
@H_502_32@ @H_502_32@(!defined(
))
(
);
function
lib_retype(&
@H_419_428@,monospace !important; padding: 0px !important; margin: 0px !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; wIDth: auto !important; Box-sizing: content-Box !important; Font-size: 1em !important; background: none !important;">) @H_502_32@{ @H_502_32@global
@H_419_428@;=
;
FillAttsDefault(
@H_419_428@->CAttribute->Items,monospace !important; padding: 0px !important; margin: 0px !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; wIDth: auto !important; Box-sizing: content-Box !important; Font-size: 1em !important; background: none !important;">); extract($innertext
= trim(
@H_419_428@->GetInnerText());(
@H_419_428@==0) {$typeID
= ( isset(
@H_419_428@->Typelink->TypeInfos[]) ?
@H_419_428@] : @H_419_428@[] );
}
(
))
return
;
$reID
=
@H_419_428@->Getone("Select reID From `dede_arctype` where ID='$typeID' "
);
'reID'
];
);
(!
;
]==0){
@H_419_428@]=@H_419_428@];}(trim(
@H_419_428@)==)
@H_419_428@= GetSystemplets();
$dtp
=
new
DedeTagParse();
->SetnameSpace(
);
->LoadSource(
@H_419_428@);->CTags))
{
unset(
@H_419_428@);;
}
else
{
] =
@H_419_428@] = GetoneTypeUrlA(@H_419_428@);->CTags
as
@H_419_428@=>@H_419_428@){
(isset(
@H_419_428@[@H_419_428@->Getname()])) @H_419_428@->Assign(@H_419_428@->Getname()]);}
$revalue
=
@H_419_428@->GetResult(););
return
@H_419_428@;}
@H_502_32@}@H_502_32@?>
@H_502_32@
模板调用: {dede:retype}[fIEld:typename/]{/dede:retype}
总结
以上是内存溢出为你收集整理的dede在任一子级栏目获取顶级栏目名称 typename,包括该顶级栏目下全部内容,希望文章能够帮你解决dede在任一子级栏目获取顶级栏目名称 typename,包括该顶级栏目下所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)