Search code examples
expressionengine

Blank Output using Stash


I'm finally giving Stash (version 2.3.5 on EE 2.5.3) a go on a project to see if it's as good as everyone says.

I've followed the docs as much as I can and set up the stash at the header of the page as follows:

{exp:channel:entries channel="homepage" limit="1" dynamic="no"}
{exp:stash:set_list name="homepage"}
    {stash:cf_homepage_main_intro}{cf_homepage_main_intro}{/stash:cf_homepage_main_intro}
    {stash:cf_homepage_strapline}{cf_homepage_strapline}{/stash:cf_homepage_strapline}

    {cf_homepage_contact_info}
        {stash:mx_pinterest}{mx_pinterest}{/stash:mx_pinterest}
        {stash:mx_facebook}{mx_facebook}{/stash:mx_facebook}
        {stash:mx_twitter}{mx_twitter}{/stash:mx_twitter}
        {stash:mx_tel}{mx_tel}{/stash:mx_tel}
        {stash:mx_email}{mx_email}{/stash:mx_email}
        {stash:mx_address}{mx_address}{/stash:mx_address}
    {/cf_homepage_contact_info}
{/exp:stash:set_list}
{/exp:channel:entries}

And then in the rest of my template, I'm attempting to call the values as follows:

{exp:stash:homepage:mx_tel}

However, I get nothing.

If I output the field names directly they work fine, I've also turned on debugging and I can see the point in which stash sets the values, and that all looks fine, however the debugger reports the following:

*Stash: RETRIEVED homepage:mx_email with value*

I'm a little at a loss on where to go from here... Does anyone have any pointers?

Thanks,

Carl


Solution

  • Ah! I see in your question that you're trying to call the vars from inside the same template. So you're running into a parse order issue. You need to add the process="end" parameter to your exp:stash:get_list or exp:stash:get tags. And read my article about template partials!