ecshop二次开发之index.dwt文件详解

更新时间:2016-10-08 点击量:987


前面优易软件为大家讲解过ecshop二次开发过程中需要了解的一些目录和文件。让我们知道ecshop二次开发涉及的一些最基本的文件与目录。

今天为大家带来这篇index文件的详细接受,

index文件是ecshop商城系统中的首页,商城中的众多商品信息都是在这展现的,所以

对于ecshop新手来说,这篇总结值得关注。

对于没有web编程基础的同学来说,ecshop模板里面有两个文件特别重要,

但是这两个文件同时也很不好理解,分别是index.dwt和style.css.
 

我们先来看index文件中相关代码都是做什么的:


<!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 -->

//图标以及css样式和可替换样式

<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}" />

//注释文件以及脚本文件

{* 包含脚本文件 *}

{insert_scripts files='common.js,index.js'}

</head>

//主体文件格式

<body>

//插入首页头文件

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

//这个div引用了一个叫做blank的css类

<div class="blank"></div>

//定义首页左边区域

<div class="block clearfix">

  <!--left start-->

  <div class="AreaL">

    //定义站内公告

    <!--站内公告 start-->

    <div class="box">

     <div class="box_1">

      <h3><span>{$lang.shop_notice}</span></h3>

      <div class="boxCenterList RelaArticle">

        {$shop_notice}

      </div>

     </div>

    </div>

    <div class="blank5"></div>

    <!--站内公告 end-->

  <!-- TemplateBeginEditable name="左边区域" -->

//购物车信息

<!-- #BeginLibraryItem "/library/cart.lbi" -->

{insert_scripts files='transport.js'}

<div class="cart" id="ECS_CARTINFO">

 {insert name='cart_info'}

</div>

<div class="blank5"></div>

 <!-- #EndLibraryItem -->

//快捷引导目录信息

<!-- #BeginLibraryItem "/library/category_tree.lbi" -->

<div class="box">

 <div class="box_1">

  <div id="category_tree">

    //第一层循环

    <!--{foreach from=$categories item=cat}-->

     <dl>

     <dt><a href="{$cat.url}">{$cat.name|escape:html}</a></dt>

     //第二层循环

     <!--{foreach from=$cat.cat_id item=child}-->

     <dd><a href="{$child.url}">{$child.name|escape:html}</a></dd>

       //第三层循环

       <!--{foreach from=$child.cat_id item=childer}-->

       <dd>&nbsp;&nbsp;<a href="{$childer.url}">{$childer.name|escape:html}</a></dd>

       <!--{/foreach}-->

     <!--{/foreach}-->

       </dl>

    <!--{/foreach}-->

  </div>

 </div>

</div>

<div class="blank5"></div>

 // 销量前十的商品

 <!-- #EndLibraryItem -->

<!-- #BeginLibraryItem "/library/top10.lbi" -->

<div class="box">

 <div class="box_2">

  <div class="top10Tit"></div>

  <div class="top10List clearfix">

//获取销量前十的商品的图片

  <!-- {foreach name=top_goods from=$top_goods item=goods}-->

  <ul class="clearfix">

         <img src="../images/top_{$smarty.foreach.top_goods.iteration}.gif"

class="iteration" />

         <!-- {if $smarty.foreach.top_goods.iteration<4}-->

      <li class="topimg">

//获取销量前十的商品的缩略图

      <a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}"

class="samllimg" /></a>

      </li>

         <!-- {/if} -->            

      <li {if $smarty.foreach.top_goods.iteration<4}class="iteration1"{/if}>

 <a href="{$goods.url}" title="{$goods.name|escape:html}">{$goods.short_name}</a><br />

      {$lang.shop_price}<font class="f1">{$goods.price}</font><br />

      </li>

    </ul>

  <!-- {/foreach} -->

  </div>

 </div>

</div>

<div class="blank5"></div>

 <!-- #EndLibraryItem -->

//促销商品信息

<!-- #BeginLibraryItem "/library/promotion_info.lbi" -->

<!-- {if $promotion_info} -->

<!-- 促销信息 -->

