function tagsDangTin($url) { $url = $this->uri->segment(2, ""); $arrUrl = explode('.', $url); $title = $arrUrl[0]; $query_string = explode($arrUrl[0] . '.html&', $this->uri->segment(2, "")); parse_str($query_string[1], $_GET); $this->load->library('pagination'); $limit = 20; $page = $_GET['per_page'] == "" ? 1 : $_GET['per_page']; $offset = ($page - 1) * $limit; $tags = explode('-', $title); $title = implode(' ', $tags); $estates = new Estate(); $estates->order_by('isVip', 'desc'); $estates->order_by('created', 'desc'); $estates->group_start(); $estates->like('tag_search', '%' . $title . '%'); $estates->group_end(); $estates->get_paged($offset, $limit, TRUE); $dis['estates'] = $estates; $estatesAll = new Estate(); $estatesAll->order_by('isVip', 'desc'); $estatesAll->order_by('created', 'desc'); $estatesAll->group_start(); $estatesAll->like('tag_search', '%' . $title . '%'); $estatesAll->group_end(); $estatesAll->get_iterated(); $url = base_url() . $this->uri->segment(1) . '/' . $arrUrl[0] . '.html'; $config['base_url'] = $url; $config['total_rows'] = $estatesAll->result_count(); $config['per_page'] = $limit; $config['use_page_numbers'] = TRUE; $config['page_query_string'] = TRUE; $config['uri_segment'] = 2; $config['num_links'] = 2; $config['full_tag_open'] = '<div class="news-pagination">'; $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); // support seo $this->page_title = 'Thông tin ' . $title . ' mới nhất'; $this->page_description = $title . ' với đầy đủ thông tin giá, hình ảnh, hướng, vị trí...cập nhật nhất'; $keyword = explode(' ', $this->page_title); $this->page_keyword = implode(',', $keyword); $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/tags'; $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 searchFree($params) { $this->load->library('pagination'); parse_str(array_pop(explode('?', $_SERVER['REQUEST_URI'], 2)), $_GET); $limit = 50; $offset = $_GET['per_page'] == "" ? 0 : $_GET['per_page']; $estates = new Estate(); $estates->where('isFree', 1); $estates->order_by('id', 'desc'); if ($_GET['searchKey'] != "" && isset($_GET['searchKey'])) { $estates->like('code', $_GET['searchKey']); } if ($_GET['estatecatalogue_id'] != "" && isset($_GET['estatecatalogue_id'])) { $estates->where('estatecatalogue_id', $_GET['estatecatalogue_id']); } if ($_GET['estatetype_id'] != "" && isset($_GET['estatetype_id'])) { $estates->where('estatetype_id', $_GET['estatetype_id']); } if ($_GET['estateprice_id'] != "" && isset($_GET['estateprice_id'])) { $estates->where('estateprice_id', $_GET['estateprice_id']); } if ($_GET['estatearea_id'] != "" && isset($_GET['estatearea_id'])) { $estates->where('estatearea_id', $_GET['estatearea_id']); } if ($_GET['isReals'] != "" && isset($_GET['isReals'])) { if ($_GET['isReals'] != -1) { $estates->where('isReals', $_GET['isReals']); } } $estates->get_paged($offset, $limit, TRUE); // get all estate search $estatesAll = new Estate(); $estatesAll->where('isFree', 1); $estatesAll->order_by('id', 'desc'); if ($_GET['searchKey'] != "" && isset($_GET['searchKey'])) { $estatesAll->like('code', $_GET['searchKey']); } if ($_GET['estatecatalogue_id'] != "" && isset($_GET['estatecatalogue_id'])) { $estatesAll->where('estatecatalogue_id', $_GET['estatecatalogue_id']); } if ($_GET['estatetype_id'] != "" && isset($_GET['estatetype_id'])) { $estatesAll->where('estatetype_id', $_GET['estatetype_id']); } if ($_GET['estateprice_id'] != "" && isset($_GET['estateprice_id'])) { $estatesAll->where('estateprice_id', $_GET['estateprice_id']); } if ($_GET['estatearea_id'] != "" && isset($_GET['estatearea_id'])) { $estatesAll->where('estatearea_id', $_GET['estatearea_id']); } if ($_GET['isReals'] != "" && isset($_GET['isReals'])) { if ($_GET['isReals'] != -1) { $estatesAll->where('isReals', $_GET['isReals']); } } $estatesAll->get_iterated(); $url = $_SERVER['REQUEST_URI']; $config['base_url'] = $url; $config['total_rows'] = $estatesAll->result_count(); $config['per_page'] = $limit; $config['page_query_string'] = TRUE; $this->pagination->initialize($config); $estateareas = new Estatearea(); $estateareas->order_by('position', 'asc'); $estateareas->get_iterated(); $dis['estateareas'] = $estateareas; $estateusers = new Estateuser(); $estateusers->order_by('name', 'asc'); $estateusers->get_iterated(); $dis['estateusers'] = $estateusers; $dis['estates'] = $estates; $dis['page_i'] = $offset; $dis['base_url'] = base_url(); $dis['view'] = 'estate/searchFree'; $dis['menu_active'] = 'Tin bất động sản (miễn phí)'; $dis['title'] = "Tìm kiếm bất động sản"; $this->viewadmin($dis); }