Używam na swojej stronie Smarty Templates i napotkałem pewien problem. Otóż pewna podstrona jest cache'owana, ale jest na niej kilka zmiennych, które chciałbym, by były generowane dynamicznie (bez użycia cache).
Próbowałem z {dynamic}{/dynamic} ale mimo to strona jest nadal cała cache'owana.
Fragment mojego kodu PHP wygląda tak:
<?php // nagłówek require_once("includes/head.php"); // ustawianie cache $temp -> caching = 1; $temp -> compile_check = false; // początek - określanie, która zakładka ma być włączona. $option[0] = (!$_GET['action']) ? 'active' : 'unactive'; $option[1] = ($_GET['action'] == 'effects') ? 'active' : 'unactive'; $option[2] = ($_GET['action'] == 'battles') ? 'active' : 'unactive'; $option[3] = ($_GET['action'] == 'quests') ? 'active' : 'unactive'; [...tutaj część właściwa strony...] // stopka function smarty_block_dynamic($param, $content, &$smarty) { return $content; } $temp->register_block('dynamic', 'smarty_block_dynamic', false); $temp -> display("page.tpl", $user -> id); ?>
I TPL
Kod
{dynamic}
<table width=500 cellpadding=0 cellspacing=0 align=center rules=cols frame=box>
<tr>
<td class="{$Option[0]}"><a class=upper_table_panel href=#>{$Lang[0]}</a></td>
<td class="{$Option[1]}"><a class=upper_table_panel href=#>{$Lang[1]}</a></td>
<td class="{$Option[2]}"><a class=upper_table_panel href=#>{$Lang[2]}</a></td>
<td class="{$Option[3]}"><a class=upper_table_panel href=#>{$Lang[3]}</a></td>
</tr>
</table>
{/dynamic}
<table width=500 cellpadding=0 cellspacing=0 align=center rules=cols frame=box>
<tr>
<td class="{$Option[0]}"><a class=upper_table_panel href=#>{$Lang[0]}</a></td>
<td class="{$Option[1]}"><a class=upper_table_panel href=#>{$Lang[1]}</a></td>
<td class="{$Option[2]}"><a class=upper_table_panel href=#>{$Lang[2]}</a></td>
<td class="{$Option[3]}"><a class=upper_table_panel href=#>{$Lang[3]}</a></td>
</tr>
</table>
{/dynamic}
Chodzi mi o to, aby ta tabela nie była cache'owana. (A dokładniej {$Option[]})
Używam Smarty 2.6.19.
Byłbym wdzięczny za pomoc / wskazówkę
