public function renderPageSlug($slug) { $slug = fn_clean_input($slug); $page = Page::model()->find(array('condition' => 'slug=:paramId', 'params' => array(':paramId' => $slug))); if ($page) { $this->layout = 'main'; $this->pageTitle = $page->title; $this->description = $page->description; $this->keywords = $page->keywords; //depend on the layout of the page, use the corresponding file to render $this->render('common.front_layouts.' . $page->layout . '.' . $page->display_type, array('page' => $page)); } else { throw new CHttpException('404', t('Oops! Page not found!')); } }
public function actionIndex() { $slug = isset($_GET['slug']) ? fn_clean_input($_GET['slug']) : ''; if ($slug == '') { $slug = Yii::app()->settings->get('general', 'homepage'); } parent::renderPageSlug($slug); }