Datamapper pagination: total rows and current rows |
[eluser]Wazzu[/eluser]
Hi all, I-m having troubles using DMZ pagination. I have 15 records and want to show 10 records per page. As you can see below, I make use of $o=>count to check how many records I have found Later I want to narrow that search so I can get just some of them, so I call $o->limit(10, $page)->get() but in this case, all my previous wheres and likes are gone. How can I get the total number of rows within the filter and then paginate them using the same query parameters? Code: // User list
[eluser]Wazzu[/eluser]
There must be some way to reuse previous $o->where and $o->like. I can use another local variable, without using session space, but Im sure there is something I could use :-(
[eluser]Wazzu[/eluser]
The bad news: you can't reuse your query after a count or a get call The good news: you can get a clone and use it for count, so your real object keeps all clausules. Found the answer at: http://ellislab.com/forums/viewthread/136039/P250/ (check from post #253) Documentation here: http://www.overzealous.com/dmz/pages/clonecopy.html |
Welcome Guest, Not a member yet? Register Sign In |