花了一下午的时间,总算解决了。



本来想在前台界面上分析看看ecshop导航栏设置,在浏览器里面是定位到了“nav-manu”下面,然后子目录是在m_left下可以看到是动态生成一系列的ul,li标签来设置导航栏的,然后打开源码,因为主界面是由index.dwt布局完成的

<strong><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="{$keywords}" />
<meta name="Description" content="{$description}" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>{$page_title}</title>
<!-- TemplateEndEditable --><!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="animated_favicon.gif" type="image/gif" />
<link href="{$ecs_css_path}" rel="stylesheet" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="RSS|{$page_title}" href="{$feed_url}" />
<link rel="stylesheet" type="text/css" href="themes/default/images/swiper.min.css">
<script language='javascript' src='themes/default/js/swiper.min.js' type='text/javascript' charset='utf-8'></script>
{* 包含脚本文件 *}
{insert_scripts files='common.js,index.js'}
{$ecs_css_path}
{$testtest} <><> </head>
<body>
<!-- #BeginLibraryItem "/library/page_header.lbi" --><!-- #EndLibraryItem -->
<script>
if (Object.prototype.toJSONString){
var oldToJSONString = Object.toJSONString;
Object.prototype.toJSONString = function(){
if (arguments.length > 0){
return false;
}else{
return oldToJSONString.apply(this, arguments);
}
}}</script>
<div class="indexpage clearfix">
<div class="index-cat"> <!-- #BeginLibraryItem "/library/index_category_tree.lbi" --><!-- #EndLibraryItem -->
</div>
<div class="index-banner"><!-- #BeginLibraryItem "/library/index_banner.lbi" --><!-- #EndLibraryItem --> </div>
</div>
<div class="indexpage clearfix index-ad"> <div class="ad-tg">
<!-- TemplateBeginEditable name="团购广告230x206" -->
<!-- #BeginLibraryItem "/library/ad_position.lbi" -->
123
{insert name='ads' id=$ads_id num=$ads_num}
<!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
</div>
<div class="ad-lb">
<!-- #BeginLibraryItem "/library/index_lad.lbi" -->
000000
<!-- #EndLibraryItem -->
123333
</div>
</div>
<div class="index-body">
<div class="indexpage">
<div class="body-goods">
<div class="goods-title">1F 家用电器</div>
<div class="clearfix goods-wrap">
<div class="goods-leftad">
<!-- #BeginLibraryItem "/library/f1_ad.lbi" --><!-- #EndLibraryItem -->
</div>
<div class="goods-right">
<!-- TemplateBeginEditable name="1层产品" -->
<!-- #BeginLibraryItem "/library/cat_goods.lbi" --> <div class="all_ms">
<!--{foreach from=$cat_goods item=goods}--> <a class="goodsItem" href="{$goods.url}">
<div class="img-box">
<img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="goodsimg" />
</div>
<div class="goods-brief">{$goods.brief|truncate:20}</div>
<div class="gos-title">{$goods.short_name|escape:html}</div>
<div class="prices">
<!-- {if $goods.promote_price neq ""} -->
<font class="shop_s">{$lang.promote_price}<b>{$goods.promote_price}</b></font>
<!-- {else}-->
<font class="shop_s"><b>{$goods.shop_price}</b></font>
<!--{/if}-->
</div> <div class="comment"> </div> </a>
<!--{/foreach}-->
<div class="clear0"></div>
</div> <!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
</div>
</div>
<div class="goods-title">2F 数码时尚</div>
<div class="clearfix goods-wrap">
<div class="goods-leftad">
<!-- #BeginLibraryItem "/library/f2_ad.lbi" --><!-- #EndLibraryItem -->
</div>
<div class="goods-right">
<!-- TemplateBeginEditable name="2层产品" -->
<!-- #BeginLibraryItem "/library/cat_goods.lbi" --> <div class="all_ms">
<!--{foreach from=$cat_goods item=goods}-->
<a class="goodsItem" href="{$goods.url}"> <div class="img-box"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="goodsimg" /></div>
<div class="goods-brief">{$goods.brief|truncate:20}</div>
<div class="gos-title">{$goods.short_name|escape:html}</div>
<div class="prices">
<!-- {if $goods.promote_price neq ""} -->
<font class="shop_s">{$lang.promote_price}<b>{$goods.promote_price}</b></font>
<!-- {else}-->
<font class="shop_s"><b>{$goods.shop_price}</b></font>
<!--{/if}-->
</div> </a>
<!--{/foreach}-->
<div class="clear0"></div>
</div> <!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
</div>
</div>
<div class="goods-title">3F 家居生活</div>
<div class="clearfix goods-wrap">
<div class="goods-leftad">
<!-- #BeginLibraryItem "/library/f3_ad.lbi" --><!-- #EndLibraryItem -->
</div>
<div class="goods-right">
<!-- TemplateBeginEditable name="3层产品" -->
<!-- #BeginLibraryItem "/library/cat_goods.lbi" --> <div class="all_ms">
<!--{foreach from=$cat_goods item=goods}-->
<a class="goodsItem" href="{$goods.url}"> <div class="img-box"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="goodsimg" /></div>
<div class="goods-brief">{$goods.brief|truncate:20}</div>
<div class="gos-title">{$goods.short_name|escape:html}</div>
<div class="prices">
<!-- {if $goods.promote_price neq ""} -->
<font class="shop_s">{$lang.promote_price}<b>{$goods.promote_price}</b></font>
<!-- {else}-->
<font class="shop_s"><b>{$goods.shop_price}</b></font>
<!--{/if}-->
</div> </a>
<!--{/foreach}-->
<div class="clear0"></div>
</div> <!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
</div>
</div>
<div class="goods-title">热门商品推荐</div>
<div class="clearfix goods-wrap hot-goods">
<!-- TemplateBeginEditable name="热门商品推荐" -->
<!-- #BeginLibraryItem "/library/recommend_hot.lbi" --> <!-- {if $hot_goods} -->
<!-- {if $cat_rec_sign neq 1} -->
<div id="show_hot_area" class="clearfix goodsBox all_mid all_ms">
<!-- {/if} -->
<!--{foreach from=$hot_goods item=goods}-->
<a class="goodsItem" href="{$goods.url}"> <div class="img-box"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="goodsimg" /></div>
<div class="goods-brief">{$goods.brief|truncate:20}</div>
<div class="gos-title">{$goods.short_name|escape:html}</div>
<div class="prices">
<!-- {if $goods.promote_price neq ""} -->
<font class="shop_s">{$lang.promote_price}<b>{$goods.promote_price}</b></font>
<!-- {else}-->
<font class="shop_s"><b>{$goods.shop_price}</b></font>
<!--{/if}-->
</div> </a>
<!--{/foreach}-->
<!-- {if $cat_rec_sign neq 1} -->
<div class="clear0"></div>
</div> <div class="clear10"></div>
<!-- {/if} -->
<!-- {/if} --> <!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
</div> </div>
</div>
</div>
<!-- #BeginLibraryItem "/library/page_footer.lbi" --><!-- #EndLibraryItem -->
</body>
</html></strong>

