Jeli neko radio multiple Cache na jednoj stranici da radi recimo centralna kolona sajta se kesira 30 sekundi a header i footer po sat vremena?
Multiple chaching na jednoj stranici sa razlicitim lifetime
Zakačeno
Nista te ne razumem.
Potpis
Goran Pilipović fka bluesman
Ja sam, i sasvim je moguća takva kombinacija, nešto slično sam radio, više različitih "sekcija" jedne stranice se keširaju različitim vremenima i to radi kao zmaj. Čak možeš da dodeliš grupe pa tek onda imaš interesantne efekte...
PS: Mislim da bi Vas dvojica trebali još malo da pročitate Smaty DOC B-)
PS: Mislim da bi Vas dvojica trebali još malo da pročitate Smaty DOC B-)
BlueIce imas pravo, ma i meni je bilo logicno skroz da imaju takve mogucnosti samo do sad mi nisu trebale.
Sad sam sredio recimo banner $chache_lifetime je 30 sekundi meni i ostale zezancije sam stavio 24 sata a vijesti prilikom dodavanja nove vijesti ili komentara na vijest cistim cache i naravno profilaktike radi svakih 30 minuta.
Ma sve se nadje samo treba potreba da bi se naucilo.
Mali hint pogledajte varivablu $caching i notice ako je ona 2.
Sad sam sredio recimo banner $chache_lifetime je 30 sekundi meni i ostale zezancije sam stavio 24 sata a vijesti prilikom dodavanja nove vijesti ili komentara na vijest cistim cache i naravno profilaktike radi svakih 30 minuta.
Ma sve se nadje samo treba potreba da bi se naucilo.
Mali hint pogledajte varivablu $caching i notice ako je ona 2.
Evo sto kazu na smarty general mailing listi
Citat:
As far as I'm aware, it's not possible to change the caching values
for children of the parent templates. The output is cached for a
display()/fetch() call and all its descendants.
Theres no reason why you have to only have the one template and
include everything in from there.. you can do it like this:
I do all my pages like this for the fine tuning it allows.
for children of the parent templates. The output is cached for a
display()/fetch() call and all its descendants.
Theres no reason why you have to only have the one template and
include everything in from there.. you can do it like this:
Code:
<?php
$smarty->cache_lifetime = 10000;
$smarty->display('header.tpl');
$smarty->cache_lifetime = 30;
$smarty->display('banner.tpl');
$smarty->cache_lifetime = 1800 + $randomness;
$smarty->display('content.tpl');
$smarty->cache_lifetime = 10000;
$smarty->display('footer.tpl');
?>
<?php
$smarty->cache_lifetime = 10000;
$smarty->display('header.tpl');
$smarty->cache_lifetime = 30;
$smarty->display('banner.tpl');
$smarty->cache_lifetime = 1800 + $randomness;
$smarty->display('content.tpl');
$smarty->cache_lifetime = 10000;
$smarty->display('footer.tpl');
?>
I do all my pages like this for the fine tuning it allows.
Mislim da to i nije tako pametna ideja, tj mnogo je po meni bolje:
Code:
<?php
// Pretpostavljamo da su vremena sa kesiranje dobro postavljena
if ($updated_1)
clear_cache('group_1'); //ociti kes, vrati vreme na ono koje treba da bude za kesiranje (ako se promenilo), a smarty ce da zavrsi ostalo :)
if ($updated_2)
clear_cache('group_2');
.
.
.
if ($updated_n)
clear_cache('group_n');
$smaty->assign('header', $smarty->fetch('header.tpl') );
$smaty->assign('banner', $smarty->fetch('banner.tpl') );
$smaty->assign('footer', $smarty->fetch('footer.tpl') );
$smarty->display('content.tpl');
?>
<?php
// Pretpostavljamo da su vremena sa kesiranje dobro postavljena
if ($updated_1)
clear_cache('group_1'); //ociti kes, vrati vreme na ono koje treba da bude za kesiranje (ako se promenilo), a smarty ce da zavrsi ostalo :)
if ($updated_2)
clear_cache('group_2');
.
.
.
if ($updated_n)
clear_cache('group_n');
$smaty->assign('header', $smarty->fetch('header.tpl') );
$smaty->assign('banner', $smarty->fetch('banner.tpl') );
$smaty->assign('footer', $smarty->fetch('footer.tpl') );
$smarty->display('content.tpl');
?>
ma ovo je copy paste sa mail liste bilo... naravno da i ja fetchujem komade sajta prvo pa ih kao stringove samo assign...