GetSimple Support Forum

Full Version: Split array into pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
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"
Thanks Carlos! Thats a good point. Will do.