Example #1
0
 public function listTaggedTopics($tag, $page = 1)
 {
     $posts_per_page = \CODOF\Util::get_opt("num_posts_all_topics");
     if ($page == null) {
         $page = 1;
     }
     $page = (int) $page;
     if ($page <= 1) {
         $from = 0;
     } else {
         $from = ($page - 1) * $posts_per_page;
     }
     $topics = new \Controller\Ajax\forum\topics();
     $taggedTopics = $topics->getTaggedTopics($tag, $from);
     $topic = new \CODOF\Forum\Topic($this->db);
     $num_pages = $topic->get_num_pages($topic->getTaggedTopicsCount($tag), $posts_per_page);
     $url = 'tags/' . $tag . '/';
     $curr_page = $page;
     //var_dump($taggedTopics);
     $this->smarty->assign('tag', $tag);
     $this->smarty->assign('curr_page', $curr_page);
     $this->smarty->assign('url', RURI . $url);
     $this->smarty->assign('num_pages', $num_pages);
     $this->smarty->assign('topics', json_encode($taggedTopics));
     $this->smarty->assign('tags', json_encode($taggedTopics['tags']));
     $this->css_files = array('tags');
     $this->js_files = array(array('tags/tags.js', array('type' => 'defer')));
     $this->view = 'forum/tags';
     \CODOF\Store::set('sub_title', $tag . ' - ' . _t('Tags'));
 }