croxton / Stash

Stash allows you to stash text and snippets of code for reuse throughout your templates.
GNU General Public License v3.0
197 stars 20 forks source link

Variables inside embeds not working as per Docs #119

Closed sheferd closed 10 years ago

sheferd commented 10 years ago

I'm trying to pass a variable into an embed but it isn't out putting correctly. From docs:

{!-- Stash variables will be parsed if passed in the name parameter --} {stash:embed name="{stash:my_var}"}

Here is my code: This is inside templates/stash/presets/default.html: {exp:stash:set name="page_preset"}default{/exp:stash:set} This is inside templates/_pages/.default: {stash:embed name="regions:{stash:page_preset}_page_start"}

And where it starts: {exp:switchee variable="{segment_2}" parse="inward"} ... ... {case default="yes"} {embed="_pages/.default"} {stash:embed:presets:default} {/case} {/exp:switchee}

which outputs:

The following errors were encountered Stash: the file "/Applications/XAMPP/xamppfiles/htdocs/system.com/s/expressionengine/templates/stash/regions/stash/page_preset-_page_start.html" was not found.

it seems the "{'s" are being ignored.

Any ideas?

croxton commented 10 years ago

The EE embed is being parsed before the Stash embed. Either use all Stash embeds, or include (but don't parse) the Stash embed early, instead of at the end of parsing (as per default).

{stash:embed:presets:default process="start" parse="no"}