dede5.7 動(dòng)態(tài)導(dǎo)航下拉菜單的實(shí)現(xiàn)代碼,織夢(mèng)技術(shù)
導(dǎo)讀:織夢(mèng)技術(shù)織夢(mèng)技術(shù)織夢(mèng)模板網(wǎng)點(diǎn)評(píng) :dede5.7 動(dòng)態(tài)導(dǎo)航下拉菜單的實(shí)現(xiàn)代碼,需要的朋友可以參考一下 1.修改 include下面taglib文件夾里的channel.lib.織夢(mèng)模板免費(fèi)下裁dede模板堂。
織夢(mèng)模板網(wǎng)點(diǎn)評(píng):dede5.7 動(dòng)態(tài)導(dǎo)航下拉菜單的實(shí)現(xiàn)代碼,需要的朋友可以參考一下
1.修改 include下面taglib文件夾里的channel.lib.php文件 替換成我的
代碼如下:
<?php
function lib_channel(&$ctag,&$refObj)
{
global $_sys_globals,$envs,$ds夢(mèng)織模板ql;
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$innertext = $ctag->GetInnerText();
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 <a href="mailto:`dede_arctype">`dede_arctype</a>` where id='$typeid' ");
if(is_array($dbrow)) $reid = $dbrow['reid'];
}
$likeType = '';
if($type=='top')
{
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,description
From <a href="mailto:`dede_arctype">`dede_arctype</a>` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";
}
else if($ty織夢(mèng)模板免費(fèi)pe=="son")
{
//if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
if($typeid==0) {
return '';
}
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,description
From <a href="mailto:`dede_arctype">`dede_arctype</a>` 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,description
From <a href="mailto:`dede_arctype">`dede_arctype</a>` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";
}
//And id<>'$typeid'
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace("field","[","]");
$dtp2->LoadSource($innertext);
$dsql2 = clone $dsql;
$dsql->SetQuery($sql);
$dsql->Execute();
$line = $row;
$GLOBALS['autoindex'] = 0;
for($i=0;$i < $line;$i++)
{
if($col>1) $likeType .= "<dl>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $likeType .= "<dd>\r\n";
if($row=$dsql->GetArray())
{
if($type=='self' && $row['id']==$typeid) //處理同級(jí)欄目中,當(dāng)前欄目的樣式
{
if($currentstyle!='')
{
$linkOkstr = $currentstyle;
$row['typelink'] = GetOneTypeUrlA($row);
$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 .= "</dd>\r\n";
$GLOBALS['autoindex']++;
}//Loop Col
if($col>1)
{
$i += $col - 1;
$likeType .= " </dl>\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,description
From <a href="mailto:`dede_arctype">`dede_arctype</a>` 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 .= "<dl>\r\n";
for($j=0;$j<$col;$j++)
{
if($col>1) $likeType .= "<dd>\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 .= "</dd>\r\n";
}//Loop Col
if($col>1)
{
$i += $col - 1;
$likeType .= " </dl>\r\n";
}
}//Loop for $i
reset($dsql3);
$dsql2->FreeResult();
return $likeType;
}
?>
2.調(diào)用
這是我調(diào)用的代碼
代碼如下:
{dede:channel typeid='1'}
<li>
<a class="" href="[field:typeurl/]" title="">[field:typename/]
<img src="***.gif" /></a>
<div class="sub">
<ul>
[field:sonchannel0]<li><a href="[field:typeurl/]">[field:typename/]</a></li>[/field:sonchannel0]
</ul>
</div>
</li>
{/dede:channel}相關(guān)織夢(mèng)模板免費(fèi)下裁dede模板堂。
聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-20 ,文章dede5.7 動(dòng)態(tài)導(dǎo)航下拉菜單的實(shí)現(xiàn)代碼,織夢(mèng)技術(shù)主要講述菜單,代碼,織夢(mèng)網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請(qǐng)保留鏈接: http://www.bifwcx.com/article/web_32271.html
為你推薦與dede5.7 動(dòng)態(tài)導(dǎo)航下拉菜單的實(shí)現(xiàn)代碼,織夢(mèng)技術(shù)相關(guān)的文章
-
DedeCMS站點(diǎn)高級(jí)安全策略(Linux篇),織夢(mèng)教程
(105)人喜歡 2023-07-20 -
織夢(mèng)DEDECMS中讓近三天發(fā)布的文章顯示紅色
(194)人喜歡 2023-07-20 -
dedecms網(wǎng)站搬家需要的備份的文件,dedecms
(51)人喜歡 2023-07-20 -
織夢(mèng)(dedecms)導(dǎo)航條dropdown.js的改進(jìn)(附演示
(98)人喜歡 2023-07-20 -
解決Dedecms生成RSS地圖地址出錯(cuò)全都多了一
(139)人喜歡 2023-07-20 -
dede調(diào)用指定欄目下相關(guān)文章的實(shí)現(xiàn)方法
(123)人喜歡 2023-07-20