Skip to content

Instantly share code, notes, and snippets.

@andyhawthorne
Last active December 20, 2015 21:28
Show Gist options
  • Save andyhawthorne/6197527 to your computer and use it in GitHub Desktop.
Save andyhawthorne/6197527 to your computer and use it in GitHub Desktop.
<?php
public function search()
{
$searchterm = $this->search_model->searchterm_handler($this->input->get_post('searchterm', TRUE));
$limit = ($this->uri->segment(3) > 0)?$this->uri->segment(3):0;
$config['base_url'] = base_url() . 'welcome/search';
$config['total_rows'] = $this->search_model->search_record_count($searchterm);
$config['per_page'] = 20;
$config['uri_segment'] = 3;
$choice = $config['total_rows']/$config['per_page'];
$config['num_links'] = round($choice);
$this->pagination->initialize($config);
$data['results'] = $this->search_model->search($searchterm,$limit);
$data['links'] = $this->pagination->create_links();
$data['searchterm'] = $searchterm;
$this->load->view('search',$data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment