0

I had a parsing problem with:

{stash:embed name="test"}

It was not parsing.

Reading many posts I read about:

{exp:stash:embed name="test"}

And it's parsing fine. What are the difference between them ??? I'm curious, because exp:stash:embed doesn't appears in the Tag reference documentation.

  • 1
    I'm sure someone may post a more detailed answer but I've often had to tweak the stash tag - likely a parse order issue. – stuartmcd69 May 24 '17 at 9:33
  • Thanks for your fast reply, I also thought that it could be a tweak for a parse order priority, but I was not sure at all. Your reply helped me to understand better the difference. Regards, Stéphane – Stéphane May 24 '17 at 13:46
2

Stash embeds can be parsed at three different stages in the parse order of their parent template:

  • process="start" - embed the template before any other variables and tags in your template are parsed. The tags in the embed will be fully parsed before being included in the parent template, unless you set parse="no". If you do set parse="no", the embed behaves like a native EE template partial.

  • process="inline" - embed the template in the "natural" parse order of the template. This means EE parses the embed like any other tag.

  • process="end" (default) - embed the template at the end of template parsing after other tags and variables in the parent template have been parsed. This is like EE's standard embed.

To enable the process="start" functionality, it was necessary to use an extension hook (template_fetch_template) to parse the Stash embeds before EE's main parsing routines are run. This hook looks for embeds beginning {stash:embed...}, checks if they need to be parsed immediately, and if not replaces them with the tag form {exp:stash:embed...} for parsing by EE later on.

If the embed syntax {stash:embed} was not parsing it must be because there was a problem with Stash being triggered on the template_fetch_template hook. That could be because another add-on using the same hook is not checking the value of ee()->extensions->last_call or is not returning a value as it should. Or it could be that the Stash extensions are not installed or enabled.

You can disable other add-on extensions one-by-one to determine if a conflict is the cause of your issue. And you should check that the following extensions are installed and enabled for Stash in exp_extensions table:

  • stash_fetch_template
  • stash_post_parse
  • template_fetch_template
  • template_post_parse

Using the {exp:stash:embed} syntax is fine providing you don't need to use the process="start" functionality.

| improve this answer | |
  • Mark, thanks a lot for your very well explained answers !! When i tried {stash:embed name="test"}, only Stash and Mustash addons were installed. I tried with process="start", process="inline", and not parsing at all. I verified the extensions, stash_fetch_template, stash_post_parse,template_fetch_template, template_post_parse, are installed and enabled. Only the {exp:stash:embed} syntax is working. The {stash:embed name="test"} only works on a direct page (with no embed template). Thanks again a lot Mark !! – Stéphane May 24 '17 at 22:25
  • I just did a fresh EE 3.5.7 install, and only added the Stash addon. All the exp_extensions table are ok, Stash is enable. {stash:embed name="test"} works only in a simple page without template. When {stash:embed name="test"} is put inside a template page it doesn't work, only {exp:stash:embed name="test"} works. Perhaps it could be a Wamp PHP configuration problem ? – Stéphane May 25 '17 at 2:09
  • I guess it was a Stash configuration problem, now the {stash:embed name="test"} command works fine. Thanks again for your help Mark! – Stéphane Jun 17 '17 at 20:25

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.