1

I used this technique on a site I just built with EE 2.7.0 and Stash 2.3.9. Now I'm trying the same technique on EE 2.7.2 and Stash 2.4.7, and it's not working! This is a simplified version just to show what's going on. Note: I'm using stash:get instead of stash:get_list just to dump out the data.

index.html

{exp:channel:entries
    channel="white_paper|c_study|video|webinar|data_sheet"
    limit="8"
}
    {stash:embed
        name="item"
        process="start"
    }
{/exp:channel:entries}

{exp:stash:get name="resources" process="end"}

item.html

{exp:stash:append_list
    name="resources"
    parse_tags="yes"
}
    {stash:item_title}{title}{/stash:item_title}
    {stash:item_date}{entry_date format="{gv_date_format_short}"}{/stash:item_date}
    {stash:item_url}/resources/{url_title}{/stash:item_url}
    {stash:item_type}{channel}{/stash:item_type}
{/exp:stash:append_list}

Instead of outputting content from the channel:entries loop, it is just outputting the unparsed tags:

item_title|=|{title}|&|item_date|=|{entry_date format="%M %j, %Y"}|&|item_url|=|/resources/{url_title}|&|item_type|=|{channel}

So it's clearly a parse order issue, and it seems like something has changed either in EE or Stash.

3 Answers 3

3

Stash 2.4.3 corrected a long-standing inconsistency with embeds set to process at the start of template parsing. At the other stages of parsing (inline and end) embeds are parsed by default - that is to say, parse="yes" is the default parameter value if not specified, and 2.4.3 added this as the default for start too.

To make your embed behave as it did before (to disable parsing so that the content of the embed is included in the host template without first being parsed) simply add parse="no" to the tag:

{stash:embed
    name="item"
    process="start"
    parse="no"
}
1
  • Ugh, so much banging my head and such a simple fix. Thanks Mark! Dec 6, 2013 at 12:03
2

I'm not sure why you're using an embed for this, you're not passing anything to it so I'd use a snippet for sure.

Also may as well use set_list, open the tags above the exp:channel call

{exp:stash:set_list name="resources" parse_tags="yes"}
  {exp:channel:entries channel="white_paper|c_study|video|webinar|data_sheet" limit="8"}
    {snippet:get_data}
  {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="resources" process="end"}
<div class="entry {item_type}">
  <h1>{item_title}</h1>
  <p class="date">{item_date}</p>
  ....
</div>
{/exp:stash:get_list}

Snippet: get_data

{stash:item_title}{title}{/stash:item_title}
{stash:item_date}{entry_date format="{gv_date_format_short}"}{/stash:item_date}
{stash:item_url}/resources/{url_title}{/stash:item_url}
{stash:item_type}{channel}{/stash:item_type}

You could forego this markup and just replace your embed with a snippet instead and be done OR remove 'start' from your embed, you need it to be inline to get parse order working normally:)

1
  • I'm using a stash embed because when it's process="start", it's similar to an EE snippet, and there are a few advantages: you don't have to edit in the awful CP interface, and it's version-able. I know there are add-ons that sync snippets, but it's easier to just not deal with them. Dec 6, 2013 at 12:01
1

It's your process="start" parameter, I believe, that's messing you up. You're telling the Stash embed to process before the channel entries tag pair. Try removing process="start" and adding parse_stage="both".

Stuartmcd69's suggestion is solid too.

UPDATE:

I respectfully bow out now that Mark has spoken. :)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.