• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination: Current Page / Back Problem

#1
[eluser]weetstraw[/eluser]
I'm having an issue using pagination. The current page of results does not go bold, it stays at 1. In addition, I do not get a back arrow. Below is my controller, any ideas?

I do get the right number of results per page and the results do change when I click 2, 3, etc...

Thanks in advance!

Code:
function discipline()
{
    $dis = $this->uri->segment(3);
    $offset = $this->uri->segment(4);
    $row= $this->Project_model->disciplineCount($dis);
    
    // Pagination
    $config=array(
        'base_url'         => base_url()."projects/discipline/".$dis,
        'total_rows'     => $row->total,
        'per_page'         => 12,
        'num_links'        => 10
    );
    $this->pagination->initialize($config);
    
    $data = array(
        'subTitle'         => ' - Projects',
        'css'             => array('projects'),
        'js'             => NULL,
        'menu'             => 'projects',
        'id'             => NULL,
        'dis'             => $dis,
        'switch'         => $this->Project_model->projectDiscipline($dis,$config['per_page'],$this->uri->segment(4)),
        'categories'     => $this->Project_model->category(),
        'disciplines'     => $this->Project_model->discipline($dis),
        'pagination'    => $this->pagination->create_links(),
        'boxes'         => array('projects-category','projects-discipline')
        );
    
    $this->load->view('project_view.php', $data);
}

#2
[eluser]pistolPete[/eluser]
The offset seems to be stored in the 4th uri segment but the default configuration is:
Code:
/* Location: ./system/libraries/Pagination.php */
/* Line number 38 */
var $uri_segment = 3;

You should change your configuration:

Code:
// Pagination
    $config=array(
        'base_url'         => base_url()."projects/discipline/".$dis,
        'total_rows'     => $row->total,
        'per_page'         => 12,
        'num_links'        => 10,
        'uri_segment'        => 4,
    );

#3
[eluser]weetstraw[/eluser]
Perfect, thanks!

#4
[eluser]runrun[/eluser]
I got the same problem today, was about to post a topic then find this. Thanks guys!

#5
[eluser]Unknown[/eluser]
Thanks this solved my problem too Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.