Exemplo n.º 1
0
 /**
  * View detail nes
  */
 public function actionDetailnews()
 {
     $cache = Yii::app()->cache;
     $news_id = Yii::app()->getRequest()->getParam('id');
     $news = $cache->get(Yii::app()->params['cache_detailnews'] . $news_id);
     if ($news === false) {
         $news = WNews::Detailnews($news_id);
         $cache->set(Yii::app()->params['cache_detailnews'] . $news_id, $news, Yii::app()->params['cache_refresh']);
     }
     $arrNewsCategories = WNewsCategories::getCateNews();
     //var_dump($arrNewsCategories); exit();
     $arrRelates = WNews::getNewRelated($news_id, 'id', '');
     $arrRelateNew = WNews::getNewRelateNew($news_id, 'id', '');
     //var_dump($arrRelateNew); exit();
     $cateNews = WNewsCategories::getCateNewsById($news_id);
     $this->render('detailnews', array('model' => $news, 'arrRelates' => $arrRelates, 'arrRelateNew' => $arrRelateNew, 'arrNewsCategories' => $arrNewsCategories, 'cateNews' => $cateNews));
 }
Exemplo n.º 2
0
 public static function getNewsPromotion()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'status=:status and news_category_id=:news_category_id';
     $criteria->params = array(':status' => 1, ':news_category_id' => 1);
     $criteria->order = 'created_time DESC';
     $criteria->limit = 1;
     return WNews::model()->find($criteria);
 }