| Geoffrey Hoffman 2005-02-02, 9:01 pm |
| Another way to do it that is probably more flexible is to have a 2nd
template "content.tpl":
{$dynamicContent}
Content.tpl will have to be set up with a cache lifetime of zero (different
from your cache lifetime for wrapper.tpl)
In your PHP do $smarty->assign("dynamicContent", $content);
Then put {include file="content.tpl"} in your wrapper.tpl.
You will probably want to look at the docs on cacheing:
http://smarty.php.net/manual/en/caching.php
and experiment a bit.
* * *
Geoffrey Hoffman
www.salientdigital.com
-----Original Message-----
From: Maximillian Schwanekamp [mailto:lists@neptunewebworks.com]
Sent: Wednesday, February 02, 2005 4:30 PM
To: smarty-general@lists.php.net
Subject: [SMARTY] Basic Cache question
Hello! This is my first question to the list, so go easy on me, please?
What is the best way to include non-cached content in a cached template?
E.g. I have pagewrapper.tpl.html, which has the head, navigation
elements and footer. Within that, I have {$content}. $content is
generated from php with database info, etc depending on get/post/server
variables.
Right now I have caching disabled, but the "wrapper" changes
infrequently. What is the best way to have that wrapper get cached while
still allowing the non-cached data in $content?
--
Maximillian Von Schwanekamp
http://www.neptunewebworks.com/
|