
Comparing changes: https://github.com/smarty-php/smarty/compare/v4.3.1...v4.4.1 It is noticeable that Smarty 4.3.1 does not officially support PHP 8.3. Is only supported with 4.4.0. Remark: During tests with Smarty 4.5.1, it was noticed that the following warning occurs: Deprecated: Using the unregistered function "function_exists" in a template is deprecated and will be removed in a future version. Use Smarty::registerPlugin to explicitly register a custom modifier. As of Smarty 5.X.X, templates must be revised again. The Smarty release 5.0.2 is already officially available. However, integration into FlatPress is not entirely trivial.
37 lines
1.1 KiB
Markdown
37 lines
1.1 KiB
Markdown
# Variables
|
|
|
|
Smarty has several types of variables. The type of the
|
|
variable depends on what symbol it is prefixed or enclosed within.
|
|
|
|
- [Variables assigned from PHP](language-assigned-variables.md)
|
|
- [Variables loaded from config files](language-config-variables.md)
|
|
- [{$smarty} reserved variable](language-variables-smarty.md)
|
|
|
|
Variables in Smarty can be either displayed directly or used as
|
|
arguments for [functions](../language-basic-syntax/language-syntax-functions.md),
|
|
[attributes](../language-basic-syntax/language-syntax-attributes.md) and
|
|
[modifiers](../language-modifiers/index.md), inside conditional expressions, etc.
|
|
To print a variable, simply enclose it in the
|
|
[delimiters](../../programmers/api-variables/variable-left-delimiter.md) so that it is the only thing
|
|
contained between them.
|
|
|
|
```smarty
|
|
{$Name}
|
|
|
|
{$product.part_no} <b>{$product.description}</b>
|
|
|
|
{$Contacts[row].Phone}
|
|
|
|
<body bgcolor="{#bgcolor#}">
|
|
```
|
|
|
|
## Scopes
|
|
You can assign variables to specific [variable scopes](language-variable-scopes.md).
|
|
|
|
|
|
> **Note**
|
|
>
|
|
> An easy way to examine assigned Smarty variables is with the
|
|
> [debugging console](../chapter-debugging-console.md).
|
|
|