diff options
Diffstat (limited to 'vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-call.md')
-rw-r--r-- | vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-call.md | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-call.md b/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-call.md index 786f0c10c..c07fb49b9 100644 --- a/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-call.md +++ b/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-call.md @@ -1,39 +1,41 @@ -{call} {#language.function.call} -====== +# {call} `{call}` is used to call a template function defined by the -[`{function}`](#language.function.function) tag just like a plugin +[`{function}`](./language-function-function.md) tag just like a plugin function. > **Note** > > Template functions are defined global. Since the Smarty compiler is a -> single-pass compiler, The [`{call}`](#language.function.call) tag must +> single-pass compiler, The `{call}` tag must > be used to call a template function defined externally from the given > template. Otherwise you can directly use the function as > `{funcname ...}` in the template. - The `{call}` tag must have the `name` attribute which contains the - the name of the template function. + name of the template function. - Values for variables can be passed to the template function as - [attributes](#language.syntax.attributes). + [attributes](../language-basic-syntax/language-syntax-attributes.md). -**Attributes:** +## Attributes - Attribute Name Type Required Default Description - ---------------- -------------- ---------- --------- ------------------------------------------------------------------------------------------ - name string Yes *n/a* The name of the template function - assign string No *n/a* The name of the variable that the output of called template function will be assigned to - \[var \...\] \[var type\] No *n/a* variable to pass local to template function +| Attribute Name | Required | Description | +|----------------|----------|------------------------------------------------------------------------------------------| +| name | Yes | The name of the template function | +| assign | No | The name of the variable that the output of called template function will be assigned to | +| [var ...] | No | variable to pass local to template function | -**Option Flags:** +## Option Flags - Name Description - --------- -------------------------------------------- - nocache Call the template function in nocache mode +| Name | Description | +|---------|--------------------------------------------| +| nocache | Call the template function in nocache mode | +## Examples + +```smarty {* define the function *} {function name=menu level=0} <ul class="level{$level}"> @@ -55,12 +57,12 @@ function. {* run the array through the function *} {call name=menu data=$menu} {call menu data=$menu} {* short-hand *} - - +``` + Will generate the following output - +``` * item1 * item2 * item3 @@ -70,7 +72,6 @@ Will generate the following output + item3-3-1 + item3-3-2 * item4 +``` - - -See also [`{function}`](#language.function.function) +See also [`{function}`](./language-function-function.md). |