GetSimple Support Forum
Split array into pages - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8)
+--- Thread: Split array into pages (/showthread.php?tid=3728)



Split array into pages - mdgnys - 2012-10-27

Hello helpful people!
I have an XML that will updated daily, and I have a foreach() that echoes them all on a page. I also use array_reverse() to make the most recent on top. As you can tell, it will become very long very fast, so I want to split it into pages. Is there a way to take an input (via _GET) that tells it to take the first 20 (or the last 20, before array_reverse) children, then the next page takes the 20 after that? It would be extremely helpful.
Thanks,
Alex


Split array into pages - shawn_a - 2012-10-27

You are looking for a pagify script.

I think there are even some plugins that might let you use it on content or pages if you move your code to a component or something.


Split array into pages - Carlos - 2012-10-27

You may take a look to some existing plugins' code to see how they're doing it.
Examples are News Manager or GS Blog if you just want "Prev/Next", Pagify or I18N Search if you want "First/1/2/.../Last"


Split array into pages - mdgnys - 2012-10-27

Thanks Carlos! Thats a good point. Will do.