本文整理汇总了PHP中Smarty_Internal_Template::clearAssign方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Template::clearAssign方法的具体用法?PHP Smarty_Internal_Template::clearAssign怎么用?PHP Smarty_Internal_Template::clearAssign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Template
的用法示例。
在下文中一共展示了Smarty_Internal_Template::clearAssign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_block_begin_widget
/**
* Allows to use Yii beginWidget() and endWidget() methods in a simple way.
* There is a variable inside a block wich has 'widget' name and represent widget object
*
* Example:
* {begin_widget name="activeForm" foo="" bar="" otherParam="" [...]}
* {$widget->some_method_or_variable}
* {/begin_widget}
*
* @param array $params parameters
* @param string $content contents of the block
* @param Smarty_Internal_Template $template template object
* @param boolean &$repeat repeat flag
* @return string
* @author t.yacenko (thekip)
*/
function smarty_block_begin_widget($params, $content, $template, &$repeat)
{
$controller_object = $template->tpl_vars['this']->value;
if ($controller_object == null) {
throw new CException("Can't get controller object from template. Error.");
}
if ($repeat) {
//tag opened
if (!isset($params['name'])) {
throw new CException("Name parameter should be specified.");
}
$widgetName = $params['name'];
unset($params['name']);
//some widgets has 'name' as property. You can pass it by '_name' parameter
if (isset($params['_name'])) {
$params['name'] = $params['_name'];
unset($params['_name']);
}
$template->assign('widget', $controller_object->beginWidget($widgetName, $params, false));
} else {
//tag closed
echo $content;
$controller_object->endWidget();
$template->clearAssign('widget');
}
}