public function getSortList(){ $arr = array(); $arr[0]['id']=0; $arr[0]['name']="否"; $arr[1]['id']=1; $arr[1]['name']="是"; return CHtml::listData($arr, "id", "name"); //return CHtml::radioButtonList('issort','1', $arr); }
<div class="row"> <?php echo $form->labelEx($model,'issort'); ?> <?php echo $form->radioButtonList($model,'issort', Menu::model()->getSortList(),array('separator'=>'','template'=>'<span style="float:left;" class="radio">{input} {label}</span>')); ?> <?php echo $form->error($model,'issort'); ?> </div>
<style>
.radio{40px;}
.radio input{ float: left;}
.radio label{ float: left;margin-left:2px;}
</style>