问题:
在2级栏目页面单独调用该栏目的顶级栏目名称!
方法思路:
在 {dede:type} [field:typename /] {/dede:type} 标签的基础上进行修改。 调用方法: {dede:type2} [field:typename /] {/dede:type2} 新标签放置位置:
includetaglibtype2.lib.php保存为type2.lib.php标签就可以使用 | // +----------------------------------------------------------------------+ // // $Id:$ 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']); //echo "ssssssssss1".$refObj->Typelink->TypeInfos['topid']; //echo "ssssssssss2".$envs['typeid']; exit; } //echo "typeid:".$typeid; exit; //lyy 如果topid==0 就是顶级分类,取当前记录 if($refObj->Typelink->TypeInfos['topid']==0){ $typeid=$refObj->Typelink->TypeInfos['id']; } //echo "typeid:".$typeid; exit; if (empty($typeid)) return ''; $row = $dsql->GetOne("SELECt id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_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 { //lyy 以下getTypeUrl($row[topid]错的,换成 $row['id'] echo $row['id']."sssss";exit; $row['typelink'] = GetTypeUrl($row['id'], MfTypedir($row['typedir']) , $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['siteurl'], $row['sitepath']); //print_r($row);exit; foreach ($dtp->CTags as $tagid => $ctag) { if (isset($row[$ctag->GetName() ])) $dtp->Assign($tagid, $row[$ctag->GetName() ]); } $revalue = $dtp->GetResult(); unset($dtp); return $revalue; } } ?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)