public function actionDetail() { $this->forward("/site/error", true); $new_id = (int) Yii::app()->request->getParam('id'); $from = Yii::app()->request->getParam('from', ''); $news = $detailnew = NewsModel::model()->findByPk($new_id); if (empty($news)) { $this->forward("/site/error", true); } $this->itemName = htmlspecialchars($detailnew->title); $this->keyword = $detailnew->title; $this->thumb = NewsModel::model()->getAvatarUrl($new_id, 's1'); $this->url = URLHelper::buildFriendlyURL("news", $detailnew ? $new_id : 0, Common::makeFriendlyUrl($detailnew->title ? $detailnew->title : " ")); $this->description = ""; if ($from == 'api') { $this->layout = false; } $this->render('detail', compact('news', 'from')); }