{wf:if $smarty.section.product.rownum eq 4 or $smarty.section.product.rownum eq 5 or $smarty.section.product.rownum eq 6 or $smarty.section.product.rownum eq 10 or $smarty.section.product.rownum eq 11 or $smarty.section.product.rownum eq 12}要输出的内容{qf:/if}现在我的写法是这样的,但是明显太不合理了,问下大神怎么写方便
if(($n-1)/3%2 != 0)
echo $n."\t";
}
//output: 4 5 6 10 11 12 16 17 18
for($j=1;$j<=3;$j++){
echo $i*3+$j.' ';
}
echo '<br />';
}
他不是有个 cycle 控制变量吗?为什么不用!
test.php
include_once("smarty_inc.php");
$arr=array('a','b','c','d','e','f');
$smarty->assign('arr',$arr);
$smarty->display("test.tpl");
test.tpl
<table width="100px">
{section name=a loop=$arr}
<tr bgcolor="{cycle values="#eeeeee,#55eero"}">
<td>
{$arr[a]}
</td>
</tr>
{/section}
</table>