public function actionCategory() { $category_db = new CategoryDB(); $category_db->load($this->request->id); if (!$category_db->isSaved()) { $this->notFound(); } else { $this->section_id = $category_db->section_id; $this->title = $category_db->title; $this->meta_desc = $category_db->meta_desc; $this->meta_key = $category_db->meta_key; $section_db = new SectionDB(); $section_db->load($category_db->section_id); $hornav = $this->getHornav(); //горизонтальная навигация $hornav->addData($section_db->title, $section_db->link); $hornav->addData($category_db->title); $intro = new Intro(); $intro->hornav = $hornav; $intro->obj = $category_db; $category = new Category(); $articles = ArticleDB::getAllOnCatID($this->request->id, Config::COUNT_ARTICLES_ON_PAGE); $more_articles = ArticleDB::getAllOnSectionID($this->request->id, false, false); $category->articles = $articles; $this->render($intro . $category); } }
public function actionSection() { $section_db = new SectionDB(); $section_db->load($this->request->id); if (!$section_db->isSaved()) { $this->notFound(); } $this->section_id = $section_db->id; $this->title = $section_db->title; $this->meta_desc = $section_db->meta_desc; $this->meta_key = $section_db->meta_key; $hornav = $this->getHornav(); $hornav->addData($section_db->title); $intro = new Intro(); $intro->hornav = $hornav; $intro->obj = $section_db; $blog = new Blog(); $articles = ArticleDB::getAllOnPageAndSectionID($this->request->id, Config::COUNT_ARTICLES_ON_PAGE); $more_articles = ArticleDB::getAllOnSectionID($this->request->id, false); $i = 0; foreach ($more_articles as $id => $article) { $i++; unset($more_articles[$id]); if ($i == Config::COUNT_ARTICLES_ON_PAGE) { break; } } $blog->articles = $articles; $blog->more_articles = $more_articles; $this->render($intro . $blog); }