所以可以在其中发现

<strong><!-- #BeginLibraryItem "/library/page_header.lbi" --><!-- #EndLibraryItem --></strong>

这一行代码,因为dwt文件的缘故,注释可以忽略,然后进入

/library/page_header.lbi

文件下,找到nav-menu标签,原始代码真是够乱的,对于有强迫症的我来说,必须得重新排版下

<strong><div class="m_left">
<ul>
<li>
<a href="../index.php"
{if $navigator_list.config.index eq 1} class="cur"{/if}>
{$lang.home}{$lang.home}{$smarty.foreach.nav_middle_list.last}
</a>
</li>
{foreach name=nav_middle_list from=$navigator_list.middle item=nav}
{if $smarty.foreach.nav_middle_list.last}
<li>
<a href="{$nav.url}"
{if $nav.opennew eq 1}
target="_blank"
{/if}
{$nav.name}
</a>
</li>
<!-- {else} --> <li>
<a href="{$nav.url}" <!-- {if $nav.opennew eq 1} -->target="_blank"<!-- {/if} -->>
{$nav.name}
</a>
</li>
<!-- {/if} -->
<!-- {if $nav.active eq 1} --><!-- {/if} -->
<!-- {/foreach} -->
</ul> </div></strong>

在m_left标签下,可以发现首页标签是单独列出来的,而后面的几个选项是通过foreach动态生成,从给的href可以看出。

之前一直没看懂$navigator_list这个参数是怎么传进来的,因为固定思维,一直以为带有‘$’的标签都是根目录下的php文件通过smarty传递过来,所以找遍了所有php文件和dwt文件,都没发现$navigator_list这个参数,后面又试着关键字搜索nav这个表名,以为能找到对应的sql语句,可是找遍仍然没发现,后面接着在page_header.lbi这个文件下调试这几个参数的值,输出这些值,找找看能不能发现什么,顺便把数据库里面nav表的name参数改动,看看变化,依然没什么进展,不过,倒是解决了之前很多的疑问,感觉里面的代码和界面被我调试的面目全非。最终问题是解决了,我无意中翻看其他文件夹,在includes/目录下,我意识到,像导航栏这种常年不变的组件,必须得剥离到共用的地方,很多地方都得调用,如果写在业务逻辑代码里面,会非常臃肿的,我翻了一下,本能的从init.php,lib_base,lib_main这三个文件里面看了看,最后在lib_main文件内找到$navigator_list参数。

呵呵,我想说一句,fuck,几十个文件翻着看,这基本的调用也不给个注释,这叫我们这些菜鸟怎么活啊ORZ

