Welcome Guest, Not a member yet? Register   Sign In
Search with $term and pagination
#7

[eluser]TheFuzzy0ne[/eluser]
The method you call to count all of the results needs to run an identical query to the one you use to get the results. The only difference being that there will be no limit of offset defined for the query. You can use query caching to cache part of your query so you can re-use it easily.

I like to do all of this in one method, so my model method will pass back an array that contains everything the pagination class requires, (such as total results, results per page and so on), as well as the results themselves. This makes it easier to utilise query caching, so you don't have to repeat your code over two methods.


Messages In This Thread
Search with $term and pagination - by El Forum - 05-29-2013, 12:11 PM
Search with $term and pagination - by El Forum - 05-29-2013, 05:32 PM
Search with $term and pagination - by El Forum - 05-30-2013, 01:58 AM
Search with $term and pagination - by El Forum - 05-30-2013, 04:13 AM
Search with $term and pagination - by El Forum - 05-30-2013, 04:16 AM
Search with $term and pagination - by El Forum - 05-30-2013, 04:17 AM
Search with $term and pagination - by El Forum - 05-30-2013, 04:24 AM
Search with $term and pagination - by El Forum - 05-30-2013, 04:27 AM
Search with $term and pagination - by El Forum - 05-30-2013, 09:37 AM
Search with $term and pagination - by El Forum - 05-30-2013, 10:15 AM
Search with $term and pagination - by El Forum - 05-30-2013, 10:17 AM
Search with $term and pagination - by El Forum - 06-06-2013, 08:31 AM
Search with $term and pagination - by El Forum - 06-06-2013, 04:55 PM
Search with $term and pagination - by El Forum - 06-07-2013, 01:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB