Welcome Guest, Not a member yet? Register   Sign In
Pagination, offset issue
#6

[eluser]1cookie1[/eluser]
[quote author="mcr_rm" date="1263442151"]I am confused a little by this.

Firstly the pagination class always passes increments of your per page value in the uri right?
[/quote]
I'm glad you point that out! I may never have thought of it that way if you hadn't! :-)

Quote:how have you got it to pass 1/2/3/4 when in per pages of five it should be passing nothing followed by /5/10/15.
I type 1/2/3/4 MANUALLY in the url i.e.

http://localhost/CIgniter/index.php/books/index/1 //pulls records 2 - 6
http://localhost/CIgniter/index.php/books/index/2 //pulls records 7 - 11
http://localhost/CIgniter/index.php/books/index/3 //pulls records 12 - 16
http://localhost/CIgniter/index.php/books/index/4 //pulls record 17

Not what I'm looking for!

My explanation probably confused you, sorry. :-) If I type:

http://localhost/CIgniter/index.php/books/index/0, i.e. an offset of 0, then the script pulls records 1 - 5, as you may or may not expect.

Quote:Secondly you are delaring $page=null in the index function however I don't see anywhere where $page is being set to the uri segment. And I don't know why you need it anyway as the offset is actually the bit passed in the uri usually i.e. 5/10/15 and so you just pass $this->uri->segment(3) to the database call for the offset surely?

I agree, NOW! This was purely something I tried out from post #1. I may have been going off at a different tangent! Smile


Quote:I think the only bit that is really confusing for me is how you got manually typing it in the browser to work? as at no point can I see the setting of $page from the uri to multiply the per page for the offset (which is needless anyways).

I confused the issue with the whole multiplying thing. My script originally started off without it and the $page=NULL variable (again from post#1). The one thing Iv'e learnt in all of this is that whatever is in the 3rd segment (or whatever file structure your using) of the uri - its effectively the offset and the query will pull records starting from that value!

hope this helps. ;-)


Messages In This Thread
Pagination, offset issue - by El Forum - 01-12-2010, 04:48 AM
Pagination, offset issue - by El Forum - 01-13-2010, 08:16 AM
Pagination, offset issue - by El Forum - 01-13-2010, 11:15 AM
Pagination, offset issue - by El Forum - 01-13-2010, 04:09 PM
Pagination, offset issue - by El Forum - 01-13-2010, 07:15 PM
Pagination, offset issue - by El Forum - 01-14-2010, 03:09 AM
Pagination, offset issue - by El Forum - 01-14-2010, 04:47 AM
Pagination, offset issue - by El Forum - 01-14-2010, 05:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB