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

include template and cache it!

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
saerdna
Smarty Rookie


Joined: 12 Dec 2004
Posts: 20
Location: Linköping, Sweden

PostPosted: Sun Dec 12, 2004 9:20 pm    Post subject: include template and cache it! Reply with quote

Im working on a site with non-cached templates and cached templates.

I found out to make a cached template from a non-cached template you have to do something like this:

Code:

{php}
global $smarty;
$smarty->caching = true;
$smarty->display('foo.tpl',$id);
{php}


Wouldnt it be more nice if i just can do something like this:

Code:

{include file=foo.tpl cached=true lifetime=3600}


it couldnt possible be better to use {dynamic} {/dynamic} where i dont want to cache? or could it?

right now i have like this:
somepage.tpl:
Code:

{* some code *}
{include file=header.tpl}
{* some code *}
{include file=somepage_cached.tpl}
{include file=footer.tpl}
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Dec 13, 2004 4:20 am    Post subject: Reply with quote

you can register functions as non-cached.
Back to top
View user's profile Send private message Visit poster's website
saerdna
Smarty Rookie


Joined: 12 Dec 2004
Posts: 20
Location: Linköping, Sweden

PostPosted: Mon Dec 13, 2004 1:26 pm    Post subject: Reply with quote

mohrt wrote:
you can register functions as non-cached.


Exact how do you mean?


I think I solved it in a nother way using two smarty objects

$smarty and $smarty_cache

then i can use $content = $smarty_cache->fetch(...) ;

and put it into $smarty with $smarty->assign('content', $content);
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Dec 13, 2004 2:22 pm    Post subject: Reply with quote

http://smarty.php.net/manual/en/caching.cacheable.php
Back to top
View user's profile Send private message Visit poster's website
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 -> Feature Requests 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