谁能帮我把这个写个判断啊?

2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家


  1. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  2. <!-- {if $new_goods} -->
  3. <!-- {if $cat_rec_sign neq 1} -->

  4. <UL class=dx01_np_tuijian>
  5. <!-- {/if} -->
  6. <!--{foreach from=$new_goods item=goods}-->
  7. <LI>
  8. <DL>
  9. -------------------------------------------------------------------------------------------------------------

  10. 当是第一信息的时候 输出:如下

  11. <DT class=hdefind><a href="{$goods.url}" title="{$goods.name|escape:html}"><H3>{$goods.short_style_name}</H3></A>
  12. <DDid=dx01_np_tuijian_08><a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" width="212" height="129" /></a> </DD>


  13. 否则输出如下:


  14. <DT class=hdefind><a href="{$goods.url}" title="{$goods.name|escape:html}"><H3>{$goods.short_style_name}</H3></A>
  15. <DD style="DISPLAY: none" id=dx01_np_tuijian_08><a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" width="212" height="129" /></a> </DD>


  16. ------------------------------------------------------------------------------------------------------
  17. </DL>
  18. </LI>
  19. <!--{/foreach}-->
  20. </UL>


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

  22. <!-- {/if} -->
  23. <!-- {/if} -->
复制代码

回答:
谁能帮下我啊·

  1. {foreach name=new_goodsfrom=$new_goodsitem=goods}


  2. {if $smarty.foreach.new_goods.first}

  3. //如果是第一条

  4. {else}

  5. // 如果不是第一条

  6. {/if}


  7. {/foreach}
复制代码

谢谢斑竹大人

郁闷·时不时我哪搞错了··执行部了判断呢




这是我的源代码:
不知道为什么就是执行不了判断!执行出来的结果就是 当之后的结果



<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<!-- {if $new_goods} -->
<!-- {if $cat_rec_sign neq 1} -->

<UL class=dx01_np_tuijian>
<!-- {/if} -->
<!-- {foreach from=$new_goods item=goods} -->
<LI>
<DL>

<!-- {if $smarty.foreach.new_goods.first} -->


<DT class=hdefind><a href="{$goods.url}" title="{$goods.name|escape:html}"><H3>{$goods.short_style_name}</H3></A>
<DD id=dx01_np_tuijian_08><a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" width="212" height="129" /></a> </DD>

<!-- {else} -->

<DT class=hdefind><a href="{$goods.url}" title="{$goods.name|escape:html}"><H3>{$goods.short_style_name}</H3></A>
<DD style="DISPLAY: none" id=dx01_np_tuijian_08><a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" width="212" height="129" /></a> </DD>

<!-- {/if} -->

</DL>
</LI>
<!-- {/foreach} -->
</UL>


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

<!-- {/if} -->
<!-- {/if} -->

顶下谁帮下我啊··

没看出问题出来

你都没仔细看小刀的代码
{foreach name=new_goodsfrom=$new_goodsitem=goods}
这里面的 name=new_goods 没加上




厉害