function tags($url) { $title = $this->uri->segment(2); $level = 2; $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1); $dis['page'] = $page; $limit = 15; $offset = ($page - 1) * $limit; $tags = explode('-', $title); $title = implode(' ', $tags); $news = new Article(); $news->order_by('created', 'desc'); $news->group_start(); $news->like('tag_search', '%' . $title . '%'); $news->where(array('recycle' => 0)); $news->where_not_in('newscatalogue_id', array(90)); $news->group_end(); $news->get_paged($offset, $limit, TRUE); $dis['news'] = $news; $newsAll = new Article(); $newsAll->order_by('created', 'desc'); $newsAll->group_start(); $newsAll->like('tag_search', '%' . $title . '%'); $newsAll->where(array('recycle' => 0)); $newsAll->where_not_in('newscatalogue_id', array(90)); $newsAll->group_end(); $newsAll->get(); $total = $newsAll->result_count(); /*Begin pagination for product*/ $url = $this->uri->segment(1) . '/' . $this->uri->segment(2); $config['base_url'] = site_url($url); $config['total_rows'] = $total; $config['per_page'] = $limit; $config['use_page_numbers'] = TRUE; $config['uri_segment'] = 3; $config['num_links'] = 3; $config['full_tag_open'] = '<div class="news-pagination" style="padding-top: 10px;">'; $config['full_tag_close'] = "</div>"; $config['first_link'] = FALSE; $config['first_tag_open'] = ''; $config['first_tag_close'] = ''; $config['last_link'] = FALSE; $config['last_tag_open'] = ''; $config['last_tag_close'] = ''; $config['next_link'] = '>'; $config['next_tag_open'] = ''; $config['next_tag_close'] = ''; $config['prev_link'] = '<'; $config['prev_tag_open'] = ''; $config['prev_tag_close'] = ''; $config['num_tag_open'] = ''; $config['num_tag_close'] = ''; $config['cur_tag_open'] = '<span class="active">'; $config['cur_tag_close'] = '</span>'; $this->pagination->initialize($config); /*End pagination for product*/ $arrayCateNewsId = array(); foreach ($this->newsCate as $row) { $arrayCateNewsId[] = $row->id; } // get news view most $newViewMost = new Article(); $newViewMost->where('recycle', 0); $newViewMost->where_in('newscatalogue_id', $arrayCateNewsId); $newViewMost->order_by('view_count', 'desc'); $newViewMost->get(5); $dis['newViewMost'] = $newViewMost; $newNews = new Article(); $newNews->where('recycle', 0); $newNews->where_in('newscatalogue_id', $arrayCateNewsId); $newNews->order_by('created', 'desc'); $newNews->get(5); $dis['newNews'] = $newNews; // seo $this->page_title = 'Thông tin ' . $title . ' đầy đủ, cập nhật nhất'; $this->page_description = $title . ' với đầy đủ thông tin, cập nhật liên tục...'; $keyword = explode(' ', $this->page_title); $this->page_keyword = implode(',', $keyword); $dis['base_url'] = base_url(); $dis['view'] = 'front/tags'; $this->viewfront($dis); }