CodeIgniter Forums
pagination problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: pagination problem (/thread-47689.html)



pagination problem - El Forum - 12-18-2011

[eluser]Unknown[/eluser]
Hello , i am trying to make a pagination links for records which fetched from database .
----------------------------
my Controller path is :http://localhost/databox/index.php/adminme/news
and here i got all my records in one table , but when clicking on page 2, i should redirected to http://localhost/databox/index.php/adminme/news/10
Then i get 404 Page Not Found!!

News Controler
================
Code:
function index()
    {
     $this->load->library('pagination');
  $this->load->model('adminme/news_model');
  $config['base_url'] = base_url().'index.php/adminme/news';
  $config['total_rows'] = $this->news_model->record_count();
  $config['per_page'] = 10;
  $config['uri_segment'] = 3;
  $choice = $config['total_rows']/$config['per_page'];
  $config['num_links'] = round($choice);

  $this->pagination->initialize($config);
  
  $page = ($this->uri->segment(3))? $this->uri->segment(3) : 0;
  $data['results'] = $this->news_model->get_records($config['per_page'],$page);
  $data['links'] = $this->pagination->create_links();
  $this->load->vars($data); //to make the $data varible public to news view
  $content['main_content'] = 'adminme/news';
  $this->load->view('adminme/includes/template',$content);

My View links code
==================
Code:
<p>&lt;?=$links?&gt;</p>

Can anybody help me on this !!