zoukankan      html  css  js  c++  java
  • ecshop二次开发常用代码

    通过index控制循环次数。在循环中将index作为if的判断条件,对循环进行控制。这里index是从0开始的。如果index<2,会进行两次循环。

    <!--{foreach from=$child.cat_id item=childer name=cats}-->
    {if $smarty.foreach.cats.index <2}
    <dd>{$childer.name|escape:html}</dd>
    {/if}
    <!--{/foreach}-->

    加入购物车:

    <a href="javascript:addToCartShowDiv({$goods.id},1,'new')"  ></a>

    foreach判断不是最后一个:

    <!--{foreach from=$cat_goods item=goods name=nocat}--> 
          {if $smarty.foreach.nocat.index ==0}
          <div class="brand_list">
            <div class="brand_img"> <a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" width="170" height="340" /></a></div>
          </div>
          {else}
          {if !$smarty.foreach.nocat.last}
          <div class="brand_list">
            <div class="brand_img"> <a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" width="170" height="170" /></a></div>
          </div>
          {/if} 
          {/if}
    <!--{/foreach}--> 

    调用广告:

    {insert name='ads' id=1 num=2}
    调用1号广告位里最新的两个广告内容

    查看广告位置id方法:

    ECSHOP 管理中心 - 广告位置,找到相对应广告,鼠标触碰到相对应广告,那么广告栏会显示个链接,如下图

    链接处的101就是广告位的id。

  • 相关阅读:
    自动化运维与Saltstack
    keepalived+nginx 高可用集群
    Nginx集群(负载均衡)
    Nginx优化
    Nginx管理(一)
    业务环境、测试、上线逻辑
    服务器部署逻辑
    python面试题——爬虫相关
    springmvc文件上传
    springmvc入门
  • 原文地址:https://www.cnblogs.com/woodk/p/5073941.html
Copyright © 2011-2022 走看看