<!--导航-->
<div id="smoothmenu1">
<ul>
{dede:channel get='index'}<li><a href="[field:typeurl/]">
[field:lang.indexname/]</a></li>{/dede:channel}
{dede:menuchannel}{/dede:menuchannel}
</ul>
</div>
把menuchannel.lib.php文件放在\include\taglib下面!
<?php
if(!defined('DEDEINC')) exit("Request Error!");
/************************
程序开发:darcy
网站:ye-cn.net
版本:v1.07.30
*************************/
function lib_menuchannel(&$ctag,&$refObj)
{
global $dsql,$cfg_df_lang;
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,get|all,currentstyle|,noself|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$lang = (isset($refObj->Lang) ? $refObj->Lang : '');
if(empty($lang))
{
$lang = (isset($refObj->dtp->tplLang) ? $refObj->dtp->tplLang : $cfg_df_lang);
}
$reid = 0;
$topid = 0;
//如果属性里没指定栏目id,从引用类里获取栏目信息
if(empty($typeid))
{
if( isset($refObj->TypeLink->TypeInfos['id']) )
{
$typeid = $refObj->TypeLink->TypeInfos['id'];
$reid = $refObj->TypeLink->TypeInfos['reid'];
$topid = $refObj->TypeLink->TypeInfos['topid'];
if($reid==0) $topid = $typeid;
}
else {
$typeid = 0;
}
}
//如果指定了栏目id,从数据库获取栏目信息
else
{
$row2 = $dsql->GetOne("Select * From `#@__arctype` where id='$typeid' ");
$typeid = $row2['id'];
$reid = $row2['reid'];
$topid = $row2['topid'];
$issetInfos = true;
}
if(empty($topid))
{
$row3 = $dsql->GetOne("Select * From `#@__arctype` where reid=0 And lang ='$lang' ");
$topid = ($row3['topid']==0 ? $row3['id'] : $row3['topid']);
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2 From `#@__arctype` where reid=$topid And ishidden<>1 order by sortrank asc limit 0,$row";
$dsql->Execute('t', $sql);
while($row = $dsql->GetArray('t'))
{
$row['typelink'] = GetTypeUrl($row['id'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2']);
$likeType .= "<li>";
$likeType .= "<a href='{$row['typelink']}'>{$row['typename']}</a>";
N_channel($row['id'], $likeType);
}
return $likeType;
}
function N_channel($id, &$revalue){
global $dsql;
$query = "Select id,typename,typedir,isdefault,defaultname,ispart,namerule2 From`#@__arctype` where reid='{$id}' And ishidden<>1 order by sortrank asc ";
$row2 = $dsql->GetOne($query);
if(is_array($row2)){
$revalue .= "<ul>\n";
$dsql->Execute($id, $query);
while($row = $dsql->GetArray($id))
{
$row['typelink'] = GetTypeUrl($row['id'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2']);
$revalue .= "<li><a href='{$row['typelink']}'>{$row['typename']}</a>\n";
N_channel($row['id'], $revalue);
}
$revalue .= "</ul>\n";
}
$revalue .= "</li>\n";
}
?>