1

I have a client that needs a slider that can either show text, or a "tweet" (using CE Tweet for getting the tweet's info). I'm using Stash, and thought this would be the best way to get there:

    {exp:channel:entries
        channel='slides'
        dynamic='no'
    }
        {exp:stash:set_list 
            name='home_slides' 
            parse_tags='yes'
            parse_depth='2'
        }
            {if slide_type == 'tweet'}
                {slide_tweet type='show'}
                    {stash:list_text}{text}{/stash:list_text}
                    {stash:list_attribution}{user_name}, <a href="https://twitter.com/{user_screen_name}" target="_blank">{user_screen_name}</a>{/stash:list_attribution}
                    {stash:list_cta}<span class="ui-retweet"></span> Retweet{/stash:list_cta}
                    {stash:list_link}https://twitter.com/intent/retweet?tweet_id={id_str}{/stash:list_link}
                {/slide_tweet}
            {if:else}
                {stash:list_text}{slide_text}{/stash:list_text}
                {stash:list_attribution}{slide_source}{/stash:list_attribution}
                {stash:list_cta}{slide_call_to_action}{/stash:list_cta}
                {stash:list_link}{slide_link}{/stash:list_link}
            {/if}
        {/exp:stash:set_list}
    {/exp:channel:entries}

This is where I'm outputting the list (simplified slightly):

    {exp:channel:entries
    channel='pages'
    limit='1'
    require_entry='yes'
}
    {exp:stash:set parse_tags='yes'}
        {stash:page_title}{title}{/stash:page_title}
        {stash:page_content}
            <section class="slider">
                <ul data-orbit data-options="bullets: false; ">
                    {exp:stash:get_list name='home_slides' prefix='list'}
                        <!-- {list:count} -->
                        <li>
                            <div class="row">
                                <div class="large-12 columns">
                                    <h2><span class="ui-quote"><span class="ui-quote-open"></span></span>
                                        {list_text}<br>
                                        <small class="attribution">{list_attribution}</small>
                                    </h2>
                                    <p><a href="{list_link}" class="btn">{list_cta}</a></p>
                                </div>
                            </div>
                        </li>
                    {/exp:stash:get_list}
                </ul>
            </section>
        {/stash:page_content}
    {/exp:stash:set}
{/exp:channel:entries}

Now after my actual entry gets outputted, another "slide" gets put into my template, but all the stash-variables in that list-item are empty. Any idea as to where this emtpy item might come from?

Thanks!

  • Steven
1

You're re-wrapping your Stash get_list in another Channel Entries tag pair where you're also outputting 1. limit="1". So it looks like it will probably be running the Stash list and then acting on the outer loop of the extra Channel Entries tag pair.

| improve this answer | |
0

Ok, so apparently this is an enormous conflict between stash:set_list, switchee and parse-order. The parse order doesn't play nice with the combination of set_list and switchee, so I refactored it to plain conditionals, causing the unmatched conditional to parse but not return anything, fooling stash into thinking there's another item. Has anyone experienced this before?

| 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.