您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程

ecshop实现二级导航的调用方法

傲晴2023-11-10 23:42:56ecshop商城教程已有人查阅

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

要实现这个二级导航的功能只需要在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;}

本文标签:

很赞哦! ()

留言与评论 (共有 条评论)
验证码:

本栏推荐

相关标签