mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- fix to make calling of template functions unambiguously by madatory usage of the {call} tag
This commit is contained in:
9
README
9
README
@@ -269,8 +269,9 @@ Just as you can use PHP functions as modifiers directly, you can now access
|
||||
PHP functions directly, provided they are permitted by security settings:
|
||||
{time()}
|
||||
|
||||
There is a new {function}...{/function} block tag. This enables reuse of code
|
||||
sequences like a plugin function. It can call itself recursively.
|
||||
There is a new {function}...{/function} block tag to implement a template function.
|
||||
This enables reuse of code sequences like a plugin function. It can call itself recursively.
|
||||
Template function must be called with the new {call name=foo...} tag.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -280,7 +281,7 @@ Template file:
|
||||
{foreach $data as $entry}
|
||||
{if is_array($entry)}
|
||||
<li>{$entry@key}</li>
|
||||
{menu data=$entry level=$level+1}
|
||||
{call name=menu data=$entry level=$level+1}
|
||||
{else}
|
||||
<li>{$entry}</li>
|
||||
{/if}
|
||||
@@ -291,7 +292,7 @@ Template file:
|
||||
{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' =>
|
||||
['item3-3-1','item3-3-2']],'item4']}
|
||||
|
||||
{menu data=$menu}
|
||||
{call name=menu data=$menu}
|
||||
|
||||
|
||||
Generated output:
|
||||
|
@@ -3,6 +3,7 @@
|
||||
- work around of a substr_compare bug in older PHP5 versions
|
||||
- bugfix on template inheritance for tag names starting with "block"
|
||||
- bugfix on {function} tag with name attribute in doublequoted strings
|
||||
- fix to make calling of template functions unambiguously by madatory usage of the {call} tag
|
||||
|
||||
===== RC1 =====
|
||||
|
||||
|
@@ -110,14 +110,7 @@ class Smarty_Internal_TemplateCompilerBase {
|
||||
$this->has_code = true;
|
||||
$this->has_output = false;
|
||||
// compile the smarty tag (required compile classes to compile the tag are autoloaded)
|
||||
if (($_output = $this->callTagCompiler($tag, $args)) === false) {
|
||||
if (isset($this->smarty->template_functions[$tag])) {
|
||||
// template defined by {template} tag
|
||||
$args['name'] = "'" . $tag . "'";
|
||||
$_output = $this->callTagCompiler('call', $args);
|
||||
}
|
||||
}
|
||||
if ($_output !== false) {
|
||||
if (($_output = $this->callTagCompiler($tag, $args)) !== false) {
|
||||
if ($_output !== true) {
|
||||
// did we get compiled code
|
||||
if ($this->has_code) {
|
||||
|
Reference in New Issue
Block a user