當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。