I'm having a hard time wrapping my head around this.
I'm using Stash template partials approach, with the needle/haystack technique for replacing variables in content blocks... with CE Cache over the top.
My template looks like this:
{!-- Embed view/layout --}
{stash:embed:layouts:default}
{exp:ce_cache:it id="model"}
{exp:channel:entries ...}
{!-- Get video data from matrix field --}
{cf_page_videos}
{exp:stash:set name="video-{row_count}" type="snippet"}
{mx_video}
{/exp:stash:set}
{/cf_page_videos}
{!-- Vars to go in view/layout --}
{exp:stash:set}
{stash:title}{title}{/stash:title}
{stash:content}
{!-- Parse this so the {video-1}, {video-2} snippets within will work --}
{exp:stash:parse}
{cf_page_content}
{/exp:stash:parse}
{/stash:content}
{/exp:stash:set}
{/exp:channel:entries}
{/exp:ce_cache:it}
My view/layout template looks like this:
{exp:ce_cache:it id="view"}
<h1>{exp:stash:title}</h1>
{exp:stash:content}
{/exp:ce_cache:it}
Everything works just fine when CE Cache is disabled.
When I enable it, the 'view' cache fragment shows something like:
<h1>Page Title</h1>
<p>This is the page content</p>
<p>{video-1}</p>
<p>Some more content</p>
If I change {exp:stash:parse}
to {exp:stash:parse process="end"}
, then the 'view' cache fragment will look something like:
<h1>Page Title</h1>
{d534s5d782yihu542u78fdhs894sh}
I don't know what I need to escape or modify to get this working.
Any suggestions would be appreciated!
Thanks
Update:
The latest version of CE Cache has some Stash-related improvements.
Updating fixed the issue but introduces a Stash bug.
Also, I need to use {exp:stash:parse process="end"}
.
I get a PHP error on the first page load, but everything seems to get cached correctly and the subsequent page loads are perfect.
I've taken this up with Mark and will post an update later.
Update 2:
Aaron (CausingEffect) has fixed the issues in the latest version of CE Cache.
The above code works perfectly - provided you use {exp:stash:parse process="end"}
.