RE: [SMARTY] Cache result from db-query?
| From: | Eskil Keskikangas | Date: | Tue, 04 Mar 2003 14:09:05 +0000 |
| Subject: | RE: [SMARTY] Cache result from db-query? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8388@lists.php.net to get a copy of this message | ||
Will this work?
function smarty_function_top_ten_products($params, &$smarty) {
extract($params);
$smarty->caching = 2;
if (!$smarty->is_cached("TORGET/topTen.tpl")) {
$data = rand(0,10);
$smarty->assign("topData",$data);
}
$smarty->cache_lifetime = 180;
return $smarty->fetch("TORGET/topTen.tpl");
}
What will become cached when i define "caching = 2" in the function?
/Eskil
At 14:51 2003-03-04 +0100, Peter Billen wrote:
forgot url: http://smarty.php.net/manual/en/language.function.insert.php Peter -----Original Message----- From: Peter Billen [mailto:peter@clueless.be] Sent: dinsdag 4 maart 2003 14:39 To: smarty-general@lists.php.net Subject: RE: [SMARTY] Cache result from db-query? I am not used to caching & smarty, but I think it's impossible to cache database queries with smarty. The only thing that smarty (should?) cache is output of 'data'. So I think it's only possible to cache a parsed template (or parts of it), so next time, smarty does not have to re-loop the whole datastructures again. However, I could be wrong! You may want to look to the 'insert' function, in order to cache parts of a template (and not the whole template itself). Peter -----Original Message----- From: Eskil Keskikangas [mailto:eskil@funplanet.com] Sent: dinsdag 4 maart 2003 14:32 To: smarty-general@lists.php.net Subject: [SMARTY] Cache result from db-query? Hi, I want to cache a small part of my output. It's a toplist from a mysql-db that results in a slow query. But I don't understand how to do this. If I enable cache won't all output get cached then? Give me a hint please. :) BG Eskil -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php