function detail($title_none = NULL) { $cat_news_url = $this->uri->segment(1); $cat_news = new Newscatalogue(); $cat_news->where(array('name_none' => $cat_news_url))->get(); if (!$cat_news->exists()) { show_404(); } $dis['cat_news'] = $cat_news; $cat = $this->uri->segment(2); $category = new Newscatalogue(); $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get(); if (!$category->exists()) { show_404(); } $dis['category'] = $category; $title_none = geturlfromuri($this->uri->segment(3)); $news = new Article(); $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id)); $news->get(); if (!$news->exists()) { redirect(base_url() . $this->uri->segment(1, '') . '/' . $this->uri->segment(2, '')); die; } $dis['news'] = $news; $tag = $news->tag; $dis['tag'] = explode(',', $tag); $news->view_count = $news->view_count + 1; $news->save(); //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 15, TRUE); $dis['related_news'] = $related_news; $arrayCateNewsId = array(); foreach ($this->guideCate as $row) { $arrayCateNewsId[] = $row->id; } $arrayCateNewsId = array(); foreach ($this->guideCate 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; // get news view most $newView = new Article(); $newView->where('recycle', 0); $newView->where_in('newscatalogue_id', $arrayCateNewsId); $newView->order_by('created', 'desc'); $newView->get(5); $dis['newView'] = $newView; $this->page_title = $news->{'title_vietnamese'} . ' | SotayNhadat.vn'; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; $this->url = base_url() . substr($this->uri->uri_string, 1, strlen($this->uri->uri_string)); $this->isRobotFollow = 1; $dis['base_url'] = base_url(); $dis['view'] = 'front/guides/news_de'; $this->viewfront($dis); }
function detail($url) { $urlcat = $this->uri->segment(1); $category = new Newscatalogue(); $category->where(array('recycle' => 0, 'name_none' => $urlcat))->get(); if (!$category->exists()) { show_404(); } $dis['category'] = $category; $url = geturlfromuri($this->uri->segment(2)); $news = new Article(); $news->where(array('title_none' => $url, 'recycle' => 0)); $news->get(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; $this->page_title = $news->title_vietnamese; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 10, TRUE); $dis['related_news'] = $related_news; $dis['base_url'] = base_url(); $dis['view'] = 'front/newsother/news_de'; $this->viewfront($dis); }
function cat($cat = NULL, $offset = 0, $limit = 10) { $dis['cat_name'] = ''; $dis['cat_id'] = ''; $dis['name_none'] = ''; $category = new Newscatalogue(); $category->where(array('name_none' => $cat))->get(); if (!$category->exists()) { show_404(); } if ($cat == "khuyen-mai") { $this->menu_active = "khuyen-mai"; } $cat = $category->id; $dis['cat_id'] = $category->id; $dis['cat_name'] = $category->{'name_vietnamese'}; $dis['name_none'] = $category->name_none; //Category news $cat_news = new Article(); $cat_news->where(array('recycle' => 0)); $cat_news->where('active', 1); $cat_news->where('newscatalogue_id', $cat); $cat_news->order_by('created', 'desc'); $cat_news->get_paged($offset, $limit, TRUE); $dis['cat_news'] = $cat_news; // Pagination setPaginationVb('tin-tuc/c/' . gen_seo_url($dis['cat_name']), $cat_news->paged->total_rows, $limit, 4); //DDV news $ddv_news = new Article(); $ddv_news->where('recycle', 0); $ddv_news->where('active', 1); $ddv_news->where('newscatalogue_id', 59); $ddv_news->order_by('created', 'DESC'); $ddv_news->get_paged(0, 4, TRUE); $dis['ddv_news'] = $ddv_news; $cat_ddv = new Newscatalogue(); $cat_ddv->where(array('id' => 59))->get(); $dis['cat_ddv'] = $cat_ddv->name_vietnamese; $dis['cat_ddv_none'] = $cat_ddv->name_none; //link counter $links_counter = new Article(); $links_counter->where('recycle', 0); $links_counter->where('active', 1); $links_counter->order_by('clicks', 'DESC'); $links_counter->get_paged(0, 10, TRUE); $dis['links_counter'] = $links_counter; //Video on youtube $videos = new Article(); $videos->where('recycle', 0); $videos->where('active', 1); $videos->where('newscatalogue_id', 64); $videos->order_by('created', 'DESC'); $videos->get_paged(0, 4, TRUE); $dis['videos'] = $videos; // $this->page_title = $dis['cat_name'] . " - " . $this->page_title; $dis['base_url'] = base_url(); $dis['link'] = gen_seo_url($this->lang->line('news')) . '/'; $dis['view'] = 'news/news_cat'; $this->viewfront($dis); }
function detail($title_none = NULL) { $cat_news_url = $this->uri->segment(1); $cat_news = new Newscatalogue(); $cat_news->where(array('name_none' => $cat_news_url, 'parentcat_id' => NULL))->get(); if (!$cat_news->exists()) { show_404(); } $dis['cat_news'] = $cat_news; $cat = $this->uri->segment(2); $category = new Newscatalogue(); $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get(); if (!$category->exists()) { show_404(); } $dis['category'] = $category; $title_none = geturlfromuri($this->uri->segment(3)); $news = new Article(); $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id)); $news->get(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; $tag = $news->tag; $dis['tag'] = explode(',', $tag); $news->view_count = $news->view_count++; $news->save(); //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 10, TRUE); $dis['related_news'] = $related_news; $this->page_title = $news->{'title_vietnamese'} . ' | Dự án ' . $category->name_vietnamese . ' ' . $news->{'title_vietnamese'} . ' | SotayNhadat.vn'; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; $this->isRobotFollow = 1; $dis['base_url'] = base_url(); $dis['view'] = 'front/project/news_de'; $this->viewfront($dis); }