Codeigniter Pagination - 404 Error -
i trying use pagination blog articles on homepage:
controller:
public function index() { $data['view'] = "home"; /** pagination **/ $config['base_url'] = base_url().'home/'; $config['total_rows'] = $this->blog_model->count_articles(); $config['per_page'] = 2; $config['uri_segment'] = 2; $this->pagination->initialize($config); $data['paginate'] = $this->pagination->create_links(); $data['articles'] = $this->blog_model->get_articles($config['per_page'],$this->uri->segment(2)); $this->load->view('template', $data); } everything seems work ok information retrieval , pagination however, when click on number links or next links 404 not found error.
i assuming has uri segment?
the url being loaded http://www.example.com/home/2 second page.
codeigniter pages of form http://domain.com/controller/method/arguments.
if leave out method default 1 load, if need pass argument, you'll have put method comes before.
http://www.example.com/home/index/2
Comments
Post a Comment