Welcome Guest, Not a member yet? Register   Sign In
Correct use of pagination class
#1

[eluser]J. Pavel Espinal[/eluser]
Hi folks,

I am new to CodeIgniter and it is the second PHP framework (after giving up trying to use CakePHP) that I use, and its simply marvelous (Excellent Job).

Please pardon my bad english (learned it at home with the aid of some books and a PlayStation Tongue ).

I am using the Pagination Class of CI and i see that in the documentation something like...
"The pagination function automatically determines which segment of your URI contains the page number. If you need something different you can specify it."
... is said about the "$config['uri_segment']" setting; but in my URI I am able to see only the offset number ( corresponding to the $config['per_page'] setting ); and none of them displays the 'current page'.

Am I missing something (or miss understanding something)?


PS.
So far I was using it this way (Which works fine, but I do not know if it is the correct way):

Code:
//-----------------------------------            
$this->load->library('pagination');
$config['base_url']     = 'http://10.0.0.200/ci/index.php/admin_main/view_rslr';
$config['total_rows']   = $this->db->count_all('resellers'); // The total here
$config['per_page']     = '5';                               // I was using this to navigate
$config['prev_link']    = '<';                             // through pages
$config['next_link']    = '>';

$this->pagination->initialize($config);

//-----------------------------------

// Look how i did this... is that correct? (I mean should it be that way?)
$result = $this->db->get('resellers', $config['per_page'], $this->uri->segment(3,0));

$data['pag_links']     = $this->pagination->create_links();
$data['result']        = $result->result_array();

//*******************************************//  
$this->load->view('admin/view_resellers', $data);
//*******************************************//


Thank you in advice :cheese:


Messages In This Thread
Correct use of pagination class - by El Forum - 03-07-2008, 07:24 AM
Correct use of pagination class - by El Forum - 03-07-2008, 08:26 AM
Correct use of pagination class - by El Forum - 03-07-2008, 09:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB