pagination help

#11
[eluser]WebsiteDuck[/eluser]
I made a mistake in this part in your controller, change it to this:
Code:
if (isset($page) && is_int($page))
            {
              $offset = ($page-1) * $config['per_page'];
            }
            else
            {
              $offset = 0;
            }
Because if the page is 1 then the offset should be 0

Also try taking this line out of your controller:
Code:
$config['uri_segment'] = '3';


Do all 70 rows satisfy this: end >= NOW() ?

#12
[eluser]dadamssg[/eluser]
same thing. I cant get the third segment to become assigned to the offset for some reason...

#13
[eluser]WebsiteDuck[/eluser]
Sorry, change this line in your controller
Code:
if (isset($page) && is_int($page))
to
Code:
if (isset($page) && is_numeric($page))

I may be causing your frustration Tongue

#14
[eluser]dadamssg[/eluser]
if i change
Code:
$data['query'] = $this->Frontmodel->get_events(5,$offset);
to
Code:
$data['query'] = $this->Frontmodel->get_events($config['per_page'],$this->uri->segment(3));

it seems to work, but the pagination links don't correspond and if i just go to the index of my controller i get a sql error because theres nothing in segment 3 of my uri

#15
[eluser]WebsiteDuck[/eluser]
Change what I said above, and then post a couple of the pagination links that you're getting

#16
[eluser]dadamssg[/eluser]
i made that change and i still cant get the links to correspond with the 3rd segment of uri

#17
[eluser]dadamssg[/eluser]
i changed it to like what you said and the uri is getting pull and querying the database correctly. right now im on the page 'mysite.com/mains/index/5' and its saying that im on page 2. Every link is in increments of 5 instead of one.

so my 2nd page link is mysite.com/mains/index/5
3rd page link is mysite.com/mains/index/10
4th page link is mysite.com/mains/index/15

#18
[eluser]WebsiteDuck[/eluser]
oh alright so pagination is giving you an offset instead of a page number...in that case change
Code:
$offset = ($page-1) * $config['per_page'];
to
Code:
$offset = $page;

#19
[eluser]dadamssg[/eluser]
same thing. page links are still in increments of 5

#20
[eluser]WebsiteDuck[/eluser]
The links will still be in increments of 5, but it should show the correct page now
0 = page 1
5 = page 2
10 = page 3
etc


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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