コード例 #1
0
ファイル: HomepagePresenter.php プロジェクト: krupaj/my-blog
 /**
  * @param string $id Web title tagu
  */
 public function actionTag($id)
 {
     list($webId, $webTitle) = Model\Entities\Tag::parseWebId($id);
     /** @var Model\Entities\Tag $this->objectWithArticles */
     $this->objectWithArticles = $this->tagRepository->getById($webId);
     if (!is_object($this->objectWithArticles)) {
         $this->flashMessage($this->translator->translate('system.tagNF'), self::MESSAGE_DANGER);
         $this->redirect('default');
     }
     $this->template->bgImage = "home-bg.jpg";
     $this->template->title = $this->objectWithArticles->getTitle();
     $this->template->description = $this->translator->translate('system.tag', 1);
     //nastaveni zajimavych clanku sekce
     $this->template->dPosts = $this->articleRepository->getMostDiscussedArticles();
     $this->template->rPosts = $this->articleRepository->getMostReadedArticles();
     $this->template->nPosts = $this->articleRepository->getRandArticles();
     //nastaveni strankovani
     $this->paginator = new \Nette\Utils\Paginator();
     $this->paginator->setItemsPerPage(self::POST_PER_PAGE);
     $this->paginator->setPage(1);
     $this->setView('articles');
 }