本文整理汇总了PHP中Smarty_Internal_Template::append方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Template::append方法的具体用法?PHP Smarty_Internal_Template::append怎么用?PHP Smarty_Internal_Template::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Template
的用法示例。
在下文中一共展示了Smarty_Internal_Template::append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_block_menuItem
/**
* Smarty block plugin, for generating page menu item
* This block must always be called in pageMenu block context
*
* @param array $params
* @param Smarty $smarty
* @param $repeat
*
* <code>
* {pageMenu id="menu"}
* {menuItem}
* {menuCaption}Click Me{/menuCaption}
* {menuAction}http://click.me.com{/menuAction}
* {/menuItem}
* {menuItem}
* {menuCaption}Another menu item{/menuCaption}
* {pageAction}alert('Somebody clicked on me too!'){/menuAction}
* {/menuItem}
* {/pageMenu}
* </code>
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_block_menuItem($params, $content, Smarty_Internal_Template $smarty, &$repeat)
{
if ($repeat) {
$smarty->clear_assign('menuCaption');
$smarty->clear_assign('menuAction');
$smarty->clear_assign('menuPageAction');
} else {
$item = new HtmlElement('a');
if ($smarty->getTemplateVars('menuAction')) {
$href = $smarty->getTemplateVars('menuAction');
} else {
if ($smarty->getTemplateVars('menuPageAction')) {
$onClick = $smarty->getTemplateVars('menuPageAction');
$href = '#';
$item->setAttribute('onClick', $onClick . '; return false;');
}
}
$item->setAttribute('href', $href);
// EXPERIMENTAL - set access key for menu item
$caption = $smarty->getTemplateVars('menuCaption');
if (FALSE != strpos($caption, '&&')) {
$p = strpos($caption, '&&');
$accessKey = substr($caption, $p + 2, 1);
$item->setAttribute('accessKey', $accessKey);
$caption = substr($caption, 0, $p + 3) . '</span>' . substr($caption, $p + 3);
$caption = substr($caption, 0, $p) . '<span class="accessKey">' . substr($caption, $p + 2);
}
$item->setContent($caption);
$smarty->append('pageMenuItems', $item->render());
}
}
示例2: smarty_block_datatable
/**
* @param array $params
* @param string $content
* @param Smarty_Internal_Template $smarty
* @param boolean $repeat
*
* @throws SmartyException
* @return string
*
* @author Kovács Vince
*/
function smarty_block_datatable($params, $content, Smarty_Internal_Template &$smarty, &$repeat)
{
if (!class_exists('Datatable')) {
throw new SmartyException('chumper/datatable not installed');
}
if ($repeat) {
$options = array('language' => \Lang::get('datatable', array()), 'processing' => true, 'bProcessing' => true, 'stateSave' => true, 'autoWidth' => false, 'columns' => array());
$table = Datatable::table();
if (isset($params['id'])) {
$table->setId($params['id']);
unset($params['id']);
}
if (isset($params['url'])) {
$table->setUrl($params['url']);
unset($params['url']);
} elseif (isset($params['action'])) {
$table->setUrl(URL::action($params['action']));
unset($params['action']);
}
if (isset($params['searching'])) {
$options['searching'] = $params['searching'];
}
if (isset($params['lengthChange'])) {
$options['lengthChange'] = $params['lengthChange'];
}
if (isset($params['class'])) {
$table->setClass($params['class']);
}
$table->setOptions($options);
$smarty->append('datatables', $table);
} else {
$tables = $smarty->getVariable('datatables')->value;
$table = array_pop($tables);
$smarty->assign('datatables', $tables);
if (isset($params['view'])) {
return $table->render($params['view']);
}
return $table->render('datatable');
}
return '';
}
示例3: close
/**
* Close capture section
*
* @param \Smarty_Internal_Template $_template
*
* @throws \SmartyException
*/
public function close(Smarty_Internal_Template $_template)
{
if ($this->captureCount) {
list($buffer, $assign, $append) = array_pop($this->captureStack);
$this->captureCount--;
if (isset($assign)) {
$_template->assign($assign, ob_get_contents());
}
if (isset($append)) {
$_template->append($append, ob_get_contents());
}
$_template->_cache['capture'][$buffer] = ob_get_clean();
} else {
$this->error($_template);
}
}