Archive for the ‘smarty’ Tag

smarty caching problem

we can use {dynamic} for blocking perticular section of page to cache!

[index.php]

$smarty = new Smarty;
smarty->caching = true;

function smarty_block_dynamic($param, $content, &$smarty) {
return $content;
}
$smarty->register_block(‘dynamic’, ’smarty_block_dynamic’, false);

[index.tpl]

{dynamic}

{insertx name=photo_link assign=plink pid=$smarty.section.san.index}
{$plink}

{/dynamic}

here the section photo_link will not cached it is the dynamic block.

“insertx” is the plugin for insert tag used in smarty template files

function smarty_function_insertx($params, &$smarty)
{

$func=”insert_”.$params['name'];

if($params['assign']!=”")
$smarty->assign($params['assign'], $func($params));
else
return $func($params);
}