public function actionCategory($id = null, $slug = null)
    {
        if (!is_numeric($id) || $id < 1 || empty($slug)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the category you are looking for.'));
            return $this->redirect(['forum/index']);
        }
        $conditions = ['id' => $id, 'slug' => $slug];
        if ($this->module->user->isGuest) {
            $conditions['visible'] = 1;
        }
        $model = Category::find()->where($conditions)->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the category you are looking for.'));
            return $this->redirect(['forum/index']);
        }
        $this->setMetaTags($model->keywords, $model->description);
        return $this->render('category', ['model' => $model]);
    }
public function actionCategory($id = null, $slug = null)
    {
        if (!is_numeric($id) || $id < 1 || empty($slug)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the category you are looking for.'));
            return $this->redirect(['forum/index']);
        }
        $conditions = ['id' => $id, 'slug' => $slug];
        if ($this->module->user->isGuest) {
            $conditions['visible'] = 1;
        }
        $model = Category::find()->where($conditions)->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the category you are looking for.'));
            return $this->redirect(['forum/index']);
        }
        $this->setMetaTags($model->keywords, $model->description);
        return $this->render('category', ['model' => $model]);
    }
public function actionCategory ( $ id = null , $ slug = null ) { if ( ! is_numeric ( $ id ) || $ id < 1 || empty ( $ slug ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find the category you are looking for.' ) ) ; return $ this -> redirect ( [ 'forum/index' ] ) ; } $ conditions = [ 'id' => $ id , 'slug' => $ slug ] ; if ( $ this -> module -> user -> isGuest ) { $ conditions [ 'visible' ] = 1 ; } $ model = Category :: find ( ) -> where ( $ conditions ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ model ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find the category you are looking for.' ) ) ; return $ this -> redirect ( [ 'forum/index' ] ) ; } $ this -> setMetaTags ( $ model -> keywords , $ model -> description ) ; return $ this -> render ( 'category' , [ 'model' => $ model ] ) ; }
Displaying the category of given ID and slug.
@param int $id
@param string $slug
@return string|Response
Displaying the category of given ID and slug .