<div class="box">

 <div class="box_1">

  <h3><span>{$lang.promotion_info}</span></h3>

  <div class="boxCenterList RelaArticle">

    <!-- {foreach from=$promotion_info item=item key=key} -->

    <!-- {if $item.type eq "snatch"} -->

    <a href="snatch.PHP" title="{$lang.$item.type}">{$lang.snatch_promotion}</a>

    <!-- {elseif $item.type eq "group_buy"} -->

    <a href="group_buy.php" title="{$lang.$item.type}">{$lang.group_promotion}</a>

    <!-- {elseif $item.type eq "auction"} -->

    <a href="auction.php" title="{$lang.$item.type}">{$lang.auction_promotion}</a>

    <!-- {elseif $item.type eq "favourable"} -->

    <a href="activity.php" title="{$lang.$item.type}">{$lang.favourable_promotion}</a>

    <!-- {/if} -->

    <a href="{$item.url}" title="{$lang.$item.type} {$item.act_name}{$item.time}"

escape:html}"

class="goodsimg" /></a><br />

           <p><a href="{$goods.url}" title="{$goods.name|escape:html}">

{$goods.short_style_name}</a></p>

           <font class="f1">

           <!-- {if $goods.promote_price neq ""} -->

          {$goods.promote_price}

          <!-- {else}-->

          {$goods.shop_price}

          <!--{/if}-->

           </font>

        </div>

  <!--{/foreach}-->

  <div class="more"><a href="../search.php?intro=best"><img src="images/more.gif"

/></a></div>

  <!-- {if $cat_rec_sign neq 1} -->

  </div>

</div>

</div>

<div class="blank5"></div>

  <!-- {/if} -->

<!-- {/if} -->

 <!-- #EndLibraryItem -->

// 最新商品

<!-- #BeginLibraryItem "/library/recommend_new.lbi" -->

<!-- {if $new_goods} -->

<!-- {if $cat_rec_sign neq 1} -->

<div class="box">

<div class="box_2 centerPadd">

  <div class="itemTit New" id="itemNew">

      {if $cat_rec[2]}

      <h2><a href="javascript:void(0)" onclick="change_tab_style('itemNew', 'h2',

this);get_cat_recommend(2, 0);">{$lang.all_goods}</a></h2>

      {foreach from=$cat_rec[2] item=rec_data}

      <h2 class="h2bg"><a href="javascript:void(0)" onclick="change_tab_style('itemNew',

'h2', this);get_cat_recommend(2, {$rec_data.cat_id})">{$rec_data.cat_name}</a></h2>

      {/foreach}

      {/if}

  </div>

  <div id="show_new_area" class="clearfix goodsBox">

  <!-- {/if} -->

  <!--{foreach from=$new_goods item=goods}-->

  <div class="goodsItem">

         <span class="news"></span>

           <a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}"

class="goodsimg" /></a><br />

           <p><a href="{$goods.url}" title="{$goods.name|escape:html}">

{$goods.short_style_name}</a></p>

           <font class="f1">

           <!-- {if $goods.promote_price neq ""} -->

          {$goods.promote_price}

          <!-- {else}-->

          {$goods.shop_price}

          <!--{/if}-->

           </font>

        </div>

  <!--{/foreach}-->

  <div class="more"><a href="../search.php?intro=new"><img src="images/more.gif"

/></a></div>

  <!-- {if $cat_rec_sign neq 1} -->

  </div>

</div>

</div>

<div class="blank5"></div>

  <!-- {/if} -->

<!-- {/if} -->

 <!-- #EndLibraryItem -->

//热销商品

<!-- #BeginLibraryItem "/library/recommend_hot.lbi" -->

<!-- {if $hot_goods} -->

<!-- {if $cat_rec_sign neq 1} -->

<div class="box">

<div class="box_2 centerPadd">

  <div class="itemTit Hot" id="itemHot">

      {if $cat_rec[3]}

      <h2><a href="javascript:void(0)" onclick="change_tab_style('itemHot', 'h2',

this);get_cat_recommend(3, 0);">{$lang.all_goods}</a></h2>

      {foreach from=$cat_rec[3] item=rec_data}

      <h2 class="h2bg"><a href="javascript:void(0)" onclick="change_tab_style('itemHot',

'h2', this);get_cat_recommend(3, {$rec_data.cat_id})">{$rec_data.cat_name}</a></h2>

      {/foreach}

      {/if}

  </div>

  <div id="show_hot_area" class="clearfix goodsBox">

  <!-- {/if} -->

  <!--{foreach from=$hot_goods item=goods}-->

  <div class="goodsItem">

         <span class="hot"></span>

           <a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}"

