0

I'm excited about being able to use Stash to avoid having to use series of embedded templates, but can't figure out how to make it work. The code below generates the variable 'course' and uses it in the second loop. The variable, {exp:stash:course} and {exp:stash:get name="course"}, work fine by themselves, outside of the second loop, but using the search parameter within the loop there is nothing. I should be able to view {exp:stash:cats}, which is in the embedded template.

I've tried using various parameters to fix the problem such as 'save', 'cache', 'trim', 'parse tags', and others. I think this must be a parse order issue.

Thanks,

Geoff

{embed="site/test1"}

{exp:stash:set name="course" parse_tags="yes" trim="yes"}
    {exp:channel:entries channel="topic" url_title="{segment_2}"}
    {url_title}
    {/exp:channel:entries}
{/exp:stash:set}

{exp:stash:set name="cats" trim="yes"}
{exp:channel:entries channel="explore" search:coursename="{exp:stash:course}"}
{title}
<br />
{/exp:channel:entries}
{/exp:stash:set}

Wow, that was complicated and a waste of time but I figured it out through a lot of research and trial and error. I don't know if it's going to be worth continuing if such simple tasks are so complex. Anyway, here's the working code:

{embed="site/test1"}

{exp:channel:entries channel="topic" dynamic="no"  limit="1" url_title="spirituality"}
  {exp:stash:set name="my_test" parse_tags="yes"}{title}{/exp:stash:set}
{/exp:channel:entries}

{exp:stash:set name="cats"}
  {exp:stash:parse process="end"}
      {exp:channel:entries channel="explore" dynamic="no" parse="inward" search:coursename="{stash:my_test}"}
      {title}<br />
      {/exp:channel:entries}
  {/exp:stash:parse} 
{/exp:stash:set}
7
  • Add parse=inward to your 2nd exp:channel entry ? Apr 25, 2015 at 7:20
  • & you also need parse_variables=yes on the 2nd stash set Apr 25, 2015 at 10:05
  • Oops, parse_tags Apr 25, 2015 at 10:06
  • Thanks, I tried adding those variables including parse="inward" but it's still not working. I would think that this is a very common problem - so I wonder if there is some kind of basic, standard solution?
    – Geoff
    Apr 25, 2015 at 18:38
  • All right, I found a post with more information and the second exp:channel entry is now parsing the first stash - but I haven't figured out how to set the second variable so it can be passed on to the embedded template. Here is what I have now:
    – Geoff
    Apr 25, 2015 at 19:39

0

Your Answer

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

Browse other questions tagged or ask your own question.