当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty_Internal_Template::append方法代码示例

本文整理汇总了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());
    }
}
开发者ID:saiber,项目名称:livecart,代码行数:55,代码来源:block.menuItem.php

示例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 '';
}
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:52,代码来源:block.datatable.php

示例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);
     }
 }
开发者ID:vanderlee,项目名称:smarty,代码行数:23,代码来源:smarty_internal_runtime_capture.php


注:本文中的Smarty_Internal_Template::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。