摘要: 本文介绍下,在smarty模板中,实现类似for功能的一例代码,有需要的朋友,不妨研究学习下。需求:在页面使用smarty循环100次输出,类似for循环100次。例如:复制代码代码示例:{section name=total loop=100}{$smarty.section.total.index+1} //当前的索引{$smarty.section.total.iteration} //用于显示循环的次数{/section}还可以这样:复制代码代码示例:{assign var=i value=0}{section name=total loop=100}{assign var=i val 阅读全文
posted @ 2014-03-08 22:51 乌冬 阅读(678) 评论(0) 推荐(0) 编辑
摘要: 当我们有时候要更新 数据库中 同一个字段 根据不同情况更新不同的值,可以用update Table set field = (case XX when XXXX then XXXwhen xxxx then xxxxxxelse xxxx end)例:更改某行信息内容是否已被审核:update mle_info set info_audit = (case info_audit when 1 then 0 when 0 then 1 end) where id = 1 阅读全文
posted @ 2014-03-08 11:07 乌冬 阅读(1250) 评论(0) 推荐(0) 编辑