|
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 |
saerdna Smarty Rookie
Joined: 12 Dec 2004 Posts: 20 Location: Linköping, Sweden
|
Posted: Sun Dec 12, 2004 9:20 pm Post subject: include template and cache it! |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Dec 13, 2004 4:20 am Post subject: |
|
|
you can register functions as non-cached. |
|
Back to top |
|
saerdna Smarty Rookie
Joined: 12 Dec 2004 Posts: 20 Location: Linköping, Sweden
|
Posted: Mon Dec 13, 2004 1:26 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
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
|