dede模板中子栏目页面调用顶级栏目名称并带链接

减少蜗居时间,亲近大自然。责任是从现在开始就要承担的,父母不再年轻,能回报的时候及时回报,不要总觉得时间还很多,岁月不等人。

 

保存为type2.lib.php标签就可以使用

<?php

 

if(!defined(‘DEDEINC’)) exit(‘Request Error!’);

 

function lib_type2(&$ctag,&$refObj)

{

       global $dsql,$envs;

 

       $attlist=’typeid|0′;

       FillAttsDefault($ctag->CAttribute->Items,$attlist);

       extract($ctag->CAttribute->Items, EXTR_SKIP);

       $innertext = trim($ctag->GetInnerText());

 

       if($typeid==0) {

              $typeid = ( isset($refObj->TypeLink->TypeInfos['topid']) ? $refObj->TypeLink->TypeInfos['topid'] : $envs['typeid'] );

       }

 

  if(empty($typeid)) return ”;

                                                       

       $row = $dsql->GetOne("Select topid,typedir,isdefault,defaultname,ispart,namerule2,typename,moresite,siteurl,sitepath

                            From `2d30_arctype` where id=’$typeid’ ");

       if(!is_array($row)) return ”;

       if(trim($innertext)==”) $innertext = GetSysTemplets("part_type_list.htm");

      

       $dtp = new DedeTagParse();

       $dtp->SetNameSpace(‘field’,’[',']‘);

       $dtp->LoadSource($innertext);

       if(!is_array($dtp->CTags))

       {

              unset($dtp);

              return ”;

       }

       else

       {

              $row['typelink'] = GetTypeUrl($row['topid'],MfTypedir($row['typedir']),$row['isdefault'],

                                  $row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl'],$row['sitepath']);

              foreach($dtp->CTags as $tagid=>$ctag)

              {

                     if(isset($row[$ctag->GetName()])) $dtp->Assign($tagid,$row[$ctag->GetName()]);

              }

              $revalue = $dtp->GetResult();

              unset($dtp);

              return $revalue;

       }

}

?>

本文dede模板中子栏目页面调用顶级栏目名称并带链接到此结束。修炼自己,比到处逢迎别人重要的多。小编再次感谢大家对我们的支持!

标签: dede