Yii 模板支持原生语法吗
Yii 模板支持原生语法吗?
Yii模板支持原生语法,因为Yii框架并没有使用模板引擎,所以能够在Yii模板中使用原生PHP语法,Yii模板并没有使用像Smarty那样将自定义的标签编译成PHP,而是对PHP原生态语法的封装。
Yii 模板标签
label标签
<?php echo $form->labelEx($model,'name'); ?>
编译后:
<label for="Project_name" class="required">项目名称 <span class="required">*</span></label>
文本标签
<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>128)); ?>
编译后:
<input size="60" maxlength="128" name="Project[name]" type="text">
error标签
<?php echo $form->error($model,'name'); ?>
编译后:
<div class="errorMessage">{变量}</div>
textarea标签
<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
编译后:
<textarea rows="6" cols="50" name="Project[description]" class="error"></textarea>
hidden标签
<?php echo $form->hiddenField($model,'create_time',array('value'=>time())); ?>
编译后:
<input value="1376475100" name="Project[create_time]" type="hidden">
password标签
<?php echo $form->passwordField($model,'password'); ?>
编译后:
<input name="Project[password]" type="password">
url标签
<?php echo $form->urlField($model,'url'); ?>
编译后:
<input name="Project[url]" type="url">
radio标签
<?php echo $form->radioButtonList($model, 'update_time', array('1'=>'分页','0'=>'不分页')); ?>
编译后:
<input type="hidden" value="" name="Project[update_time]">
<span id="Project_update_time"><input value="1" type="radio" name="Project[update_time]"> <label for="Project_update_time_0">分页</label><br>
<input value="0" type="radio" name="Project[update_time]">
<label for="Project_update_time_1">不分页</label></span>
file标签
<?php echo $form->fileField($model, 'update_time'); ?>
编译后:
<input type="hidden" value="" name="Project[update_time]">
<input name="Project[update_time]" type="file">
button标签
<?php echo CHtml::submitButton($model->isNewRecord ? '创建' : '保存'); ?>
编译后:
<input type="submit" name="yt0" value="创建">
checkBox标签
<?php echo $form->checkBox($model, 'update_time',array('checked'=>'checked')); ?>
编译后:
<input type="hidden" value="0" name="Project[update_time]">
<input checked="checked" name="Project[update_time]" value="1" type="checkbox">
select标签
<?php echo $form->dropDownList($model, 'update_time', array('1'=>'分页','0'=>'不分页')); ?>
编译后:
<select name="Project[update_time]" id="Project_update_time">
<option value="1">分页</option>
<option value="0">不分页</option>
</select>
select标签
<?php echo $form->listBox($model, 'update_time', array('1'=>'分页','0'=>'不分页')); ?>
编译后:
<select size="4" name="Project[update_time]" id="Project_update_time">
<option value="1">分页</option>
<option value="0">不分页</option>
</select>
checkbox标签
<?php echo $form->checkBoxList($model, 'update_time', array('1'=>'分页','0'=>'不分页')); ?>
编译后:
<input type="hidden" value="" name="Project[update_time]"><span id="Project_update_time"><input value="1" type="checkbox" name="Project[update_time][]"> <label for="Project_update_time_0">分页</label><br>
<input value="0" type="checkbox" name="Project[update_time][]"> <label for="Project_update_time_1">不分页</label></span>
date标签
<?php echo $form->dateField($model, 'update_time'); ?>
编译后:
<input name="Project[update_time]" type="date">
number标签
<?php echo $form->numberField($model, 'number'); ?>
编译后:
<input name="Project[number]" type="number">
email标签
<?php echo $form->emailField($model, 'email'); ?>
编译后:
<input name="Project[email]" type="email">
label标签
<?php echo $form->label($model, 'update_time'); ?>
编译后:
<label for="Project_update_time">更新时间</label>
本文出至:学新通
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通
- 本文地址: https://www.swvq.com/boutique/detail/15767
- 联系方式: luke.wu@swvq.com
- 来源链接: www.php.cn/phpkj/yii/450953.html
系列文章
更多
精彩评论
-
windows上查看nginx是否启动
PHP中文网 04-19 -
2023年最新的28道PHP面试题附答案
PHP中文网 03-27 -
navicat怎样清除注册表
PHP中文网 04-05 -
推荐五款xml编辑工具
PHP中文网 03-04 -
docker hub 进不去怎么办
PHP中文网 03-15 -
ChatGPT应用通过Axios+EventSource使用GPT3.5 API
uWydnA 03-13 -
强力推荐10款好看使用的Bootstrap后台管理系统模板
PHP中文网 03-09 -
vscode怎么调整代码大小两种方法
PHP中文网 03-11 -
navicat连接sqlserver数据库
PHP中文网 04-03 -
navicat删除的数据能还原吗
PHP中文网 04-09