Welcome Guest, Not a member yet? Register   Sign In
Trouble with Pagination
#11

[eluser]SpooF[/eluser]
The error your getting usually comes from not telling the pagination class the correct page its currently on. I would double check to see if its getting the right uri segment.
#12

[eluser]Thorpe Obazee[/eluser]
[quote author="SpooF" date="1245679541"]The error your getting usually comes from not telling the pagination class the correct page its currently on. I would double check to see if its getting the right uri segment.[/quote]

yeah, that's what I said a while ago. I think the problem also lies as on what his site_url('entry/$type') produces.
#13

[eluser]n0xie[/eluser]
[quote author="bargainph" date="1245680387"][quote author="SpooF" date="1245679541"]The error your getting usually comes from not telling the pagination class the correct page its currently on. I would double check to see if its getting the right uri segment.[/quote]

yeah, that's what I said a while ago. I think the problem also lies as on what his site_url('entry/$type') produces.[/quote]
Baseurl should end with a '/'
#14

[eluser]Thorpe Obazee[/eluser]
[quote author="n0xie" date="1245681275"][quote author="bargainph" date="1245680387"][quote author="SpooF" date="1245679541"]The error your getting usually comes from not telling the pagination class the correct page its currently on. I would double check to see if its getting the right uri segment.[/quote]

yeah, that's what I said a while ago. I think the problem also lies as on what his site_url('entry/$type') produces.[/quote]
Baseurl should end with a '/'[/quote]

:bug:
#15

[eluser]ferno[/eluser]
I've messed around with a slash at the end, no difference, and my $config['base_url'] seems to be working, I tried manually entering it (not using site_url) and a few other things, it doesn't change.

What do you mean by:

Quote:I would double check to see if its getting the right uri segment.

???

I've tried changing $config['uri_segment'] before and that didn't make any difference either, unless you mean something different?

Thanks again.
#16

[eluser]SpooF[/eluser]
If you can post your current pagination code and the url the class produces I might be able to help you.
#17

[eluser]ferno[/eluser]
ok here's my pagination code (the complete controller function)

Code:
function entries($type,$start=0)
    {
        $e = new Entry;
        
        $per_page = 2;
        $count = $per_page - $start;

        if ($type == "best")
        {
            $e->order_by("score","desc")->get($per_page,$start);
        }
        else if ($type == "worst")
        {
            $e->order_by("score","asc")->get($per_page,$start);
        }
        else if ($type == "newest")
        {
            $e->order_by("id","desc")->get($per_page,$start);
        }

        $entries = "";

        foreach($e->all as $entry)
        {
            $entries .= $this->entry('list',$entry->id);
        }

        $config['base_url'] = site_url("entries/$type") . '/';
        $config['total_rows'] = $e->count();
        $config['per_page'] = $per_page;
        $config['num_links'] = 2;
        $condig['uri_segment'] = 3;

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

        $data['content_left_top'] = $entries;
        $data['content_left_bottom'] = $this->pagination->create_links();
        $this->load->view('main',$data);
    }

where $data['content_left_top'] is echoed in one div of my view, and $data['content_left_bottom'] is echoed in another div

an example starting url is:

Code:
http://localhost/wat/index.php/wat/entries/newest

where the second page would be:

Code:
http://localhost/wat/index.php/wat/entries/newest/2

etc...
#18

[eluser]SpooF[/eluser]
Set your URI segment to 4
#19

[eluser]Colin Williams[/eluser]
http://www.movieweb.com/video/HUFj8KFMZ7UgJJ Smile
#20

[eluser]ferno[/eluser]
ahh yes, and i had $condig['uri_segment'] instead of $config, that's why it didn't do anything when I was messing around with it before

this was solved very quickly, thank you everyone for your responses!

and thanks for that video lesson on counting colin lol




Theme © iAndrew 2016 - Forum software by © MyBB