I have about 500 entries in a channel, and I need to show them on Google Map. When I try to read data with {exp:channel:entries} pair, it takes long to load the pages. Is there any way to load the data and start showing them as soon as they are ready on the map? Is it possible to read, for example 50 entries a time show them, then read next 50 entries, etc.? Maybe using a plugin or Ajax? Any idea?

1 Answer 1

  1. Use stash to cache the results (refresh every x minutes, overwrite=no) for fast access.
  2. Chain your ajax request, and use channel:entries limit and offset parameters
    (e.g. after the first 50 return, hand them to map handler and call same/next ajax with new offset)

Option 2 will do several requests in a row, which might not be what you want.

edit: example added.

Caching the output of a channel entries tag for 60 minutes.
(from https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset%7D#caching-a-variable )

    {exp:channel:entries channel="blog"}
  • thx, do you know any resource showing how to use stash to cache (and refresh), and later use it in template? is this cached result will be presented to different visitors? Commented Mar 28, 2014 at 15:02
  • Example added. See the stash wiki for flush_cache tag (flushes all caches) or you could set replace="yes" depending on a {if segment_4!=""} note, this only works if you have scope=site
    – GDmac
    Commented Mar 29, 2014 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.