/**
  * 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 TextPage the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TextPage::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #2
0
 public function actionPage($id = false)
 {
     $this->menu = Category::model()->findAll();
     if ($id) {
         $model = TextPage::model()->findByPk($id);
         $this->pageTitle = 'Мобильный мир - ' . ($model->id == 1 ? 'о компании' : ($model->id == 2 ? 'доставка и оплата' : ($model->id == 3 ? 'контакты' : ($model->id == 4 ? 'сотрудничество' : ($model->id == 5 ? 'проверить статус заказа' : ($model->id == 6 ? 'забери товар в ближайшем магазине' : ''))))));
         $this->render('textPage', array('model' => $model));
     } else {
         $this->redirect('/main/index');
     }
 }