/**
  * 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 ArticleOfArea the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ArticleOfArea::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionArticleOfAreaDetail($id)
 {
     $model = ArticleOfArea::model()->findByAttributes(array('non_utf8_name' => $id));
     if ($model === null || $model->active == 0 || $model->delete == 1) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $this->pageTitle = $model->name . ' - ' . Config::model()->getValueByKey('sitetitle');
     $this->metaDescription = $model->metadescription;
     $this->metaKeywords = $model->metakeywords;
     // danh sach cac bai viet khac cung the loai
     $otherArticle = array();
     // danh sach cac category
     $criteria = new CDbCriteria();
     $criteria->addCondition("t.active=1");
     $criteria->addCondition("t.delete=0");
     $criteria->addCondition("t.id!=1");
     $criteria->order = "t.order, t.id DESC";
     $categories = ArticleCategories::model()->findAll($criteria);
     $this->render('article', array('model' => $model, 'otherArticle' => $otherArticle, 'categories' => $categories));
 }