标签名称不限,标签位置不限,支持单双引号 (JS中不能使用标标签) * [ ] 引入其他模板 ``` <div php-file="tpl.php"></div> ``` * [ ] show ``` <a href="/article/lists?p={$p-1}" php-show='$p<2'>下一页</a> <?php if($this->obtain('p')<2){?> <a href="/article/lists?p=<?php echo $this->obtain('p')-1;?>">下一页</a> <?php }?> ``` * [ ] selected ``` <select class="form-control"> <option php-for="$i = 1; $i <= 50; $i++" php-selected="$p == $i" value="{$i}">第{$i}页</option> </select> <?php for($this->TplData['i'] = 1; $this->TplData['i'] <= 50; $this->TplData['i']++){?> <option<?php if($this->obtain('p') == $this->obtain('i')){?> selected="selected" <?php }?> value="<?php $this->obtain('i');?>">第<?php $this->obtain('i');?>页</option> <?php }?> ``` * [ ] checked ``` <input type="radio" name="sex" value="0" php-checked="$user_sex === 0" /> <input type="radio" name="sex" value="0"<?php if($this->obtain('user_sex') === 0){?> checked="checked" <?php }?> /> ``` * [ ] if ``` <span php-if="$sex == 1">男</span> <span php-elseif="$sex == 0">女</span> <span php-else="">其他</span> <?php if($this->obtain('sex') == 1){?> <span>男</span> <?php }elseif($this->obtain('sex') == 0){?> <span>女</span> <?php }else{?> <span>其他</span> <?php }?> <div php-show='$is_downloa="aaaaaa" && $zxczxc==8' class="aaa"> <a php-show="$p<2" href="/article/lists?p={$p-1}">下一页</a> <input type="button" onclick="down()" /> <a php-show="$p>1" href="/article/lists?p={$p-2}">上一页</a> </div> <?php if($this->obtain('is_downloa')="aaaaaa" && $this->obtain('zxczxc')==8){?> <div class="aaa"> <?php if($this->obtain('p')<2){?> <a href="/article/lists?p=<?php echo $this->obtain('p')-1;?>">下一页</a> <?php }?> <input type="button" onclick="down()" /> <?php if($this->obtain('p')>1){?> <a href="/article/lists?p=<?php echo $this->obtain('p')-2;?>">上一页</a> <?php }?> ``` * [ ] foreach ``` <table> <tr php-foreach="$list as $article"> <td>{$article.id}</td> <td>{$article.title}</td> <td>{$article.author}</td> <td> <a href="/article/detail?id={$article.id}">查看</a> <a href="/article/del?id={$article.id}">删除</a> </td> </tr> </table> <table> <?php foreach($this->obtain('list') as $this->TplData['article']){?> <tr> <td><?php echo $this->obtain('article.id');?></td> <td><?php echo $this->obtain('article.title');?></td> <td><?php echo $this->obtain('article.author');?></td> <td> <a href="/article/detail?id=<?php echo $this->obtain('article.id');?>">查看</a> <a href="/article/del?id=<?php echo $this->obtain('article.id');?>">删除</a> </td> </tr> <?php }?> </table> ``` * [ ] for ``` <a php-for="$i = $page_start; $i <= $page_end; $i++" href="/article/lists?p={$i}">第{$i}页</a> <?php for($this->TplData['i'] = $this->TplData['page_start']; $this->TplData['i'] <= $this->TplData['page_end']; $this->TplData['i']++){?> <a href="/article/lists?p=<?php echo $this->obtain('i');?>">第<?php echo $this->obtain('i');?>页</a> <?php }?> ``` * [ ] switch ``` <div php-switch="$status"> <span php-case="1"> 正常 </span> <span php-case="2"> 待审核 </span> <span php-case="stop"> 已禁用 </span> <span php-case="$del"> 已删除 </span> <span php-default=""> 未知状态 </span> </div> <?php switch ($this->obtain('status')){?> <div> <?php case 1:?> <span> 正常 </span> <?php break;?> <?php case 2:?> <span> 待审核 </span> <?php break;?> <?php case "stop":?> <span> 已禁用 </span> <?php break;?> <?php case $this->obtain('del'):?> <span> 已删除 </span> <?php break;?> <?php default:?> <span> 未知状态 </span> <?php break;?> </div> <?php }?> ```