Example #1
0
 /**
  * Displays a single Category model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $categoryModel = new Category();
     $category = $categoryModel->getCategory($id);
     return $this->render('index', ['category' => $category, 'posts' => $category->getPosts(), 'categories' => $categoryModel->getCategories()]);
 }
Example #2
0
 public function init()
 {
     parent::init();
     $this->categoryArr = Category::getCategories();
 }
Example #3
0
 /**
  * Список постов.
  * @return string
  */
 public function actionIndex()
 {
     $post = new Post();
     $category = new Category();
     return $this->render('index', ['posts' => $post->getPublishedPosts(), 'categories' => $category->getCategories()]);
 }