class="goodsimg" /></a><br />

           <p><a href="{$goods.url}" title="{$goods.name|escape:html}">{$goods.short_style_name}</a></p>

           <font class="f1">

           <!-- {if $goods.promote_price neq ""} -->

          {$goods.promote_price}

          <!-- {else}-->

          {$goods.shop_price}

          <!--{/if}-->

           </font>

        </div>

  <!--{/foreach}-->

  <div class="more"><a href="../search.php?intro=hot"><img src="images/more.gif" /></a></div>

  <!-- {if $cat_rec_sign neq 1} -->

  </div>

</div>

</div>

<div class="blank5"></div>

  <!-- {/if} -->

<!-- {/if} -->

 

 <!-- #EndLibraryItem -->

//拍卖商品

<!-- #BeginLibraryItem "/library/auction.lbi" -->

<!-- {if $auction_list} -->

<div class="box">

 <div class="box_1">

  <h3><span>{$lang.auction_goods}</span><a href="auction.php"><img src="../images/more.gif"></a></h3>

    <div class="centerPadd">

    <div class="clearfix goodsBox"

escape:html}" class="goodsimg" /></a><br /> <p><a href="{$auction.url}" title="{$auction.goods_name|escape:html}">

{$auction.short_style_name|escape:html}</a></p>

           <font class="shop_s">{$auction.formated_start_price}</font>

        </div>

      <!--{/foreach}-->

    </div>

    </div>

 </div>

</div>

<div class="blank5"></div>

<!-- {/if} -->

 <!-- #EndLibraryItem -->

//团购商品

<!-- #BeginLibraryItem "/library/group_buy.lbi" -->

<!-- {if $group_buy_goods} -->

<div class="box">

 <div class="box_1">

  <h3><span>{$lang.group_buy_goods}</span><a href="group_buy.php"><img

src="../images/more.gif"></a></h3>

    <div class="centerPadd">

    <div class="clearfix goodsBox"

escape:html}" class="goodsimg" /></a><br />

<p><a href="{$goods.url}"

title="{$goods.goods_name|escape:html}">{$goods.short_style_name|escape:html}</a></p>

           <font class="shop_s">{$goods.last_price}</font>

        </div>

      <!--{/foreach}-->

    </div>

    </div>

 </div>

</div>

<div class="blank5"></div>

<!-- {/if} -->

 <!-- #EndLibraryItem -->

<!-- TemplateEndEditable -->

  </div>

  <!--right end-->

</div>

<div class="blank5"></div>

<!--帮助-->

<div class="block">

  <div class="box">

   <div class="helpTitBg clearfix">

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

   </div>

  </div>

</div>

<div class="blank"></div>

<!--帮助-->

<!--友情链接 start-->

<!--{if $img_links  or $txt_links }-->

<div id="bottomNav" class="box">

 <div class="box_1">

  <div class="links clearfix">

    <!--开始图片类型的友情链接{foreach from=$img_links item=link}-->

    <a href="{$link.url}" target="_blank" title="{$link.name}"><img src="{$link.logo}"

alt="{$link.name}" border="0" /></a>

    <!--结束图片类型的友情链接{/foreach}-->

    <!-- {if $txt_links} -->

    <!--开始文字类型的友情链接{foreach from=$txt_links item=link}-->

    [<a href="{$link.url}" target="_blank" title="{$link.name}">{$link.name}</a>]

    <!--结束文字类型的友情链接{/foreach}-->

    <!-- {/if} -->

  </div>

 </div>

</div>

<!--{/if}-->

<!--友情链接 end-->

<div class="blank"></div>

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

</body>

</html>

 以上优易软件为大家详细解说了index.dwt文件中各个代码区域代表的内容,那么我们在接下来的教程中就是针对相关代码进行修改,来进行二次开发


 

 




支付宝扫码打赏 微信打赏

如果文章对您有帮助,就打赏一个吧

在线客服

客户服务

热线电话:

0755-36656507 15889489919 服务时间:

周一到周六:9:00-18:00

在线QQ客服

在线微信客服

关于我们 常见问题

支付方式 加盟合作

提交需求
优惠红包 购物车0 反馈留言 返回顶部