Files
oc-server3/htdocs/lib2/smarty/ocplugins/block.nocache.php
2012-05-09 20:05:43 +02:00

51 lines
1.0 KiB
PHP

<?php
/***************************************************************************
* You can find the license in the docs directory
*
* Unicode Reminder メモ
***************************************************************************/
/* block nocache
*
* usage
*
* {nocache}...{/nocache}
*
* OR
*
* {nocache name="<unique blockname>" <varname1>=$<value1> [...]}...{/nocache}
*/
function smarty_block_nocache($param, $content, &$smarty, &$repeat)
{
static $counter = array();
if ($repeat)
{
if (!isset($param['name']))
return $content;
$name = $param['name'];
unset($param['name']);
if (!isset($counter[$name]))
$counter[$name] = 0;
$counter[$name]++;
if ($smarty->_cache_including)
{
$param = isset($smarty->_cache_info['cached_vars'][$name][$counter[$name]]) ? $smarty->_cache_info['cached_vars'][$name][$counter[$name]] : array();
}
else
{
$smarty->_cache_info['cached_vars'][$name][$counter[$name]] = $param;
}
foreach ($param AS $k => $v)
{
$smarty->_tpl_vars[$k] = $v;
}
}
return $content;
}
?>