|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
afs.adilson Smarty n00b
Joined: 28 Sep 2012 Posts: 2
|
Posted: Fri Sep 28, 2012 4:07 pm Post subject: Multi Cache on Smarty |
|
|
Hello Everybody,
I have a question.
How Can I generate different cache on a include php file?
Example:
index.html (cache: 60 minutes)
<html>
<body>
{include_php file='news.php'} // I want 10 minutes only in this page
</body>
</html>
PS: Both files I'm using smarty |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Sep 28, 2012 5:33 pm Post subject: |
|
|
index.html
Code: | <html>
<body>
{include file='news.html' life_time=600} // I want 10 minutes only in this page
</body>
</html> |
news.html
Code: | {include_php file='news.php'} |
|
|
Back to top |
|
afs.adilson Smarty n00b
Joined: 28 Sep 2012 Posts: 2
|
Posted: Fri Sep 28, 2012 5:48 pm Post subject: |
|
|
Thanks U.Tews,
But doesn't exists a simple form to do this include directly with life_time in a php file?
My news.php have smarty instance too, display, assign, etc.
Thanks in advance |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Sep 28, 2012 6:46 pm Post subject: |
|
|
No, it's not possible to give {include_php} directly a life time.
The other solution is that you don't use {include_php} but excute it's code in the script. fetch() it's template with caching and life_time of 600 and assign it's result to Smarty varibale $news in the intance wihich is calling index.html.
Display $news in nocche mode.
Code: | <html>
<body>
{$news nocache}
</body>
</html> |
This seems to make more sense in your case. |
|
Back to top |
|
|
|
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
|