Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Multi Cache on Smarty

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
afs.adilson
Smarty n00b


Joined: 28 Sep 2012
Posts: 2

PostPosted: Fri Sep 28, 2012 4:07 pm    Post subject: Multi Cache on Smarty Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Sep 28, 2012 5:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
afs.adilson
Smarty n00b


Joined: 28 Sep 2012
Posts: 2

PostPosted: Fri Sep 28, 2012 5:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Sep 28, 2012 6:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks 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