Cache and login
It was interesting to me. How do you guys go about scripting a website where you have login and logouts at the top. Therefore, if someone is logged in, you say "Hi Scott". If someone is not logged in, he says "Log in".
I am using force compile = false. And using
(!$smarty->is_cached('index.tpl',$template_cache_id)) {
do something
}
What are you guys using to keep some sections from being cached and others cached for such a general scenario? My site is photoidentify.com
Thank!
+2
source to share
1 answer
I have defined a block function that excludes small blocks of templates from the cache.
function smarty_block_dynamic($param, $content, $smarty) {
return $content;
}
$smarty->register_block("dynamic", "smarty_block_dynamic", false);
Thus, everything in a template surrounded by {dynamic} {/ dynamic} will not be cached. This allows you to output, for example, session-based data such as username, etc.
+4
source to share