如何獲得在智者foreach循環的最後一個索引值,即時通訊新的Smarty的我已經使用這個代碼,但它不工作如何找到foreach循環的最後指數智者
{foreach from=$cityList key=myId item=i name=foo}
{$i.location_name}{if $main_smarty.foreach.foo.last}<hr>{else}-{/if}
{/foreach}
我想,當他們的是最後一個城市名稱這種它來水平線後,否則其如印度 - 美國 - 日本 - 但最後它來到日本,中國
以.php我使用
<?php
include_once('Smarty.class.php');
$main_smarty = new Smarty;
query to find citylist
$main_smarty->assign('cityList',$cityList);
?>
請提供更多的代碼,所以我們可以確定問題,您提供的代碼段對我來說看起來沒問題,應該可以正常工作 – jigfox 2010-06-25 12:52:00