本文整理汇总了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);
}
示例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';
}
示例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 '';
}