1、找到 include/taglib/channel.lib.php 文件,用下面代碼替換這個(gè)文件里面的所有內(nèi)容,以免出錯(cuò),請(qǐng)先備份一下原文件。
(由于網(wǎng)頁編碼問題,復(fù)制了以后內(nèi)容還不能直接用的。要注意里面的符號(hào)。)
CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$cacheid = trim($cacheid);
if($cacheid !='') {
$likeType = GetCacheBlock($cacheid);
if($likeType != '') return $likeType;
}
$reid = 0;
$topid = 0;
if(empty($typeid) && $envs['typeid']!=0)
{
$typeid = $envs['typeid'];
$reid = $envs['reid'];
}else{
$reid=0;
}
if($type==''||$type=='sun') $type="son";
if($innertext=='') $innertext = GetSysTemplets("channel_list.htm");
if($reid==0 && $typeid>0)
{
$dbrow = $dsql->GetOne("Select reid From dede_arctype where id='$typeid' ");
if(is_array($dbrow)) $reid = $dbrow['reid'];
}
$likeType = '';
if($type=='top')
{
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($type=="son")
{
//if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
if($typeid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($type=="self")
{
if($reid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";
}
//And id<>'$typeid'
$needRel = false;
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($innertext);
$dsql2 = clone $dsql;
$dsql->SetQuery($sql);
$dsql->Execute();
$line = $row;
//檢查是否有子欄目,并返回rel提示(用于二級(jí)菜單)
if(ereg(':rel', $innertext)) $needRel = true;
if(empty($sql)) return '';
$dsql->SetQuery($sql);
$dsql->Execute();
$totalRow = $dsql->GetTotalRow();
$GLOBALS['autoindex'] = 0;
for($i=0;$i < $line;$i++) { if($col>1) $likeType .= "
\r\n";
for($j=0;$j<$col;$j++) { if($col>1) $likeType .= "
\r\n";
if($row=$dsql->GetArray())
{
$row['sonids'] = $row['rel'] = '';
if($needRel)
{
$row['sonids'] = GetSonIds($row['id'], 0, false);
if($row['sonids']=='') $row['rel'] = '';
else $row['rel'] = " rel='dropmenu{$row['id']}'";
}
//處理同級(jí)欄目中,當(dāng)前欄目的樣式
if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )
{
if($currentstyle!='')
{
$linkOkstr = $currentstyle;
$row['typelink'] = GetOneTypeUrlA($row);
$linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr);
$linkOkstr = str_replace("~id~",$row['id'],$linkOkstr);
$linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr);
$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
$likeType .= $linkOkstr;
}
}else
{
$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
if(is_array($dtp2->CTags))
{
foreach($dtp2->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()]))
{
$dtp2->Assign($tagid,$row[$ctag->GetName()]);
}
elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))
{
$dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql2));
}
}
}
$likeType .= $dtp2->GetResult();
}
}
if($col>1) $likeType .= "
\r\n";
$GLOBALS['autoindex']++;
}//Loop Col
if($col>1)
{
$i += $col - 1;
$likeType .= "
\r\n";
}
}//Loop for $i
reset($dsql2);
$dsql->FreeResult();
return $likeType;
}
function lib_channel_son($ctag,$typeid = 0,$dsql2)
{
$attlist = "row|100,col|1,currentstyle|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
$dsql3 = clone $dsql2;
$likeType = '';
//if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
if($typeid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
//And id<>'$typeid'
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($innertext);
$dsql2->SetQuery($sql);
$dsql2->Execute();
$line = $row;
for($i=0;$i < $line;$i++) { if($col>1) $likeType .= "
\r\n";
for($j=0;$j<$col;$j++) { if($col>1) $likeType .= "
\r\n";
if($row=$dsql2->GetArray())
{
$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);
if(is_array($dtp2->CTags))
{
foreach($dtp2->CTags as $tagid=>$ctag){
if(isset($row[$ctag->GetName()]))
{
$dtp2->Assign($tagid,$row[$ctag->GetName()]);
}
elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->GetName()))
{
$dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql3));
}
}
}
$likeType .= $dtp2->GetResult();
}
if($col>1) $likeType .= "
\r\n";
}//Loop Col
if($col>1)
{
$i += $col - 1;
$likeType .= "
\r\n";
}
}//Loop for $i
reset($dsql3);
$dsql2->FreeResult();
return $likeType;
}
?>2、將以下內(nèi)容復(fù)制到你需要調(diào)用的模板中。
Products List
//導(dǎo)航此處才開始
{dede:channelartlist typeid='top' row='8'}
{dede:field name='typename'/}
{dede:channel type='son'}//注意:此處不要加typeid函數(shù),不然它會(huì)只調(diào)用你指定的ID分類;
[field:typename/]
[field:sonchannel0]
[field:typename/]
[field:sonchannel1]
---[field:typename/]
[field:sonchannel2]
===[field:typename/]
[field:sonchannel3]
===[field:typename/]
[/field:sonchannel3]
[/field:sonchannel2]
[/field:sonchannel1]
[/field:sonchannel0]
{/dede:channel}
{/dede:channelartlist}CSS樣式,需要的拿去
.l_nav{ width:240px;}
.l_title{ width:240px; padding-bottom:10px; background:url(../images/left_nav_bth.png) center bottom no-repeat; font-size:22px; color:#333; text-align:center; text-shadow: 0 1px #FFFFFF; font-weight:bold; margin-top: 20px;}
.l_nav a{ color:#555; text-decoration:none; line-height:25px;}
.l_nav li:hover { background:#f1f1f1; border:1px solid #fff; padding:4px 0 4px 9px;}
.l_nav li:hover a, .pright_l_nav li ul li:hover a{}
.l_nav li:hover ul a{ color:#333;}
.l_nav li ul li:hover a{ color:#fff; text-shadow:none;}
.l_nav li { width:200px; height:25px; padding:5px 0 5px 10px; text-shadow:0 1px #fff;}
.l_nav ul{ padding-left:20px; width:200px;}
.l_nav ul.nav2{ font-size:11px; padding-left:0px; position:absolute; margin-top:-2000px; margin-left:140px; background:#eee; box-shadow: 4px 4px 6px #999999; -moz-box-shadow: 4px 4px 6px #999999;}
.l_nav ul.nav2 li{ padding-left:10px; height:25px; list-style:none; margin-left:-5px; }
.l_nav ul.nav2 li:hover{ background:#333; padding-left:-5px; }
.l_nav li:hover ul.nav2{ margin-top:-30px; }
.pright_l_nav ul.nav2 li:hover a{ font-weight:bold;}
.pright_l_nav ul.nav3{ margin-top:-2000px; margin-left:140px; background:#999; }
.pright_l_nav ul.nav2 li:hover ul{ margin-top:-30px; padding-left:0;}
.pright_l_nav ul.nav3 li:hover{ margin-left:-5px; background:#000;}
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: 解決dede 5.7 三級(jí)目錄、側(cè)導(dǎo)航的調(diào)用