FeController::renderPageSlug PHP Метод

renderPageSlug() публичный Метод

public renderPageSlug ( $slug )
    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!'));
        }
    }

Usage Example

Пример #1
0
 public function actionIndex()
 {
     $slug = isset($_GET['slug']) ? fn_clean_input($_GET['slug']) : '';
     if ($slug == '') {
         $slug = Yii::app()->settings->get('general', 'homepage');
     }
     parent::renderPageSlug($slug);
 }
All Usage Examples Of FeController::renderPageSlug