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" ]}</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>
|
请发表评论