ecshop如何实现二级导航呢?

ECSHOP教程 来源: ECSHOP教程网www.ecshop119.com 时间:2012-02-16 ECSHOP教程分类:其他ECSHOP教程

要实现这个二级导航的功能只需要在lib.main.php大约1969~1979之间的 'cid' => $row['cid'],下面加上一句


'subCat' => ($row['cid']==0||$row['cid']=="")?'':get_child_tree($row['cid'])


然后你打印下导航的数组就可以看到其子类下的信息了!


这是我在默认模板改了以后的page_header.lbi文件(贴图效果的例子)

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
<script type="text/javascript">
 
var process_request = "{$lang.process_request}";
 
</script>
 
<script type="text/javascript">
 
function showsub(id){
 
document.getElementById(id).style.display="block";
 
}
 
function hidsub(id){
 
document.getElementById(id).style.display="none";
 
}
 
</script>
 
<div class="block clearfix">
 
<div class="f_l"><a href="../index.php" name="top"><img src="../images/logo.gif" /></a></div>
 
<div class="f_r log">
 
<ul>
 
<li class="userInfo">
 
{insert_scripts files='transport.js,utils.js'}
 
<font id="ECS_MEMBERZONE">{* ECSHOP 提醒您:根据用户id来调用member_info.lbi显示不同的界面 *}{insert name='member_info'} </font>
 
</li>
 
<!--{if $navigator_list.top}-->
 
<li id="topNav" class="clearfix">
 

 
<!-- {foreach name=nav_top_list from=$navigator_list.top item=nav} -->
 
<a href="{$nav.url}" <!-- {if $nav.opennew eq 1} --> target="_blank" <!-- {/if} -->>{$nav.name}</a>
 

 
<!-- {if !$smarty.foreach.nav_top_list.last} -->
 
|
 
<!-- {/if} -->
 
<!-- {/foreach} -->
 
<div class="topNavR"></div>
 
</li>
 
<!-- {/if} -->
 
</ul>
 
</div>
 
</div>
 
<div class="blank"></div>
 
<div id="mainNav" class="clearfix">
 
<a href="../index.php"{if $navigator_list.config.index eq 1} class="cur"{/if}>{$lang.home}<span></span></a>
 
<!-- {foreach name=nav_middle_list from=$navigator_list.middle item=nav} -->
 
<a href="{$nav.url}" {if $nav.subCat} onMouseOver="javascript:showsub({$nav.cid});hidsub('sub1');" onMouseout="javascript:hidsub({$nav.cid});showsub('sub1');" {/if} {if $nav.opennew eq 1}target="_blank" {/if} {if $nav.active eq 1} class="cur"{/if}>{$nav.name}<span></span> </a>
 
<!-- {/foreach} -->
 
</div>
 

 
<div class="subNav" id="sub1" style="height:20px;" >
 
</div>
 

 

 
<!-- {foreach name=nav_middle_list from=$navigator_list.middle item=nav} -->
 
<!--{if $nav.subCat}-->
 
<div class="subNav" id="{$nav.cid}" style=" display:none; height:20px;" onMouseOver="javascript:showsub({$nav.cid});hidsub('sub1');" onMouseout="javascript:hidsub({$nav.cid});showsub('sub1');" >
 
<!--{foreach from=$nav.subCat item=subCat}-->
 
<a href="{$subCat.url}" style="font-size:14px; text-decoration:none;">{$subCat.name}<span></span></a>
 
<!-- {/foreach} -->
 
</div>
 
<!--{/if}-->
 
<!-- {/foreach} -->
 
<!--search start-->
 
<div id="search" class="clearfix">
 
<div class="keys f_l">
 
<script type="text/javascript">
 
{literal}
 
<!--
 
function checkSearchForm()
 
{
 
if(document.getElementById('keyword').value)
 
{
 
return true;
 
}
 
else
 
{
 
alert("{$lang.no_keywords}");
 
return false;
 
}
 
}
 
-->
 
{/literal}
 
</script>
 
{if $searchkeywords}
 
{$lang.hot_search} :
 
{foreach from=$searchkeywords item=val}
 
<a href="search.php?keywords={$val|escape:url}">{$val}</a>
 
{/foreach}
 
{/if}
 
</div>
 
<form id="searchForm" name="searchForm" method="get" action="search.php" onSubmit="return checkSearchForm()" class="f_r" style="_position:relative; top:5px;">
 
<select name="category" id="category" class="B_input">
 
<option value="0">{$lang.all_category}</option>
 
{$category_list}
 
</select>
 
<input name="keywords" type="text" id="keyword" value="{$search_keywords|escape}" class="B_input" style="width:110px;"/>
 
<input name="imageField" type="submit" value="" class="go" style="cursor:pointer;" />
 
<a href="search.php?act=advanced_search">{$lang.advanced_search}</a>
 
</form>
 
</div>
 
<!--search end-->
复制代码
因为涉及了样式,再在样式文件里tyle.css里加上

.subNav{padding:0 25px; width:835px; background:url(images/searchBg.gif) repeat-x; padding-left:100px;}
 
.subNav a{ color:#009 font-size:20px; font-weight:700; margin-right:10px;}
 

本文模板屋原创地址: https://www.ecshop119.com/ecshopjc-359.html
模板屋版权所有 © 转载时必须以链接形式注明出处!

ECSHOP模板屋
ecshop开发团队 ecshop开发中心 ecshop模板制作 ecshop模板屋
ECSHOP
ecshop下载 ecshop安装教程 ecshop在线演示 ecshop后台测试
ECSHOP二次开发手册
ecshop教程 ecshop二次开发 ecshop模板教程 ecshop微信配置
ECSHOP商城网站建设
ecshop空间域名 ecshop商城建设 ecshop模板修改 ecshop开发定制
服务支持:7X24小时 151 059 55077
ECShop二次开发
ecshop搭建
qqtelcodeback_top
温馨提示

确定取消
温馨提示

关闭