LSCache + ESI + Smarty

serpent_driver

Well-Known Member
#1
Hi all,

I am looking for a documentation about how ESI can be used with Smarty. ESI works, but only if I set a hardcoded file path for src. If I set a Smarty tag for src I get error:

[an error occurred while processing this directive]
Is there any log file for debugging this error?
 
Last edited by a moderator:

Unique_Eric

Administrator
Staff member
#2
Hi ,

Could you provide example code you used? How can we reproduce it?
Just to clarify it is on WordPress application?

Best
 

serpent_driver

Well-Known Member
#3
This one works
Code:
<esi:include src="/hardcoded_file_path/file.php" cache-control="no-cache" />
This one doesn't
Code:
<esi:include src="{$box_shopping_cart}" cache-control="no-cache" />
It is no Wordpress application. WP doesn't use Smarty.....!
 
Last edited by a moderator:

Unique_Eric

Administrator
Staff member
#4
Hi @serpent_driver ,

yeah, I was thinking if you were asking about smarty cache or php engine.

Unfortunately I don't think LiteSpeed ESI support smarty syntax. But it support cache-control= "public" and cache-control= "private" as well for different scenario you need.

Best,
Eric
 
Last edited by a moderator:

serpent_driver

Well-Known Member
#6
There are some news and now I know why it doesn't work. ESI processor tries to fetch the URI in <esi:include src=""> like a regular request, but if there is a Smarty tag, ESI doesn't know what to do with Smarty tag. That means there is no way to use Smarty tags with ESI src attribute.

Instead of <esi:include> I also tried <esi:inline>. If <esi:inline> is defined the content within ESI will be displayed, but only if ESI support is disabled or not defined in LS Cache rules. If ESI support is ON, LS removes the complete code fragment. It doesn't matter what attributes are used in this ESI tag, whenever there is <esi:inline> defined LS removes it from source code.
 
Last edited by a moderator:
Top