Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

subtemplates, lifetime and mergeinclude

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
adn
Smarty Regular


Joined: 31 May 2011
Posts: 91

PostPosted: Sun Nov 13, 2016 6:36 pm    Post subject: subtemplates, lifetime and mergeinclude Reply with quote

Hello,

I'd like to understand a behavior
I set smarty as follow
Code:
$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
$smarty->setMergeCompiledIncludes(TRUE);
$smarty->setCacheLifetime(-1); // cache never expire


And in my template I do my include as
Code:
{include file='box.inc.tpl' cache_lifetime=1200}


Curiously, the subtemplate of my page is well refreshed. Even if smarty lifetime is set to -1 (never expire). For me the subtemplate should be included in the template thanks to the merge option and so it shouldn't be updated... no?

Is that the normal behavior?

Thanks in advance
_________________
http://www.letsGarden.info
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1646

PostPosted: Sun Nov 13, 2016 8:41 pm    Post subject: Reply with quote

I may not answer your question fully, but here's what I know:

Smarty has two passes.

1. Compilation. Your TPL code is translated into PHP code.
2. Caching. The compiled code produces a new script that contains little of PHP code, largely to ensure its configured caching lifetime is honored.

When you include a template with explicitly defined lifetime, it may be merged on compilation, but its cached version will likely be separate. That's how I understand it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP