/** * Display articles in category * * @param void * @access public * @author Nguyen Van Hiep * * @version 1.0 * @since 1.0 */ public function action_view() { $uri = explode('/', Uri::string()); $slug = str_replace('.html', '', $uri[1]); $cat = Model_Categories::get_cat_from_slug($slug); if (!$cat) { Response::redirect('common/404'); } $arts = Model_Article::articles_of_cat($cat->id, $this->lang, $cat->art_display_by_order); switch ($cat->display_type) { case DS_SANPHAM: //Hien thi phan [san pham] $this->ds_sanpham($arts, $cat); break; case CHUNGNHAN: //Hien thi phan [san pham] $this->chungnhan($arts, $cat); break; case VECHUNGTOI: //Hien thi phan [chung toi] $this->vechungtoi($arts, $cat); break; case THUONGHIEU: $this->thuonghieu($arts, $cat); break; case DS_TINTUC: $ret = $this->article_list($arts, $cat); break; // hien thi khi click vao AM THUC // hien thi khi click vao AM THUC case DS_MONAN: $this->ds_monan($arts, $cat); break; case QUY_TRINH_SX: $ret = $this->quytrinh_sx($arts, $cat); break; default: break; } }
/** * 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; }