ѡ̳

标题: echop 模版里面获取循环的变量并使用函数 [打印本页]

作者: admin    时间: 2019-3-20 15:29
标题: echop 模版里面获取循环的变量并使用函数
{foreach from=$hot_list item=val  key=kgid}<?php

          $keyid = $GLOBALS['smarty']->_var['kgid'];
          $good_id =$GLOBALS['smarty']->_var['goods_list'][$keyid]['goods_id'];
          $properties = get_goods_properties($good_id);  // 获得商品的规格和属性
          $specification = $properties['spe'];

          $GLOBALS['smarty']->assign('specification', $specification);

  ?>
{foreach from=$specification item=spec key=spec_key}


           {foreach from=$spec.values item=value key=key}

              <input  id="spec_value_{$value.id}" type="radio" style="display:none;"   name="spec_{$spec_key}" value="{$value.id}" {if $key eq 0}checked{/if} />
             <label  for="spec_value_{$value.id}" style="display:none;"    {if $key eq 0} class="on"  {/if} >{$value.label}</label>
           {/foreach}

         <input type="hidden" name="spec_list" value="{$key}" />


  {/foreach}{/foreach}






欢迎光临 ѡ̳ (http://www.sunminxuan.cn/bbs/) Powered by Discuz! X3.4