zoukankan      html  css  js  c++  java
  • Yii系列总结:yii 标签用法

    yii 常用标签:label标签、文本标签、error标签、textarea标签、hidden标签、password标签、url标签、radio标签、file标签、button标签、checkBox标签、select标签等等

    1. 1、模板中的label标签:

      编译前:

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

      编译后:

      <label for="Project_name" class="required">项目名称 <span class="required">*</span></label>

    2. 2

      2、模板中的文本标签:

      编译前:

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

      编译后:

      <input size="60" maxlength="128" name="Project[name]" id="Project_name" type="text">

    3. 3

      3、模板中的error标签

      编译前:

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

      编译后:

      <div class="errorMessage">{变量}</div>

    4. 4

      4、模板中的textarea标签

      编译前:

      <?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>

    5. 5

      5、模板中的hidden标签

      编译前:

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

      编译后:

      <input value="1376475100" name="Project[create_time]" id="Project_create_time" type="hidden">

    6. 6

      6、模板中的password标签

      编译前:

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

      编译后:

      <input name="Project[password]" id="Project_password" type="password">

    7. 7、模板中的url标签

      编译前:

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

      编译后:

      <input name="Project[url]" id="Project_url" type="url">

    8. 8、模板中的radio标签

      编译前:

      <?php echo $form->radioButtonList($model, 'update_time', array('1'=>'分页','0'=>'不分页')); ?>

      编译后:

      <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">分页</label><br>

      <input id="Project_update_time_1" value="0" type="radio" name="Project[update_time]"> 

      <label for="Project_update_time_1">不分页</label></span>

    9. 9、模板中的file标签

      编译前:

      <?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">

    10. 10、模板中的button标签

      编译前:

      <?php echo CHtml::submitButton($model->isNewRecord ? '创建' : '保存'); ?>

      编译后:

      <input type="submit" name="yt0" value="创建">

    11. 11、模板中的checkBox标签

      编译前:

      <?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">

    12. 12、模板中的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>

    13. 13、模板中的checkbox标签

      编译前:

      <?php echo $form->checkBoxList($model, 'update_time', array('1'=>'分页','0'=>'不分页')); ?>

      编译后:

      <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">分页</label><br>

      <input id="Project_update_time_1" value="0" type="checkbox" name="Project[update_time][]"> <label for="Project_update_time_1">不分页</label></span>

    14. 14、模板中的date标签

      编译前:

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

      编译后:

      <input name="Project[update_time]" id="Project_update_time" type="date">

    15. 15、模板中的number标签

      编译前:

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

      编译后:

      <input name="Project[number]" id="Project_number" type="number">

    16. 16、模板中的email标签

      编译前:

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

      编译后:

      <input name="Project[email]" id="Project_email" type="email">

    如果您觉得本文对你有用,不妨帮忙点个赞,或者在评论里给我一句赞美,小小成就都是今后继续为大家编写优质文章的动力,小九妹拜谢! 欢迎您持续关注我的博客:)

    作者:小九妹
    出处: http://www.cnblogs.com/jiumei/
    版权所有,欢迎保留原文链接进行转载:)

  • 相关阅读:
    TCP/IP——IP网络协议简记
    TCP/IP——基础概念简记
    TCP/IP——链路层简记
    linux——(8)数据流重定向、管道命令
    linux——(7)了解shell
    linux——(6)vim与vi
    linux——(5)文件与文件系统的压缩与打包
    linux——(4)磁盘与文件系统管理
    linux——(3)文件与目录管理
    大数据--Spark原理
  • 原文地址:https://www.cnblogs.com/jiumei/p/5109705.html
Copyright © 2011-2022 走看看