/** * Display detailed page of Article * * @param void * @access public * @author Nguyen Van Hiep * * @version 1.0 * @since 1.0 */ public function action_view() { $art_check = Model_Article::get_art_from_slug(Uri::segment(2)); if (!$art_check) { Response::redirect('common/error'); } $uri = explode('-', Uri::string()); $id = array_pop($uri); $art = Model_Article::find($id); $cat = Model_Categories::get_cat_from_slug(Uri::segment(1)); $related_arts = Model_Article::articles_of_cat_limit($cat->id, $this->lang, $id); if (!$art) { Session::set_flash('error', __('message.art_not_exist')); Response::redirect('common/404'); } $art->views = $art->views + 1; $art->save(); if ($cat->display_type == DS_SANPHAM) { $this->template = \View::forge('customer/template_sanpham_detail'); $view = View::forge('customer/article/detail_sp_slide'); } elseif ($cat->display_type == DS_MONAN) { $this->template = \View::forge('customer/template_monan'); $view = View::forge('customer/article/detail_monan_slide'); } elseif ($cat->display_type == QUY_TRINH_SX) { $view = View::forge('customer/article/detail_quytrinhsx'); } else { $view = View::forge('customer/article/detail'); } $view->art = $art; $view->related_arts = $related_arts; $view->cat = $cat; if (!empty($cat->parent_id)) { $view->p_cat = Model_Categories::find($cat->parent_id); } // data to display menu $this->template->cats = Model_Categories::get_cats_home($this->lang); $this->template->pepper_arts = Model_Article::pepper_artilces($this->lang); $this->template->title = Security::strip_tags($art->title); $this->template->content = $view; }
/** * Display article-list of category - article-list * * params array $arts articles * params object $cat Category * return void * * @version 1.0 * @since 1.0 * @access protected * @author Nguyen Van Hiep */ protected function article_list($arts, $cat) { $view = View::forge('customer/cat/cat_article_list'); $view->cat = $cat; $view->arts = $arts; $view->lang = $this->lang; $view->hot_arts = Model_Article::hot_articles($cat->id, $this->lang); $view->show_arts = Model_Article::articles_of_cat_limit($cat->id, $this->lang, null); $this->template->title = Security::strip_tags($cat->name); $this->template->content = $view; }