帝国cms教程一:头部栏目导航制作

做网站开始从头部做,选取一个企业站用仿站小工具copy下来,公共部分单独取出来放在管理模板变量里面

1.一级导航,含栏目高亮

<?php
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
$bgcolor="#000";
if($bqr[classid]==$GLOBALS[navclassid])//当前栏目ID
{
echo "class= 'cur'";
}
?>
<li <?php if($GLOBALS[navclassid] == 0){ echo "class='on'";}?>><a href="/">首页</a></li>

[e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='0' and showclass=0 order by `myorder` asc ",5,24,0,0,0}]
<li <?php if($bqr[classid]==$GLOBALS[navclassid]){ echo "class= 'on'";}?>><a href="/<?=$class_r[$bqr[classid]]['classpath']?>/" > <?=$class_r[$bqr[classid]]['classname']?></a></li>
[/e:loop]

2.二级栏目导航
 

<li><a href="/">首&nbsp;&nbsp;页</a></li>

<?php
$ecms_bq_sql=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsclass where bclassid=0 order by myorder limit 6",14,24,0);
$bqno=0;
while($bqr=$empire->fetch($ecms_bq_sql))
{
        $bqsr=sys_ReturnEcmsLoopStext($bqr);
        $bqno++;
        ?>
<li class="ab"><a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>/"><?=sub($bqr[classname],0,54,false)?></a></li>



<div class="item">
<?php
        $ecms_bq_sql2=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsclass where bclassid=$bqr[classid]  order by myorder limit 20",14,24,0);
        $bqno2=0;
        while($bqr2=$empire->fetch($ecms_bq_sql2))
        {
                $bqsr2=sys_ReturnEcmsLoopStext($bqr2);
                $bqno2++;
                ?>    


<a href="<?=$public_r[newsurl]?><?=$bqr2[classpath]?>/"><?=sub($bqr2[classname],0,54,false)?></a>


<?php
 }
 ?>
</div>
</dl>
</li>
<?php
}
?>


 

评论 抢沙发