Welcome Guest, Not a member yet? Register   Sign In
Pagination links problem.1st page link not working.Current link not working.
#1

[eluser]Unknown[/eluser]
Hello all !
I have a small problem regarding pagination.
Here is my code:

Code:
function loadpage($numethread,$offset=0)
{

$config['total_rows'] =7;
$config['per_page'] =3;
$config['uri_segment'] =4;
$config['base_url'] = 'http://localhost/ci/index.php/bilet/forumControl/loadpage/'.$numethread."/";

$this->pagination->initialize($config);
                        
                        $data['links']=$this->pagination->create_links();


$data['query']=$this->db->query("select * from forum where numethread='$numethread'  limit $offset,3");


$data['numethread']=$numethread;
$urlview='bilet/forum_'.$numethread;
                        
$this->load->view($urlview,$data);
$this->personal->outro();

}

Explain my code.I have a forum page.Each time I click a link I call the loadpage method from my controller passing it 2 parameteres ,the $numethread (the thread name) and the offset (the number in the URL)

The problem is :
I click on page 2,3 whatever, it works,it shows me the right results it changes the URL but still page 1 remains highlighted .The next link takes me to page 2 (as if page 1 was the current page).

The annoying part is that I tried this in a more simple way ,using the 3rd uri segment to pass the offset and it worked perfectly.

Any ideas what I am doing wrong ?




Theme © iAndrew 2016 - Forum software by © MyBB