1

I have a channel of Events, which has a videos field. Videos is a playa field which relates to a Videos channel. The Videos channel has a field which uses Channel Videos to display the video. I'm trying to use Stash to retrieve and display these videos from my Event using nested lists. However, I'm not quite sure of the syntax with more than one two dimensional lists. Here is the code I've used so far.

{!-- set the list --}
{exp:stash:set_list name="an_event" parse_depth="2" parse_tags="yes" scope="site"}
  {exp:channel:entries channel="events" disable="categories|category_fields|member_data|pagination|trackbacks" dynamic="no" entry_id="155"}
    {stash:title}{title}{/stash:title}
    {stash:entry_id}{entry_id}{/stash:entry_id}

    {exp:stash:set_list:nested name="event_video" context="{entry_id}" parse_tags="yes" scope="site"}
      {event_video}
        {exp:channel_videos:videos entry_id="{entry_id}"}
          {stash:video_id}{video:id}{/stash:video_id}
          {stash:video_title}{video:title}{/stash:video_title}
          {stash:video_thumb}{video:img_url}{/stash:video_thumb}
          {stash:video_embed}{video:embed_code}{/stash:video_embed}
        {/exp:channel_videos:videos}
      {/event_video}
    {/exp:stash:set_list:nested}

  {/exp:channel:entries}
{/exp:stash:set_list}

{!-- get the list --}
{exp:stash:get_list name="an_event" scope="site"}

  <h1>{title}</h1>
  {exp:stash:get_list:nested name="event_video" context="{entry_id}" scope="site"}
    <img src="{video_thumb}" />
  {/exp:stash:get_list:nested}

{/exp:stash:get_list}

As a simple test, I'm just trying to output the thumbnail for the video, but I'm not seeing anything. Any ideas on what I'm missing?

Thanks, Dan

1

When you're setting the an_event list you didn't set a stash variable called entry_id, although you're trying to use that variable for the context parameter when you're outputting with get_list.

So you might want to set the variable (using a slightly different name than the default ee variable):

...
{stash:title}{title}{/stash:title}
{stash:e_id}{entry_id}{/stash:e_id}
...

and when outputting the list:

... context="{e_id}" ...

There may be more issues, but try that.

| improve this answer | |
  • Thanks for your reply. Sorry, I did have that in my original code. Tried to trim down the sample code a bit and apparently did too much. I've edited the code snippet accordingly. – Dan Triant Dec 30 '13 at 22:32
  • What do you get if you add the parameter output="yes" for your set_list(s): are you seeing the variables set correctly and it's just a problem on getting it when you use get_list? – Romans-8---31-39 Dec 30 '13 at 23:06
  • It's definitely a problem on the set_list. I see the title of the event, but not the video. 'title|=|My Event|&|entry_id|=|155|&|video_id|=|{video:id}|&|video_title|=|{video:title}|&|video_thumb|=|{video:img_url}|&|video_embed|=|{video:embed_code}' – Dan Triant Dec 31 '13 at 2:29
  • Try bumping up the outer parse_depth to 3 or 4 (not sure if adding a parse depth to your inner set_list would be necessary or not). – Romans-8---31-39 Dec 31 '13 at 14:36
  • Tried upping parse_depth on the top level set_list and the output for channel videos code disappeared. – Dan Triant Dec 31 '13 at 17:23
0

First you will need to close the {event_video} tag. (/) Why are you using Stash? (early parsing?)

| improve this answer | |

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.