dedecms下仿chinaz二级下拉动态读取代码
1 把nic_menu目录,放在dede的根目录
2 然后,打开include\config_base.php 文件,在最后的“?>”之前 插入仿chinaz.com二级下拉.txt内的代码
3 打开模板文件,在您需要显示下拉导航条的地方,插入以下代码,即可:
{dede:global name='szsy_menu'/}
require_once(dirname(__FILE__)."/inc_channel_unit_functions.php");
$szsy_sql=new DedeSql(false);
$szsy_sql2=new DedeSql(false);
$inquery = "select * from dede_arctype where reID=0 ";
$szsy_sql->SetQuery($inquery);
$szsy_sql->execute();
global $szsy_menu;
$szsy_menu="<div class='nav'><div class='navinner'><ul class='navlist'><li><a href='/'>首页</a></li>";
$menu_i=1;
while ($row=$szsy_sql->GetArray()){
$type_path=GetTypeUrl($row['ID'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
$szsy_menu=$szsy_menu."<li><a href='".$type_path."' id='nav_".$menu_i."' onmouseover=\"showMenu('nav_".$menu_i."','subnav".$menu_i."')\">".$row[typename]."</a>";
//遍历二级栏目
$szsy_sql2->SetQuery("select * from dede_arctype where reID=".$row[ID]);
$szsy_sql2->execute();
if ($szsy_sql2->GetTotalRow()>0) {
$szsy_menu=$szsy_menu."<div class=\"subnav disable\" id='subnav".$menu_i."'><p class='pointer'>.</p><p><span>";
while ($row2=$szsy_sql2->GetArray()){
$type_path2=GetTypeUrl($row2['ID'],MfTypedir($row2['typedir']),$row2['isdefault'],$row2['defaultname'],$row2['ispart'],$row2['namerule2'],$row2['siteurl']);
$szsy_menu=$szsy_menu."<a href='".$type_path2."'>".$row2[typename]."</a> | ";
}
$szsy_menu=substr($szsy_menu,0,strlen($szsy_menu)-2);
$szsy_menu=$szsy_menu."</span></p></div>";
}
$szsy_menu=$szsy_menu."</li>";
$menu_i++;
}
$szsy_menu=$szsy_menu."</ul></div></div>";
//echo "";
$szsy_sql->close();
$szsy_sql2->close();
本地下载