mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 09:54:27 +02:00
Added support for inserting results of function processing a template.
This commit is contained in:
@@ -450,6 +450,9 @@ class Smarty
|
||||
list (,$literal_block) = each($this->_literal_blocks);
|
||||
return $literal_block;
|
||||
|
||||
case 'insert':
|
||||
return $this->_compile_insert_tag($tag_args);
|
||||
|
||||
default:
|
||||
if (isset($this->custom_tags[$tag_command])) {
|
||||
return $this->_compile_custom_tag($tag_command, $tag_args);
|
||||
@@ -474,6 +477,26 @@ class Smarty
|
||||
}
|
||||
|
||||
|
||||
function _compile_insert_tag($tag_args)
|
||||
{
|
||||
$attrs = $this->_parse_attrs($tag_args);
|
||||
$name = substr($attrs['name'], 1, -1);
|
||||
|
||||
if (empty($name)) {
|
||||
/* TODO syntax error: missing insert name */
|
||||
}
|
||||
|
||||
foreach ($attrs as $arg_name => $arg_value) {
|
||||
if ($arg_name == 'name') continue;
|
||||
if (is_bool($arg_value))
|
||||
$arg_value = $arg_value ? 'true' : 'false';
|
||||
$arg_list[] = "'$arg_name' => $arg_value";
|
||||
}
|
||||
|
||||
return "<?php print $name(array(".implode(',', (array)$arg_list).")); ?>";
|
||||
}
|
||||
|
||||
|
||||
function _compile_config_load_tag($tag_args)
|
||||
{
|
||||
$attrs = $this->_parse_attrs($tag_args);
|
||||
|
@@ -450,6 +450,9 @@ class Smarty
|
||||
list (,$literal_block) = each($this->_literal_blocks);
|
||||
return $literal_block;
|
||||
|
||||
case 'insert':
|
||||
return $this->_compile_insert_tag($tag_args);
|
||||
|
||||
default:
|
||||
if (isset($this->custom_tags[$tag_command])) {
|
||||
return $this->_compile_custom_tag($tag_command, $tag_args);
|
||||
@@ -474,6 +477,26 @@ class Smarty
|
||||
}
|
||||
|
||||
|
||||
function _compile_insert_tag($tag_args)
|
||||
{
|
||||
$attrs = $this->_parse_attrs($tag_args);
|
||||
$name = substr($attrs['name'], 1, -1);
|
||||
|
||||
if (empty($name)) {
|
||||
/* TODO syntax error: missing insert name */
|
||||
}
|
||||
|
||||
foreach ($attrs as $arg_name => $arg_value) {
|
||||
if ($arg_name == 'name') continue;
|
||||
if (is_bool($arg_value))
|
||||
$arg_value = $arg_value ? 'true' : 'false';
|
||||
$arg_list[] = "'$arg_name' => $arg_value";
|
||||
}
|
||||
|
||||
return "<?php print $name(array(".implode(',', (array)$arg_list).")); ?>";
|
||||
}
|
||||
|
||||
|
||||
function _compile_config_load_tag($tag_args)
|
||||
{
|
||||
$attrs = $this->_parse_attrs($tag_args);
|
||||
|
Reference in New Issue
Block a user