在smarty中使用if else
来源:互联网 发布:人工智能企业排名 编辑:程序博客网 时间:2024/05/25 18:12
(一)
php:
$smarty->assign("num",20);
tpl:
{if $num>10}
num>10
{else}num<10
{/if}
(二)
php:
$arr4=array(
array('id'=>'a001','email'=>'zhangsan@sohu.com','age'=>3,"sal"=>300),
array('id'=>'a002','email'=>'zhangsan1@sohu.com','age'=>12,"sal"=>330),
array('id'=>'a003','email'=>'zhangsan2@sohu.com','age'=>25,"sal"=>390)
);
$smarty->assign("myarr",$arr4);//引用模板文件
tpl:
{foreach from=$myarr item=item1}
{*二次循环*}
{if $item1.age<5}
{$item1.id} 你是小孩
<br/>
{else if $item1.age>=5 and $item1.age<=18}
{$item1.id}年轻人1
<br/>
{else if $item1.age>18}
{$item1.id}成年人
{/if}
{/foreach}
0 0
- 在smarty中使用if else
- Smarty if else /if 判断
- Smarty if else /if 判断
- 如何在代码中减少if else语句的使用
- Smarty if else /if判斷
- 如何在JSP页面中使用JSTL标签实现if和if-else判断
- 在jsp中if else的使用方法
- .net中if和else的使用
- mybatis 中使用if else 进行判断
- js在if else语句中var的变量在条件语句外可以使用吗?
- smarty if,elseif,else 新语法
- Smarty {if},{elseif},{else} --Built-in Functions
- smarty模板引擎之if, elseif else
- Smarty-内建函数(if,elseif,else)
- smarty模板引擎之if, elseif else
- Python中在for循环中嵌套使用if和else语句的技巧
- 如何在JSP页面中使用JSTL标签实现if和if-else判断,判断条件使用<%=value%>
- 如何在JSP页面中使用JSTL标签实现if-else判断
- fix questions
- 导购网站:差异化决定生死
- 以旧换新,iPhone5s免费拿
- iOS MD5加密
- Struts2源码学习(一)准备工作
- 在smarty中使用if else
- hadoop作业调优参数整理及原理
- 面试不是意味着给解决方案,有时候我们也应该质疑问题
- 修改adb devices的设备ID/设备号
- Python yield 使用浅析
- ACE网络框架学习体会
- 百度地图在android的使用
- poj 3714(典型的最近点对问题)
- Google搜索技巧与黑客入侵