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


PHP Smarty_Internal_Template::getVariable方法代码示例

本文整理汇总了PHP中Smarty_Internal_Template::getVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Template::getVariable方法的具体用法?PHP Smarty_Internal_Template::getVariable怎么用?PHP Smarty_Internal_Template::getVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smarty_Internal_Template的用法示例。


在下文中一共展示了Smarty_Internal_Template::getVariable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_datatable_column

/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @throws SmartyException
 *
 * @author Kovács Vince
 */
function smarty_function_datatable_column($params, Smarty_Internal_Template &$smarty)
{
    if (!class_exists('Datatable')) {
        throw new SmartyException('chumper/datatable not installed');
    }
    if (!isset($params['label']) && !isset($params['token'])) {
        throw new SmartyException('Missing label or token attribute for datatable_column tag');
    }
    $tables = $smarty->getVariable('datatables')->value;
    $table = end($tables);
    $table->addColumn(isset($params['label']) ? $params['label'] : Lang::get($params['token']));
    $options = array();
    if (isset($params['sortable'])) {
        $options['sortable'] = (bool) $params['sortable'];
    }
    if (isset($params['orderable'])) {
        $options['orderable'] = (bool) $params['orderable'];
    }
    if (isset($params['width'])) {
        $options['width'] = $params['width'];
    }
    if (isset($params['class'])) {
        $options['className'] = $params['class'];
    }
    if (isset($params['type']) && in_array($params['type'], array('html', 'string', 'numeric', 'date'))) {
        $options['cellType'] = $params['type'];
    }
    $tableOptions = $table->getOptions();
    $tableOptions['columns'][] = count($options) == 0 ? null : $options;
    $table->setOptions($tableOptions);
}
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:39,代码来源:function.datatable_column.php

示例2: compileVariable

 /**
  * compile variable
  *
  * @param string $variable
  *
  * @return string
  */
 public function compileVariable($variable)
 {
     if (strpos($variable, '(') == 0) {
         // not a variable variable
         $var = trim($variable, '\'');
         $this->tag_nocache = $this->tag_nocache | $this->template->getVariable($var, null, true, false)->nocache;
         $this->template->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
     }
     return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
 }
开发者ID:NikoMostWanted,项目名称:smarty,代码行数:17,代码来源:smarty_internal_templatecompilerbase.php

示例3: 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


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