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。

  • 相关阅读:
    嵌入式系统之微处理器篇
    嵌入式系统之基础概念篇
    八大排序算法简述
    进程-PV操作
    实时操作系统与分时操作系统
    串口助手
    STM32通用定时器功能和用法
    三种主流芯片架构简单比较
    python 我的第一个自动化脚本
    jquery部分实用功能
  • 原文地址:https://www.cnblogs.com/woodk/p/5073941.html
Copyright © 2011-2022 走看看