ECshop--导航栏模块细究的更多相关文章

  1. Ecshop导航栏标题栏的伪静态设置

    当Ecshop的伪静设置成功之后,左侧的分类标签,包括具体的产品页面都可以顺利的打开伪静态页面,但是点击导航栏,或者标题栏的时候,却还是之前的数据库标签页的方式,这是怎么一回事呢? 这是由于,Ecsh ...

  2. ABP(现代ASP.NET样板开发框架)系列之22、ABP展现层——导航栏设置

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之22.ABP展现层——导航栏设置 ABP是“ASP.NET Boilerplate Project (ASP.NE ...

  3. Bootstrap框架(基础篇)之按钮,网格,导航栏,下拉菜单

    一,按钮 注意:虽然在Bootstrap框架中使用任何标签元素都可以实现按钮风格,但个人并不建议这样使用,为了避免浏览器兼容性问题,个人强烈建议使用button或a标签来制作按钮. 框架中提供了基础按 ...

  4. [ExtJS5学习笔记]第十七节 Extjs5的panel组件增加accodion成为折叠导航栏

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/39102335 官方例子:http://dev.sencha.com/ext/5.0.1 ...

  5. Android开源项目——带图标文字的底部导航栏IconTabPageIndicator

    接下来的博客计划是,在<Android官方技术文档翻译>之间会发一些Android开源项目的介绍,直接剩下的几篇Android技术文档发完,然后就是Android开源项目和Gradle翻译 ...

  6. AndroidStudio制作底部导航栏以及用Fragment实现切换功能

    前言 大家好,给大家带来AndroidStudio制作底部导航栏以及用Fragment实现切换功能的概述,希望你们喜欢 学习目标 AndroidStudio制作底部导航栏以及用Fragment实现切换 ...

  7. iOS系统中导航栏的转场解决方案与最佳实践

    背景 目前,开源社区和业界内已经存在一些 iOS 导航栏转场的解决方案,但对于历史包袱沉重的美团 App 而言,这些解决方案并不完美.有的方案不能满足复杂的页面跳转场景,有的方案迁移成本较大,为此我们 ...

  8. 5.5修改xadmin的头部底部和导航栏名称

    1.修改xadmin的头部标题和底部信息: 在users模块中的adminx.py中添加修改函数: from xadmin import views class GlobalSettings(obje ...

  9. ECSHOP后台开发模块步骤

    一.建数据库二.添加到后台导航栏并配置相关语言包三.权限配置四.添加增删查改五.增加其他功能(复制,搜索(暂时调不出来页面),排序,转移,AJAX) 以添加支付信息模块为例 第一步首先我们用phpmy ...

随机推荐

  1. [Mac]使用xcode命令行编译protobuf

    因为不想每次测试与画面显示无关的小功能时把cocos2dx包含进去,所以改用xcode的command line tool直接建立c++项目. 方法: 1.点击file-new-project,选择o ...

  2. 5.android系统裁剪

    我手上的android的SDK,是全志A10方案的android4.0.4.由于公司基于这个平台开发一款设备,需要把android自带的软件以及厂家自带的软件去除掉.就研究如何去裁剪android的a ...

  3. bzoj2342

    shoi题目好坑爹 首先自己测发现这道题如果用后缀数组+rmq处理每个点回文串能延伸长度的话会TLE (当然我用的是倍增+ST的方法,如果用三分构建后缀数组+笛卡尔树处理rmq我就不知道了): 关于最 ...

  4. WebTable 扩展

    # coding:utf-8 """ 页面 table处理 """ from selenium import webdriver from ...

  5. [转]SVN的trunk branch tag

    Subversion有一个很标准的目录结构,是这样的.比如项目是proj,svn地址为svn://proj/,那么标准的svn布局是 svn://proj/|+-trunk+-branches+-ta ...

  6. Jquery Mobile左右滑动效果

    首先在一个页面里面定义两个< div data-role="page">,这里为了突出重点,就没有写出footer和header.定义的页面如下: <body&g ...

  7. HDU4283:You Are the One(区间DP)

    Problem Description The TV shows such as You Are the One has been very popular. In order to meet the ...

  8. Unicode与 utf8的互相转换

    <?php function unicode_encode($name) { $name = iconv('UTF-8', 'UCS-2', $name); $len = strlen($nam ...

  9. 使用CLRMD时通过Symbol Server找Dac的位置来初始化ClrRuntime

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:使用CLRMD时通过Symbol Server找Dac的位置来初始化ClrRuntime.

  10. Unicode与UTF-8互转(C语言实现)

    1. 基础 1.1 ASCII码 我们知道, 在计算机内部, 所有的信息最终都表示为一个二进制的字符串. 每一个二进制 位(bit)有0和1两种状态, 因此八个二进制位就可以组合出 256种状态, 这 ...