I was trying for pagination in my PHP project, codeigniter has its own class called 'pagination' and I have used it. Now I have got a links for pages in my view page. But all data printed in a single page, this is my code..
$mydata = array('mydata' => $this->Admin_model->view_job_posts());
$this->load->library('pagination');;
$config['base_url'] =site_url('/admin/view_job_posts/');
$config['total_rows'] = count($mydata["mydata"]);
$config['per_page'] = 1;
$config['num_links'] = 2;
$config['uri_segment'] = 2;
$this->pagination->initialize($config);
$mydata['links'] = $this->pagination->create_links();
$this->load->view('pages/admin_view_jobs', $mydata);
help me guys !
Setting preferences in a config file Simply create a new file called pagination. php, add the $config array in that file. Then save the file in application/config/pagination. php and it will be used automatically.
call first controller from first view and pass form data to second view. On second view you can create hidden inputs and set their values from controller data. Now submit the second form to final controller and you will get all the values of both form. Hope this helps you.
$this->uri->segment(n) Segment function allow you to retrieve a specific segment form URI string where n is a segment number. Segments are numbered from left to right. For example,if your URI like. By the above example URI segment function give result by n parameter.
That's because you are loading it all, CodeIgniter doesn't implement any AI algorithm :p check your first line of code :
$mydata = array('mydata' => $this->Admin_model->view_job_posts());
Think about adding 2 extra parameters to your model ($number_of_rows, $offset), that way, you load exactly what you need on the specific page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With