找到 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}
if
(!defined(
'DEDEINC'
))
exit
(
'Request Error!'
);
function
lib_toptype(&
$ctag
,&
$refObj
)
{
$attlist
=
'typeid|0'
;
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(
PHP variable" style="font-family: Consolas,EXTR_SKIP);
$innertext
= trim(
->GetInnerText());
(
$typeid
==0) {
$typeid
= ( isset(
->TypeLink->TypeInfos[
'id'
]) ?
] :
[
'typeid'
] );
}
(
empty
))
return
''
;
'topid'
];
$row
"Select id,typelitpic From `dede_arctype` where id='$topid' "
);
(!
is_array
;
]==0){
]=
];}
$dtp
=
new
DedeTagParse();
$dtp
->SetNameSpace(
'field'
PHP plain" style="font-family: Consolas,
'['
']'
);
->LoadSource(
);
->CTags))
{
unset(
);
;
}
else
{
foreach
->CTags
as
$tagid
=>
)
{
(isset(
[
->GetName()]))
->Assign(
->GetName()]);
}
$revalue
=
->GetResult();
);
return
$revalue
;
}
}
?>
如果想获取任一栏目的上级栏目,可将topid---->改为--->reid,最后记得改函数名和文件名
retype.lib.PHP
(!defined(
))
(
);
function
lib_retype(&
,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;">)
{
global
;
=
;
FillAttsDefault(
->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(PHP variable" style="font-family: Consolas,EXTR_SKIP);
$innertext
= trim(
->GetInnerText());
(
==0) {
$typeid
= ( isset(
->TypeLink->TypeInfos[
]) ?
] :
[
] );
}
(
))
return
;
PHP plain" style="font-family: Consolas,typelitpic From `dede_arctype` where id='$typeid' ");
'reid'
];
PHP plain" style="font-family: Consolas,reid,typelitpic From `dede_arctype` where id='$reid' "
);
(!
;
]==0){
]=
];}
$dtp
=
new
DedeTagParse();
->SetNameSpace(
);
->LoadSource(
);
->CTags))
{
unset(
);
;
}
else
{
->CTags
as
=>
)
{
(isset(
[
->GetName()]))
->Assign(
->GetName()]);
}
$revalue
=
->GetResult();
);
return
;
}
}
?>
模板调用: {dede:retype}[field:typename/]{/dede:retype}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。