diff options
author | Mario <mario@mariovavti.com> | 2022-02-11 09:27:57 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-02-11 09:27:57 +0000 |
commit | 615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed (patch) | |
tree | 9a2eb293fde70e7222957557dbfe6c3ab1df86f2 /vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-shortform-assign.md | |
parent | 7d75d0cfbdca9914814dd5c8390a45eaf377b48d (diff) | |
download | volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.tar.gz volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.tar.bz2 volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.zip |
composer update smarty to version 4.1 - new files
Diffstat (limited to 'vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-shortform-assign.md')
-rw-r--r-- | vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-shortform-assign.md | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-shortform-assign.md b/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-shortform-assign.md new file mode 100644 index 000000000..d6a9e9798 --- /dev/null +++ b/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-shortform-assign.md @@ -0,0 +1,84 @@ +{\$var=\...} {#language.function.shortform.assign} +============ + +This is a short-hand version of the {assign} function. You can assign +values directly to the template, or assign values to array elements too. + +> **Note** +> +> Assignment of variables in-template is essentially placing application +> logic into the presentation that may be better handled in PHP. Use at +> your own discretion. + +The following attributes can be added to the tag: + +**Attributes:** + + Attribute Name Shorthand Type Required Default Description + ---------------- ----------- -------- ---------- --------- ----------------------------------------------------------------------- + scope n/a string No *n/a* The scope of the assigned variable: \'parent\',\'root\' or \'global\' + +**Option Flags:** + + Name Description + --------- ----------------------------------------------------- + nocache Assigns the variable with the \'nocache\' attribute + + + {$name='Bob'} + + The value of $name is {$name}. + + + +The above example will output: + + + The value of $name is Bob. + + + + + {$running_total=$running_total+$some_array[row].some_value} + + + + + {$user.name="Bob"} + + + + + {$user.name.first="Bob"} + + + + + {$users[]="Bob"} + + + +Variables assigned in the included template will be seen in the +including template. + + + {include file="sub_template.tpl"} + ... + {* display variable assigned in sub_template *} + {$foo}<br> + ... + + + +The template above includes the example `sub_template.tpl` below + + + ... + {* foo will be known also in the including template *} + {$foo="something" scope=parent} + {* bar is assigned only local in the including template *} + {$bar="value"} + ... + +See also [`{assign}`](#language.function.assign) and +[`{append}`](#language.function.append) |