/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Ideology the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Ideology::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionIdeology() { $page = Ideology::model()->findByPk(1); $criteria = new CDbCriteria(); $criteria->group = 'id DESC'; $criteria->limit = 3; $criteria->condition = 'region_id = 12 OR region_id = 0'; $news = News::model()->findAll($criteria); $this->render('statutAndProgramm', array('page' => $page, 'news' => $news)); }