1

I'm using EE 2.7.3, Channel Videos 3.1.5, and Stash 2.4.9.

I am trying to stash all the data for my Page channel, which has a Channel Videos field. So at the top of my template, I have this code ([hopefully] irrelevant stuff omitted):

{exp:stash:set_list name="page_content" parse_tags="yes" parse_depth="2"}
    {exp:channel:entries channel="page" limit="1" status="not closed" require_entry="yes"}
        {stash:page_title}{title}{/stash:page_title}
        {exp:stash:set_list:nested name="header_videos" context="{entry_id}" parse_tags="yes"}
            {exp:channel_videos:videos entry_id="{entry_id}"}
                {stash:video_url}{video:url}{/stash:video_url}
                {stash:video_title}{video:title}{/stash:video_title}
                {stash:video_service}{video:service}{/stash:video_service}
                {stash:video_title}{video:title}{/stash:video_title}
                {stash:video_description}{video:description}{/stash:video_description}
                {stash:video_url}{video:url}{/stash:video_url}
                {stash:video_url_hd}{video:url_hd}{/stash:video_url_hd}
                {stash:video_img_url}{video:img_url}{/stash:video_img_url}
                {stash:video_img_url_hd}{video:img_url_hd}{/stash:video_img_url_hd}
                {stash:video_web_url}{video:web_url}{/stash:video_web_url}
            {/exp:channel_videos:videos}
        {/exp:stash:set_list:nested}    
    {/exp:channel:entries}
{/exp:stash:set_list}

And then, down below, I'm trying to pull that info back up, using this code:

{exp:stash:get_list name="page_content"}
    {exp:stash:get_list:nested name="header_videos" context="{page_entry_id}" prefix="page_video"}
        <h2>Count: {page_video:count}</h2>
        <h3>{page_video:video_title} {page_video:count}</h3>
        Service: {page_video:video_service}<br />
        Desc: {page_video:video_description}<br />
        URL: {page_video:video_url}<br />
        URL HD: {page_video:video_url_hd}<br />
        IMG URL: {page_video:video_img_url}<br />
        IMG URL HD: {page_video:video_img_url_hd}<br />
        Web URL: {page_video:video_web_url}<br />
        Embed Code: {page_video:video_embed_code}<br />
        Embed Code HD: {page_video:video_embed_code_hd}<br />
        <hr />
    {/exp:stash:get_list:nested}
{/exp:stash:get_list}

What's happening is, when I have 2 videos in that field, my code outputs 4 result rows. When I have 3 videos, the get_list outputs 6 results. And the weird part is, the first from each pair has the first three fields correctly populated, but the rest are unparsed tags. And the 2nd from each pair has all the rest, including the 3rd field... Notice in the screenshot below, the URL field is the same on the 1st and 2nd results, the 3rd and 4th results, and the 5th and 6th results.

Like, so: screenshot of example of incorrect output

Does anyone know what I'm doing wrong? Stash is AWESOME, but I sometimes have trouble wrapping my mind around how it works. Thanks for your time!

2

You have some keys which are repeated multiple times, video_url and video_title.

The first duplicate video_url causes the problem, because it makes Stash 'think' the row of keys is starting again, i.e. a new row. This doubles up your list.

  • Aw geez! Thanks, eagle eye! Sorry to waste your time. Sometimes it's hard to see the simplest of issues when you've been starting at it for too long. Your help is much appreciated! – Gary Reckard Feb 24 '14 at 17:30

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.