I'm just playing around with implementing Stash on a site, following the Template Partials Using Stash article, but now I seem to be having a scope/execution order issue.


  <div id="container">
   <div id="sidebar">
   <div id="content">

Content Partial


I have some custom member fields that I need in a few places throughout my content sections, so I'm trying to retrieve them in the layout and assign them to variables, in the hopes that I could save my content from being littered with {exp:member] tags, but the variables don't seem to be available in my content partials.

I believe that it's not working because my Stash variables are being parsed before the values are assigned, and from what I believe I understand about the order of how EE is parsing the views, it goes something like this:

  1. Partial is retrieved
  2. Content is assigned to {exp:stash:content}
  3. Layout embed is retrieved
  4. Layout is parsed and {exp:stash:content} value injected.

Am I missing a feature/use-case of Stash, or am I simply using the wrong tool for this particular job?

Update: After racking my brain for days, and then writing this question, I tried saving the variable definitions in a snippet, which is called from my layout and it seems to work. I'd still be interested to know if there is a Stash implementation of this type of case, though.

1 Answer 1


You should try separating the data-fetching from the markup-assembly - this way you'll be able to cleanly fetch all your member variables and store them into Stash vars for use later (either in the same template or an embedded one). Here's a tutorial I wrote describing how to do this: http://www.jamessmith.co.uk/articles/expressionengine-stash-tutorial-level-2

  • Great articles. Now I'm off to re-write my templates :)
    – nageeb
    Commented Mar 11, 2014 at 8:08

Your Answer

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

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