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 tagsDangTin($url) { $title = geturlfromuri($this->uri->segment(2)); $tags = explode('-', $title); $title = implode(' ', $tags); $estates = new Estate(); $estates->order_by('created', 'desc'); $estates->group_start(); $estates->like('tag_search', '%' . $title . '%'); $estates->group_end(); $estates->get(); $dis['estates'] = $estates; // seo $this->page_title = $title . ' | ' . $this->page_title; $this->page_description = "Có " . $estates->result_count() . " kết quả tìm kiếm với từ khóa " . $title . ' | ' . $this->page_description; $this->page_keyword = $this->page_keyword; $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/tags'; $this->viewfront($dis); }
function pagesigle($url) { $url = geturlfromuri($this->uri->segment(1)); $news = new Article(); $news->where(array('recycle' => 0, 'title_none' => $url))->get(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; $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', $this->listAllCat); $newViewMost->order_by('view_count', 'desc'); $newViewMost->get(10); $dis['newViewMost'] = $newViewMost; $this->page_title = $news->title_vietnamese . " - " . $this->page_title; $this->menu_active = 'home'; $dis['base_url'] = base_url(); $dis['view'] = 'front/single-page'; $this->viewfront($dis); }
function postDetail($url) { $typeNameNone = $this->uri->segment(1, ""); $type = new Estatetype(); $type->where('name_none', $typeNameNone)->get(); if ($type->exists()) { show_404(); } $cate = new Estatecatalogue(); $cate->where('name_none', $this->uri->segment(1, ''))->get(); if (!$cate->exists()) { show_404(); } $dis['cate'] = $cate; $url = geturlfromuri($this->uri->segment(3)); $estate = new Estate(); $estate->where('title_none', $url); $estate->where_related_estatecatalogue('id', $cate->id); $estate->where('active', 0); $estate->get(); if (!$estate->exists()) { redirect(base_url() . $this->uri->segment(1, '') . '-' . $this->uri->segment(2, '')); die; } $dis['o'] = $estate; $photo = new Estate_photo(); $photo->where('estate_id', $estate->id); $photo->get_iterated(); $dis['photo'] = $photo; $tag = $estate->tag; $dis['tag'] = explode(',', $tag); $description = str_replace(array("\r", "\n"), '', strip_tags($estate->description)); $keyword = explode(' ', $estate->title); $this->page_title = $estate->title . ' | SotayNhadat.vn'; $this->page_description = cut_string($description, 180); $this->page_keyword = implode(', ', $keyword); /*Get estate related vip*/ $estates_vip = new Estate(); $estates_vip->where('id !=', $estate->id); $estates_vip->where('estatetype_id', $estate->estatetype_id); $estates_vip->where('estatecity_id', $estate->estatecity_id); $estates_vip->where('estateprice_id', $estate->estateprice_id); $estates_vip->where('isVip', 1); $estates_vip->where('active', 0); $estates_vip->order_by('created', 'desc'); $estates_vip->get(10); $count_vip = $estates_vip->result_count(); $dis['estates_vip'] = $estates_vip; /*Get estate related follow type, city and price*/ $estates_related_type_city_area = new Estate(); $estates_related_type_city_area->where('id !=', $estate->id); $estates_related_type_city_area->where('estatetype_id', $estate->estatetype_id); $estates_related_type_city_area->where('estatecity_id', $estate->estatecity_id); $estates_related_type_city_area->where('estateprice_id', $estate->estateprice_id); $estates_related_type_city_area->where('isVip', 0); $estates_related_type_city_area->where('active', 0); $estates_related_type_city_area->order_by('created', 'desc'); $estates_related_type_city_area->get(10 - $count_vip); $dis['estates_related_type_city_area'] = $estates_related_type_city_area; $count_type_city_area = $estates_related_type_city_area->result_count(); /*Get all id estate*/ $list_estates_id = array(0); foreach ($estates_related_type_city_area as $row) { array_push($list_estates_id, $row->id); } /*Get estate related follow type, city and area*/ if (10 - $count_vip - $count_type_city_area > 0) { /*If count more than 10*/ $estates_related_area_price = new Estate(); $estates_related_area_price->where('estatetype_id', $estate->estatetype_id); $estates_related_area_price->where('estatearea_id', $estate->estatearea_id); $estates_related_area_price->where('estatecity_id', $estate->estatecity_id); $estates_related_area_price->where_not_in('id', $list_estates_id); $estates_related_area_price->where('isVip', 0); $estates_related_area_price->where('active', 0); $estates_related_area_price->order_by('created', 'desc'); $estates_related_area_price->get(10 - $count_vip - $count_type_city_area); //$dis['estates_related_area_price'] = $estates_related_area_price; } //$limit_lv3 = $estates_related_area_price->result_count()==$limit_lv2?0:$limit_lv2-$estates_related_area_price->result_count(); foreach ($estates_related_area_price as $row) { array_push($list_estates_id, $row->id); } $estates_related_new = new Estate(); $estates_related_new->where('estatetype_id', $estate->estatetype_id); $estates_related_new->where('estatearea_id', $estate->estatearea_id); $estates_related_new->where('estatecity_id', $estate->estatecity_id); $estates_related_new->where('estateprice_id', $estate->estateprice_id); $estates_related_new->where_not_in('id', $list_estates_id); $estates_related_new->where('active', 0); $estates_related_new->order_by('created', 'desc'); $estates_related_new->get($limit_lv3); $dis['estates_related_new'] = $estates_related_new; $estates_related_price = new Estate(); $estates_related_price->where('estateprice_id', $estate->estateprice_id); $estates_related_price->where('estatecity_id', $estate->estatecity_id); $estates_related_price->where('id !=', $estate->id); $estates_related_price->where('active', 0); $estates_related_price->order_by('created', 'desc'); $estates_related_price->get(10); $dis['estates_related_price'] = $estates_related_price; $estatePrices = new Estateprice(); $estatePrices->where('estatecatalogue_id', $estate->estatecatalogue_id); $estatePrices->order_by('position', 'asc'); $estatePrices->get_iterated(); $dis['estatePrices'] = $estatePrices; $this->isRobotFollow = 3; $dis['base_url'] = base_url(); $dis['view'] = 'front/user/post-detail'; $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); }