Jump to content

brettski

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

brettski's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, Just a couple of things with my site search, I am having trouble getting the search results to pickup any and all keywords. For example, if keywords for a search result are listed in the keywords column of my db as 'one, two, three' a search query for 'one two' is fine but a search for 'one three' will not display the search result. Instead of treating the keywords seperately it is treating all keywords as a whole phrase. How can I make the search results pickup any keyword regardless of order. Secondly I'm having trouble getting the search results to display by keyword relevance, any help is greatly appreciated. Thanks. function search() { parent::Controller(); $this->load->model('Templating'); $this->load->model('Company'); } function index() { $this->load->view('search'); } function search_redirect() { if ($_POST['keyword'] == '') $_POST['keyword'] = 'Keyword'; redirect('search/showlist/'. urlencode(underscore($_POST['location'])).'/'. urlencode(underscore($_POST['category'])).'/'. urlencode(underscore($_POST['keyword']))); } function showlist($location = 'any', $category = 'any', $keyword = 'keyword', $offset = '0') { /* get results */ $data['companies'] = $this->Company->search($keyword, $category, $location, $offset, $name); /* paginate results */ $row = $data['companies']->row(); if($keyword == 'keyword' and $category=='any' ) { $data['categoryList'] = $this->buildCategoryList($location); } elseif(isset($row->categoryId)) { $categoryId = $row->categoryId; $data['linkList'] = $this->buildRefineList($categoryId); } $this->load->library('pagination'); $config['base_url'] = site_url().'search/showlist/'.$location.'/'.$category.'/'.$keyword.'/'; $config['total_rows'] = $this->Company->total_companies; $config['per_page'] = $this->Company->per_page; $config['num_links'] = 3; $config['uri_segment'] = $this->uri->total_segments(); $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $data['logged_in'] = $this->session->userdata('logged_in'); $data['company_id'] = $this->session->userdata('company_id'); $data['search_category'] = $category; $data['search_location'] = $location; if ($this->session->userdata('admin') != ''){ $data['admin'] = $this->session->userdata('admin'); } /* initialise template settings */ $center = 'center/list_companies'; $this->load->vars($data); $this->Templating->show($center); }
  2. Hi there, ok I'm stuck... I need to show different headers for certain pages on my website, My template file below calls in all template parts with the 'layout' file being the file which includes a simple html header and menu. How would I go about this? Would I need to create and call on a seperate/second layout file eg. layout2 or can I determine which header shows on certain pages by adding some code to the layout file itself. Any help greatly greatly appreciated. <?php class Templating extends Model{ function __constructor(){ } function show($center = 'homepage', $right = 'login_box', $left ='left/search_panel', $template = 'layout'){ $data = array( 'right_bar' => $right, 'left' => 'left/search_panel', 'center' => $center, 'left_logged'=>'left/user_panel' ); if ($this->session->userdata('logged_in') == true){ if ($this->session->userdata('admin')){ #$data['right_bar'] = 'right_panel/admin_panel'; $data['left_logged'] = 'right_panel/admin_panel'; }else{ #$data['right_bar'] = 'right_panel/user_panel'; $data['left_logged'] = 'left/user_panel'; //$data['left'] = 'left_panel/user_panel'; } }else{ #$data['right_bar'] = 'right_panel/login_box'; } $this->load->vars($data); $this->load->view($template); } function show_non_live(){ $data = array( 'left' => 'left/search_panel', 'center' => 'center/list_companies', 'left_logged'=>'left/user_panel' ); if ($this->session->userdata('logged_in') == true){ if ($this->session->userdata('admin')){ //$data['right_bar'] = 'right_panel/admin_panel'; $data['left_logged'] = 'right_panel/admin_panel'; }else{ //$data['right_bar'] = 'right_panel/user_panel'; $data['left_logged'] = 'left/user_panel'; } }else{ #$data['right_bar'] = 'right_panel/login_box'; } $template = 'layout'; $this->load->vars($data); $this->load->view($template); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.