Plugin

Archived
Forum
(read-only)

String

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From eMarketSouth

     

Urgent: Caching Breaking String Plugin (Tried “Random” Solution)

Support Request

JanPaul999
JanPaul999

In the main body I have this:

{exp:string:set name="c_title" random}MyTitle{/exp:string:set} 

Then in the embedded header I have this:

<title>{exp:string name="c_title" random}</title

When I enable caching and load the page at first the title works, but when I revisit the page after visiting a page with another title all I get is nothing, an empty title.

Why does this happen? And how can I get this to work?

eMarketSouth
# 1
Developer
eMarketSouth

caching at the template level only saves the output of that template, not any string variables that might have been set in the processing of that template. since the template caching prevents the template parser from running on subsequent requests, the c_title variable is never set for the header to use.

JanPaul999
# 2
JanPaul999

So what you’re saying here is that the plugin won’t work with template caching on?

What does the caching explenation at the bottom of this page refer to then? Could you explain?:
http://www.emarketsouth.com/add-ons/string-plugin/template-tags/

I suspect that the way I’m using the plugin here is one of the most common uses for it, so I’d expect it to work. Is there a way to make it work with caching? Or is this simply not possible and can I only use the plugin at the price of having caching disabled?

eMarketSouth
# 3
Developer
eMarketSouth

the random parameter avoids tag caching only… basically if you have two identical plugin calls (like {exp:string:output name=“whatever”}) two or more times in the same template it will only be evaluated once and that output will be used for each instance of that tag. completely unrelated to template-level caching.

JanPaul999
# 4
JanPaul999

Ah ok, I understand now.

So am I right thinking that I must use tag caching instead of template caching to be able to output the string plugin variables?

I mean like this: {exp:channel:entries cache=“yes” refresh=“30”}

I’m assuming that will work fine and not interfere with the string plugin, but just asking to be sure.