首页 > Web开发 > 详细

PHP之ThinkPHP模板标签操作

时间:2015-02-27 16:32:24      阅读:325      评论:0      收藏:0      [点我收藏+]

Action    :

$User=M("user");
     $list=$User->select();
     $this->assign("list",$list);
     $this->assign("index",1);
     $this->display();

 

前台模板标签

<h1>volist</h1>

<table>
<tr>
  <td>ID</td><td>UserName</td><td>Sex</td><td>Age</td>
</tr>
<volist name="list" id="item">
<tr>
  <td>{$item["id"]}</td><td>{$item["username"]}</td><td>{$item["sex"]}</td><td>{$item["age"]}</td>
</tr>
</volist>
</table>


<hr>

<h1>foreach</h1>
<table>
<tr>
  <td>ID</td><td>UserName</td><td>Sex</td><td>Age</td>
</tr>
<foreach name="list" item="item">
<tr>
  <td>{$item["id"]}</td><td>{$item["username"]}</td><td>{$item["sex"]}</td><td>{$item["age"]}</td>
</tr>
</foreach>
</table>


<h1>switch</h1>
<switch name="index">
  <case value="1" >1</case>
  <case value="0">0</case>
</switch>


<h1>if</h1>
<if condition="$index==1">1
 <elseif condition="$index==2"/>2
  <else/>0
</if>

 

PHP之ThinkPHP模板标签操作

原文:http://www.cnblogs.com/wangheblog/p/4303423.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!