public function run() { //$comments = Comment::find()->where(['status' => Comment::STATUS_ACTIVE])->orderBy(['create_time' => SORT_DESC])->limit($this->maxComments)->all(); $portlet = CmsCatalog::getRootCatalogSub2($this->id, CmsCatalog::find()->all()); $rootCatalog = CmsCatalog::findOne(['id' => CmsCatalog::getRootCatalogId($this->id, CmsCatalog::find()->asArray()->all())]); $portletTitle = $rootCatalog ? $rootCatalog->title : ''; if (!($portlet && $portletTitle)) { return; } return $this->render('sideMenu', ['title' => $portletTitle, 'portlet' => $portlet]); }
public function actionPage($id) { if (!$id) { $this->goHome(); } $page = CmsCatalog::findOne($id); return $this->render($page->template_page, ['page' => $page]); }
/** * Finds the CmsCatalog model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CmsCatalog the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CmsCatalog::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }