HBcms是一个用Pear框架+Smarty模板引擎构架的cms项目,欢迎大家参与制作Smarty模板

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
Smarty手册范例 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}


	输出结果:

	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>
这是一份简单的Smarty手册和Smarty教材,熟练掌握Smarty模板,让您做项目事半功倍