|
找到 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(!defined('DEDEINC'))exit('Request Error!');
functionlib_toptype(&$ctag,&$refObj)
{
global$dsql$envs;
$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($innertext= trim(->GetInnerText());
($typeid==0) {
$typeid= ( isset(->TypeLink->TypeInfos['id']) ?] :['typeid'] );
}
(empty))return'';
$topid=->GetOne("Select topid From `dede_arctype` where id='$typeid' ");
'topid'];
$row"Select id,typelitpic From `dede_arctype` where id='$topid' ");
(!is_array;
]==0){]=];}
(trim($innertext)==)= GetSysTemplets("part_type_list.htm");
$dtp=newDedeTagParse();
$dtp->SetNameSpace('field''['']');
->LoadSource();
->CTags))
{
unset();
;
}
else
{
'typelink'] ='typeurl'] = GetOneTypeUrlA();
foreach->CTagsas$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( $innertext = trim(->GetInnerText());
(==0) {
$typeid = ( isset(->TypeLink->TypeInfos[]) ? ] : [] );
}
()) return ;
$reid=->GetOne("Select reid From `dede_arctype` where id='$typeid' ");
'reid'];
);
(!;
]==0){]=];}
(trim()==) = GetSysTemplets();
$dtp = new DedeTagParse();
->SetNameSpace();
->LoadSource();
->CTags))
{
unset();
;
}
else
{
] = ] = GetOneTypeUrlA();
->CTags as =>)
{
(isset([->GetName()])) ->Assign(->GetName()]);
}
$revalue = ->GetResult();
);
return ;
}
}
?>
模板调用:{dede:retype}[field:typename/]{/dede:retype}
(编辑:鄂州站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|