Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Speedy fragment tag and Template Layouts

Status Resolved
Add-on / Version Speedy 1.9.1
Severity
EE Version 7.4.6

Dmitry Kuchev

Apr 12, 2024

Sorry, me again. Trying to wrap my head around layouts caching. So, if I use template layouts and layout variables extensively, Speedy fragment tag is essentially worthless to me?

I mean, imagine this picture: The entry template - it is just a bunch of layout:set tags inside of channel:entries loop, and the layout template - it’s just a bunch of layout:* variables in html markup (and layout:set tags for another layout template).

So, it appears that I can use speedy:fragment tag only for exp:channel:entries call itself, and everything else inside should be escaped. Is it make any sense? Or in this case it would be better to use native caching?

#1

BoldMinded (Brian)

No, you can use fragment caching with layout variables and template layouts. You can wrap an entire page in a fragment tag if you want, it’s not limited to just entries tags.

#2

Dmitry Kuchev

Unfortunately, {layout:set} tags require escaping. So, if I have only {layout:set} tags in template and {layout:*} variables in layout, I have to escape all of it.

Template:


{layout="template_group/_html-markup"}
{exp:channel:entries channel="news"}
 {layout:set name="title"}{title}{/layout:set}
 {layout:set name="body"}{body}{/layout:set}
{/exp:channel:entries}

_html-markup layout template:


<h1>{layout:title}</h1>
<div>{layout:body}</div>

#3

BoldMinded (Brian)

That example doesn’t show any speedy tags, so I don’t know exactly what you’re trying to do.

Speedy works with layout tags, as in it does not stop them from working, but you’re still operating within the confines of EE’s parse order, so if you’re doing something that isn’t currently working, then it might not be possible (again, due to parse order), and no recommendations I make or changes to Speedy’s code will fix that.

Login to reply