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 getModNameByPid() { $page = Pagemanger::model()->find(array('select'=>'title','condition'=>"id=$this->parent_id")); if($page){ return $page->title; }else{ return '不存在该页面'; } }