這篇文章給大家分享的是有關(guān)Yii模板能不能夠支持原生語(yǔ)法的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。
創(chuàng)新互聯(lián)是一家專(zhuān)業(yè)從事網(wǎng)站制作、成都做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)的品牌網(wǎng)絡(luò)公司。如今是成都地區(qū)具影響力的網(wǎng)站設(shè)計(jì)公司,作為專(zhuān)業(yè)的成都網(wǎng)站建設(shè)公司,創(chuàng)新互聯(lián)依托強(qiáng)大的技術(shù)實(shí)力、以及多年的網(wǎng)站運(yùn)營(yíng)經(jīng)驗(yàn),為您提供專(zhuān)業(yè)的成都網(wǎng)站建設(shè)、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)及網(wǎng)站設(shè)計(jì)開(kāi)發(fā)服務(wù)!
Yii 模板支持原生語(yǔ)法嗎?
Yii模板支持原生語(yǔ)法,因?yàn)閅ii框架并沒(méi)有使用模板引擎,所以能夠在Yii模板中使用原生PHP語(yǔ)法,Yii模板并沒(méi)有使用像Smarty那樣將自定義的標(biāo)簽編譯成PHP,而是對(duì)PHP原生態(tài)語(yǔ)法的封裝。
Yii 模板標(biāo)簽
label標(biāo)簽
<?php echo $form->labelEx($model,'name'); ?>
編譯后:
<label for="Project_name" class="required">項(xiàng)目名稱(chēng) <span class="required">*</span></label>
文本標(biāo)簽
<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>128)); ?>
編譯后:
<input size="60" maxlength="128" name="Project[name]" id="Project_name" type="text">
error標(biāo)簽
<?php echo $form->error($model,'name'); ?>
編譯后:
<div class="errorMessage">{變量}</div>
textarea標(biāo)簽
<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
編譯后:
<textarea rows="6" cols="50" name="Project[description]" id="Project_description" class="error"></textarea>
hidden標(biāo)簽
<?php echo $form->hiddenField($model,'create_time',array('value'=>time())); ?>
編譯后:
<input value="1376475100" name="Project[create_time]" id="Project_create_time" type="hidden">
password標(biāo)簽
<?php echo $form->passwordField($model,'password'); ?>
編譯后:
<input name="Project[password]" id="Project_password" type="password">
url標(biāo)簽
<?php echo $form->urlField($model,'url'); ?>
編譯后:
<input name="Project[url]" id="Project_url" type="url">
radio標(biāo)簽
<?php echo $form->radioButtonList($model, 'update_time', array('1'=>'分頁(yè)','0'=>'不分頁(yè)')); ?>
編譯后:
<input id="ytProject_update_time" type="hidden" value="" name="Project[update_time]"> <span id="Project_update_time"><input id="Project_update_time_0" value="1" type="radio" name="Project[update_time]"> <label for="Project_update_time_0">分頁(yè)</label><br> <input id="Project_update_time_1" value="0" type="radio" name="Project[update_time]"> <label for="Project_update_time_1">不分頁(yè)</label></span>
file標(biāo)簽
<?php echo $form->fileField($model, 'update_time'); ?>
編譯后:
<input id="ytProject_update_time" type="hidden" value="" name="Project[update_time]"> <input name="Project[update_time]" id="Project_update_time" type="file">
button標(biāo)簽
<?php echo CHtml::submitButton($model->isNewRecord ? '創(chuàng)建' : '保存'); ?>
編譯后:
<input type="submit" name="yt0" value="創(chuàng)建">
checkBox標(biāo)簽
<?php echo $form->checkBox($model, 'update_time',array('checked'=>'checked')); ?>
編譯后:
<input id="ytProject_update_time" type="hidden" value="0" name="Project[update_time]"> <input checked="checked" name="Project[update_time]" id="Project_update_time" value="1" type="checkbox">
select標(biāo)簽
<?php echo $form->dropDownList($model, 'update_time', array('1'=>'分頁(yè)','0'=>'不分頁(yè)')); ?>
編譯后:
<select name="Project[update_time]" id="Project_update_time"> <option value="1">分頁(yè)</option> <option value="0">不分頁(yè)</option> </select>
select標(biāo)簽
<?php echo $form->listBox($model, 'update_time', array('1'=>'分頁(yè)','0'=>'不分頁(yè)')); ?>
編譯后:
<select size="4" name="Project[update_time]" id="Project_update_time"> <option value="1">分頁(yè)</option> <option value="0">不分頁(yè)</option> </select>
checkbox標(biāo)簽
<?php echo $form->checkBoxList($model, 'update_time', array('1'=>'分頁(yè)','0'=>'不分頁(yè)')); ?>
編譯后:
<input id="ytProject_update_time" type="hidden" value="" name="Project[update_time]"><span id="Project_update_time"><input id="Project_update_time_0" value="1" type="checkbox" name="Project[update_time][]"> <label for="Project_update_time_0">分頁(yè)</label><br> <input id="Project_update_time_1" value="0" type="checkbox" name="Project[update_time][]"> <label for="Project_update_time_1">不分頁(yè)</label></span>
date標(biāo)簽
<?php echo $form->dateField($model, 'update_time'); ?>
編譯后:
<input name="Project[update_time]" id="Project_update_time" type="date">
number標(biāo)簽
<?php echo $form->numberField($model, 'number'); ?>
編譯后:
<input name="Project[number]" id="Project_number" type="number">
email標(biāo)簽
<?php echo $form->emailField($model, 'email'); ?>
編譯后:
<input name="Project[email]" id="Project_email" type="email">
label標(biāo)簽
<?php echo $form->label($model, 'update_time'); ?>
編譯后:
<label for="Project_update_time">更新時(shí)間</label>
感謝各位的閱讀!關(guān)于“Yii模板能不能夠支持原生語(yǔ)法”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
文章題目:Yii模板能不能夠支持原生語(yǔ)法
文章位置:http://jinyejixie.com/article20/gpseco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、軟件開(kāi)發(fā)、微信公眾號(hào)、網(wǎng)站改版、電子商務(wù)、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容