带menu的面包屑exbreadcrumbs支持自定义css。http://www.yiiframework.com/extension/exbreadcrumbs
CGridView总计插件 http://www.yiiframework.com/extension/gridcolumns/
多文件上传
- <?php echo $form->textField($model,'file[]',array('id'=>'file'));?>
- <?php echo CHtml::activeFileField($model,'xian[]',array('id'=>'xiangguan'));?>
textArea
- <?php echo $form->textArea($model,'describe',array('cols'=>40,'rows'=>4)); ?>
checkbox
- <?php echo $form->checkBoxList($model,'fid',array('1'=>'中国', '2'=>'日本')); ?>
- <?php echo CHtml::checkBox('id[]',''); ?>
- <?php echo $form->checkbox($model,'province', array('value'=>'上海市','uncheckValue'=>'')); ?>
斜杠是从views目录开始写的
- $this->render( "/site/flash_message"); //完整路径 view/site/flash_message.php
当 使用 render()时,布局被隐式应用.视图脚本 protected/views/layouts/main.php是默认的布局文件 .
- public $layout='//layouts/column2';
进行自定义。要渲染一个不带布局的视图,则需调用 renderPartial() 。
在view中调用layout
- <?php $this->beginContent('application.views.layouts.main'); ?>
- html between
- <?php $this->endContent(); ?>
下拉框 默认选中
- <?php echo CHtml::dropDownList('category', '',CHtml::listData($cat, 'id', 'category')); ?>
- <?php echo $form->dropDownList($model, 'type', array(1=>'User', 2=>'Admin'),array('prompt' =>'请选择','class'=>'a'), array('options'=>array('1'=>array('selected'=>true)))); ?>
Form表单标签
- <?php echo CHtml::beginForm(Yii::app()->createUrl($this->route));?>
- <?php echo CHtml::endForm(); ?>
- <?php $form=$this->beginWidget('CActiveForm', array(
- 'action'=>'index.php?r=site/update',
- 'enableAjaxValidation'=>false,
- )); ?>
- <?php $this->endWidget(); ?>
普通form注意加hidden r否则get得不到r=controllerid/actionid
- <form name="Product" action="<?php echo Yii::app()->createUrl($this->route);?>" method="GET">
- <input type="hidden" name="r" value="controllerid/actionid"/>
submit按钮
- <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
radios //給默认值
- <?php echo $form->radioButton($model,'province', array('value'=>'上海市','uncheckValue'=>'')); ?>
- <?php echo CHtml::radioButtonList('level', null, $levels); ?>
- <?php $model->gift=1;echo $form->radioButtonList($model,'gift',array('1'=>'是','0'=>'否'),array('separator'=>'')); ?>
链接
- <?php echo CHtml::link(CHtml::encode('link'), array('view', 'id'=>$data->Id)); ?>
阿萨德发