public function actionModify($id) { $msg = ''; //输出页面 $page = Pagemanger::model()->findAll(array('select'=>'id,title')); $model = Pagemod::model()->findByPk($id); if(isset($_POST['Pagemod'])){ $model->title = $_POST['Pagemod']['title']; $model->parent_id = $_POST['Pagemod']['parent_id']; $model->description = $_POST['Pagemod']['description']; if(empty($model->title)){ $msg = ' × 名称必须填写'; }else{ $model->save(); } } $this->render('modify',array( 'model'=>$model, 'page'=>$page, 'msg'=>$msg, )); }
public function getPageMod($id) { $model = Pagemod::model()->find(array('select'=>'description','condition'=>"id=$id")); if($model){ return $model->description; }else{ return '未定义该区域内容'; } }