index_prev

index_prev is used to display the previous loop index. on the first loop, this is set to -1.

index_prev 用于显示上一个循环索引值. 循环开始时,此值为-1.

Example 7-22. section property index_prev
例 7-22. section 的 index_prev 属性演示

	{section name=customer loop=$custid}
	{$smarty.section.customer.index} id: {$custid[customer]}<br>
	{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
	{if $custid[customer.index_prev] ne $custid[customer.index]}
 	The customer id changed<br>
	{/if}
	{/section}


	OUTPUT:

	0 id: 1000<br>
 	The customer id changed<br>
	1 id: 1001<br>
 	The customer id changed<br>
	2 id: 1002<br>
 	The customer id changed<br>