1 下载附件 szsy_menu 并解压后,放在系统的根目录
2 然后,打开include\common.inc.php文件,在最后的“?>”之前 插入如下代码
//生成下拉菜单
require_once(dirname(__FILE__)."/channelunit.func.php");
$szsy_sql=new DedeSql(false);
$szsy_sql2=new DedeSql(false);
$inquery = "select * from `cmsxx_arctype` where reID=0 order by sortrank";
$szsy_sql->SetQuery($inquery);
$szsy_sql->execute();
global $szsy_menu;
$szsy_menu=" <link href='".$cfg_cmspath."/nic_menu/3menu.css' rel='stylesheet' type='text/css' /><SCRIPT src='".$cfg_cmspath."/nic_menu/chinaz.js' type=text/JavaScript></SCRIPT><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 `cmsxx_arctype` where reID=".$row[id]." order by sortrank");
$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();
3 打开模板文件,在您需要显示下拉导航条的地方,插入以下代码,即可:
{dede:global name='szsy_menu'/} |