Yii 模板支持原生語(yǔ)法嗎?

Yii 模板支持原生語(yǔ)法嗎?

Yii 模板支持原生語(yǔ)法嗎?

Yii模板支持原生語(yǔ)法,因?yàn)閅ii框架并沒有使用模板引擎,所以能夠在Yii模板中使用原生PHP語(yǔ)法,Yii模板并沒有使用像Smarty那樣將自定義的標(biāo)簽編譯成PHP,而是對(duì)PHP原生態(tài)語(yǔ)法的封裝。

Yii 模板標(biāo)簽

label標(biāo)簽

<?php  echo $form->labelEx($model,'name');??&gt;

編譯后:

<label>項(xiàng)目名稱?<span>*</span></label>

文本標(biāo)簽

<?php  echo $form->textField($model,'name',array('size'=&gt;60,'maxlength'=&gt;128));??&gt;

編譯后:

<input>

error標(biāo)簽

<?php  echo $form->error($model,'name');??&gt;

編譯后:

<div>{變量}</div>

textarea標(biāo)簽

<?php  echo $form->textArea($model,'description',array('rows'=&gt;6,?'cols'=&gt;50));??&gt;

編譯后:

<textarea></textarea>

hidden標(biāo)簽

<?php  echo $form->hiddenField($model,'create_time',array('value'=&gt;time()));??&gt;

編譯后:

<input>

password標(biāo)簽

<?php  echo $form->passwordField($model,'password');??&gt;

編譯后:

<input>

url標(biāo)簽

<?php  echo $form->urlField($model,'url');??&gt;

編譯后:

<input>

radio標(biāo)簽

<?php  echo $form->radioButtonList($model,?'update_time',?array('1'=&gt;'分頁(yè)','0'=&gt;'不分頁(yè)'));??&gt;

編譯后:

<input><input>?
<input>?

file標(biāo)簽

<?php  echo $form->fileField($model,?'update_time');??&gt;

編譯后:

<input><input>

button標(biāo)簽

<?php  echo CHtml::submitButton($model->isNewRecord???'創(chuàng)建'?:?'保存');??&gt;

編譯后:

<input>

checkbox標(biāo)簽

<?php  echo $form->checkBox($model,?'update_time',array('checked'=&gt;'checked'));??&gt;

編譯后:

<input><input>

select標(biāo)簽

<?php  echo $form->dropDownList($model,?'update_time',?array('1'=&gt;'分頁(yè)','0'=&gt;'不分頁(yè)'));??&gt;

編譯后:

<select><option>分頁(yè)</option> <option>不分頁(yè)</option></select>

select標(biāo)簽

<?php  echo $form->listBox($model,?'update_time',?array('1'=&gt;'分頁(yè)','0'=&gt;'不分頁(yè)'));??&gt;

編譯后:

<select><option>分頁(yè)</option> <option>不分頁(yè)</option></select>

checkbox標(biāo)簽

<?php  echo $form->checkBoxList($model,?'update_time',?array('1'=&gt;'分頁(yè)','0'=&gt;'不分頁(yè)'));??&gt;

編譯后:

<input><input>?
<input>?

date標(biāo)簽

?<?php  echo $form->dateField($model,?'update_time');??&gt;

編譯后:

<input>

number標(biāo)簽

<?php  echo $form->numberField($model,?'number');??&gt;

編譯后:

<input>

email標(biāo)簽

<?php  echo $form->emailField($model,?'email');??&gt;

編譯后:

<input>

label標(biāo)簽

?<?php  echo $form->label($model,?'update_time');??&gt;

編譯后:

<label>更新時(shí)間</label>

推薦教程:《Yii教程

? 版權(quán)聲明
THE END
喜歡就支持一下吧
點(diǎn)贊13 分享