1

Is it possible to Stash some content in one template and then grab it from another template?

Basically, I want to store a bunch of Entry IDs in one template and then i'm AJAX loading another template where I would like to retrieve those Entry IDs and use them to plot markers on a map.

I've tried using scope, but it doesn't appear to be working.

{exp:stash:set name="show_nearby" parse_tags="yes" parse_depth="2" parse="inward" trim="yes" scope="user" refresh="10"}
    {exp:channel:entries dynamic="no" url_title="{segment_4}"}
        {exp:trails_nearby entry_id="{entry_id}" lat="{thingtodo_latitude}" lng="{thingtodo_longitude}"}
    {/exp:channel:entries}  
{/exp:stash:set}

The following code gets the values above when used in the same template (so I know the values are being set;

{exp:stash:get name="show_nearby" backspace="1"}

However, when I use in another template it just returns everything from the channel because the entry_id isn't being set;

{exp:channel:entries channel="things-to-do" entry_id="{exp:stash:get name='show_nearby' backspace='1' scope='user'}" parse="inward" status="open" dynamic="no"}
{title}
{/exp:channel:entries}

I would appreciate any advice.

Thank you.

  • Could you post your AJAX call? if the {exp:stash:set...} is working without AJAX, I'd assume your JS isn't. When you say 'returns everything' I assume your filters aren't being applied, can you debug the POST data and share that as well? – adamellsworth Jan 14 '14 at 16:51
  • Hey @adamell. The ajax is simply loading another template rather than passing any data to it – doubleplusgood Jan 14 '14 at 17:15
  • 3
    Try adding save="yes" in parameters with scope site or user. – Romans-8---31-39 Jan 14 '14 at 17:45
0

Thanks Romans-8---31-39. That did the trick using scope site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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