Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split array into pages
#1
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
Reply
#2
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
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"
Reply
#4
Thanks Carlos! Thats a good point. Will do.
Reply




Users browsing this thread: 1 Guest(s)