• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination Problem

#1
[eluser]Unknown[/eluser]
On using pagination class, link to 2nd page shows 1 in URL. I want my visitors to know that they are going to 2nd page. If it shows 1 in URL, that will confuse anyone.

How can I solve this?

#2
[eluser]gigas10[/eluser]
Provide us with some code please.

#3
[eluser]Unknown[/eluser]
Code:
$config['base_url'] = $this->config->site_url().'/welcome/page';
        $config['total_rows'] = $this->Sites->getTotalRows();
        $config['num_links'] = 2;
        $config['per_page'] = 10;
        $config['uri_segment'] = 3;

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

        $query = $this->Sites->getAllSites($pageno, $config['per_page']);
        foreach($query->result() as $row) {

            $res[$i][0] = $row->siteid;
            $res[$i][1] = $row->name;
            $res[$i][2] = $row->url;
            $res[$i][3] = $row->description;
            $i++;

        }
        echo $this->pagination->create_links();

In the model, I have:
Code:
function getAllSites($page, $perpage) {
        
        $start = ($page)*$perpage;
        if($page<=1)
            $start = 0;
        $query = $this->db->get('sites',$perpage, $start);
        return $query;
    }


This code works absolutely fine. There is no problem with the code. The way it behaves is weird. Click on link for page 2 has a URL like
http://localhost/review/index.php/reviews/id/1

Page 2 has '1' in the link which is what I didn't like. Is there any way to fix this so that Page 1 shows 1 in the URL and Page 2 shows '2'? I can then modify my model accordingly.
The problem with this URL is that it confuses people, they thing its first page when its actually seconds.

Am I missing something?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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