Pagnation without mySQL, is it possible.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Pagnation without mySQL, is it possible.

Post by akimm »

For instance, I assume with something like count() you could count the output of an array and pipe the excess to another page maybe? Not quite sure but I'd imagine its possible.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You need your elements to be countable, this is the first element, this is the second element ... tis is the nth element.
Just like mysql records are because of the primary index or an ORDER BY statement.
Now you print m elements (e.g. 10) per page -> first page:elements 0 to 9, second page: elements 10 to 19, nth page: elements n*10 to (n+1)*10-1
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

Volka, if I understand you correcty

Code: Select all

$pagnation = array(
element[0],
element[1],
et cetera.....
..........
........
);
then something like

Code: Select all

print_r(count($pagnation(elements[0],elements[9])))
I know thats not the correct code, but is it at least along the same line?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

http://www.timvw.be/pagination-for-all/ but we've got like a zillion of threads about the topic on this forum too...
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

Thanks, I'll check that out.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Ah.. Here's how my proped solution would handle globbing ;)

Code: Select all

$pageabledata = new PageableArray(glob('*.jpg'));
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

Thanks Bokehman, I will also check that out. Thanks much.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Code: Select all

array_slice()
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

Thanks i will look into all of these options.
Post Reply