mirror of
https://github.com/smarty-php/smarty.git
synced 2025-07-30 16:07:13 +02:00
fixes to docs
This commit is contained in:
@ -14,7 +14,7 @@ shorthand way with Smarty, using the
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> "Undefined variable" errors will show an E\_NOTICE if not disabled in
|
> "Undefined variable" errors will show an E\_NOTICE if not disabled in
|
||||||
> PHP\'s [`error_reporting()`](&url.php-manual;error_reporting) level or
|
> PHP\'s [`error_reporting()`](https://www.php.net/error_reporting) level or
|
||||||
> Smarty\'s [`$error_reporting`](#variable.error.reporting) property and
|
> Smarty\'s [`$error_reporting`](#variable.error.reporting) property and
|
||||||
> a variable had not been assigned to Smarty.
|
> a variable had not been assigned to Smarty.
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ Dates {#tips.dates}
|
|||||||
=====
|
=====
|
||||||
|
|
||||||
As a rule of thumb, always pass dates to Smarty as
|
As a rule of thumb, always pass dates to Smarty as
|
||||||
[timestamps](&url.php-manual;time). This allows template designers to
|
[timestamps](https://www.php.net/time). This allows template designers to
|
||||||
use the [`date_format`](#language.modifier.date.format) modifier for
|
use the [`date_format`](#language.modifier.date.format) modifier for
|
||||||
full control over date formatting, and also makes it easy to compare
|
full control over date formatting, and also makes it easy to compare
|
||||||
dates if necessary.
|
dates if necessary.
|
||||||
|
@ -110,7 +110,7 @@ the corresponding error is in the template.
|
|||||||
|
|
||||||
|
|
||||||
- This means that your application registered a custom error handler
|
- This means that your application registered a custom error handler
|
||||||
(using [set\_error\_handler()](&url.php-manual;set_error_handler))
|
(using [set\_error\_handler()](https://www.php.net/set_error_handler))
|
||||||
which is not respecting the given `$errno` as it should. If, for
|
which is not respecting the given `$errno` as it should. If, for
|
||||||
whatever reason, this is the desired behaviour of your custom error
|
whatever reason, this is the desired behaviour of your custom error
|
||||||
handler, please call
|
handler, please call
|
||||||
|
@ -4,7 +4,7 @@ Embedding Vars in Double Quotes {#language.syntax.quotes}
|
|||||||
- Smarty will recognize [assigned](#api.assign)
|
- Smarty will recognize [assigned](#api.assign)
|
||||||
[variables](#language.syntax.variables) embedded in \"double
|
[variables](#language.syntax.variables) embedded in \"double
|
||||||
quotes\" so long as the variable name contains only numbers, letters
|
quotes\" so long as the variable name contains only numbers, letters
|
||||||
and under\_scores. See [naming](&url.php-manual;language.variables)
|
and under\_scores. See [naming](https://www.php.net/language.variables)
|
||||||
for more detail.
|
for more detail.
|
||||||
|
|
||||||
- With any other characters, for example a period(.) or
|
- With any other characters, for example a period(.) or
|
||||||
|
@ -3,7 +3,7 @@ Variables {#language.syntax.variables}
|
|||||||
|
|
||||||
Template variables start with the \$dollar sign. They can contain
|
Template variables start with the \$dollar sign. They can contain
|
||||||
numbers, letters and underscores, much like a [PHP
|
numbers, letters and underscores, much like a [PHP
|
||||||
variable](&url.php-manual;language.variables). You can reference arrays
|
variable](https://www.php.net/language.variables). You can reference arrays
|
||||||
by index numerically or non-numerically. Also reference object
|
by index numerically or non-numerically. Also reference object
|
||||||
properties and methods.
|
properties and methods.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ Built-in Functions {#language.builtin.functions}
|
|||||||
- [{block}](./language-builtin-functions/language-function-block.md)
|
- [{block}](./language-builtin-functions/language-function-block.md)
|
||||||
- [{call}](./language-builtin-functions/language-function-call.md)
|
- [{call}](./language-builtin-functions/language-function-call.md)
|
||||||
- [{capture}](./language-builtin-functions/language-function-capture.md)
|
- [{capture}](./language-builtin-functions/language-function-capture.md)
|
||||||
- [{config_load}](./language-builtin-functions/language-function-config.load)
|
- [{config_load}](./language-builtin-functions/language-function-config-load.md)
|
||||||
- [{debug}](./language-builtin-functions/language-function-debug.md)
|
- [{debug}](./language-builtin-functions/language-function-debug.md)
|
||||||
- [{extends}](./language-builtin-functions/language-function-extends.md)
|
- [{extends}](./language-builtin-functions/language-function-extends.md)
|
||||||
- [{for}](./language-builtin-functions/language-function-for.md)
|
- [{for}](./language-builtin-functions/language-function-for.md)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
====================
|
====================
|
||||||
|
|
||||||
`{if}` statements in Smarty have much the same flexibility as PHP
|
`{if}` statements in Smarty have much the same flexibility as PHP
|
||||||
[if](&url.php-manual;if) statements, with a few added features for the
|
[if](https://www.php.net/if) statements, with a few added features for the
|
||||||
template engine. Every `{if}` must be paired with a matching `{/if}`.
|
template engine. Every `{if}` must be paired with a matching `{/if}`.
|
||||||
`{else}` and `{elseif}` are also permitted. All PHP conditionals and
|
`{else}` and `{elseif}` are also permitted. All PHP conditionals and
|
||||||
functions are recognized, such as *\|\|*, *or*, *&&*, *and*,
|
functions are recognized, such as *\|\|*, *or*, *&&*, *and*,
|
||||||
|
@ -37,7 +37,7 @@ be paired with a closing `{/section}` tag.
|
|||||||
|
|
||||||
- The `name` of the `{section}` can be anything you like, made up of
|
- The `name` of the `{section}` can be anything you like, made up of
|
||||||
letters, numbers and underscores, like [PHP
|
letters, numbers and underscores, like [PHP
|
||||||
variables](&url.php-manual;language.variables).
|
variables](https://www.php.net/language.variables).
|
||||||
|
|
||||||
- {section}\'s can be nested, and the nested `{section}` names must be
|
- {section}\'s can be nested, and the nested `{section}` names must be
|
||||||
unique from each other.
|
unique from each other.
|
||||||
@ -124,7 +124,7 @@ The above example will output:
|
|||||||
|
|
||||||
|
|
||||||
The `name` of the `{section}` can be anything you like, see [PHP
|
The `name` of the `{section}` can be anything you like, see [PHP
|
||||||
variables](&url.php-manual;language.variables). It is used to reference
|
variables](https://www.php.net/language.variables). It is used to reference
|
||||||
the data within the `{section}`.
|
the data within the `{section}`.
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
`{while}` loops in Smarty have much the same flexibility as PHP
|
`{while}` loops in Smarty have much the same flexibility as PHP
|
||||||
[while](&url.php-manual;while) statements, with a few added features for
|
[while](https://www.php.net/while) statements, with a few added features for
|
||||||
the template engine. Every `{while}` must be paired with a matching
|
the template engine. Every `{while}` must be paired with a matching
|
||||||
`{/while}`. All PHP conditionals and functions are recognized, such as
|
`{/while}`. All PHP conditionals and functions are recognized, such as
|
||||||
*\|\|*, *or*, *&&*, *and*, *is\_array()*, etc.
|
*\|\|*, *or*, *&&*, *and*, *is\_array()*, etc.
|
||||||
|
@ -74,7 +74,7 @@ Output of the above example would be:
|
|||||||
|
|
||||||
|
|
||||||
The above arrays would be output with the following template (note the
|
The above arrays would be output with the following template (note the
|
||||||
use of the php [`count()`](&url.php-manual;function.count) function as a
|
use of the php [`count()`](https://www.php.net/function.count) function as a
|
||||||
modifier to set the select size).
|
modifier to set the select size).
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ name/value-pairs inside the `<select>` tags of day, month and year.
|
|||||||
Attribute Name Type Required Default Description
|
Attribute Name Type Required Default Description
|
||||||
---------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- ---------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
---------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- ---------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
prefix string No Date\_ What to prefix the var name with
|
prefix string No Date\_ What to prefix the var name with
|
||||||
time [timestamp](&url.php-manual;function.time), [DateTime](&url.php-manual;class.DateTime), mysql timestamp or any string parsable by [`strtotime()`](&url.php-manual;strtotime), arrays as produced by this function if field\_array is set. No current [timestamp](&url.php-manual;function.time) What date/time to pre-select. If an array is given, the attributes field\_array and prefix are used to identify the array elements to extract year, month and day from. Omitting this parameter or supplying a falsy value will select the current date. To prevent date selection, pass in NULL
|
time [timestamp](https://www.php.net/function.time), [DateTime](https://www.php.net/class.DateTime), mysql timestamp or any string parsable by [`strtotime()`](https://www.php.net/strtotime), arrays as produced by this function if field\_array is set. No current [timestamp](https://www.php.net/function.time) What date/time to pre-select. If an array is given, the attributes field\_array and prefix are used to identify the array elements to extract year, month and day from. Omitting this parameter or supplying a falsy value will select the current date. To prevent date selection, pass in NULL
|
||||||
start\_year string No current year The first year in the dropdown, either year number, or relative to current year (+/- N)
|
start\_year string No current year The first year in the dropdown, either year number, or relative to current year (+/- N)
|
||||||
end\_year string No same as start\_year The last year in the dropdown, either year number, or relative to current year (+/- N)
|
end\_year string No same as start\_year The last year in the dropdown, either year number, or relative to current year (+/- N)
|
||||||
display\_days boolean No TRUE Whether to display days or not
|
display\_days boolean No TRUE Whether to display days or not
|
||||||
|
@ -7,12 +7,12 @@ minute, second and meridian.
|
|||||||
|
|
||||||
The `time` attribute can have different formats. It can be a unique
|
The `time` attribute can have different formats. It can be a unique
|
||||||
timestamp, a string of the format `YYYYMMDDHHMMSS` or a string that is
|
timestamp, a string of the format `YYYYMMDDHHMMSS` or a string that is
|
||||||
parseable by PHP\'s [`strtotime()`](&url.php-manual;strtotime).
|
parseable by PHP\'s [`strtotime()`](https://www.php.net/strtotime).
|
||||||
|
|
||||||
Attribute Name Type Required Default Description
|
Attribute Name Type Required Default Description
|
||||||
----------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- ---------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
----------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- ---------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
prefix string No Time\_ What to prefix the var name with
|
prefix string No Time\_ What to prefix the var name with
|
||||||
time [timestamp](&url.php-manual;function.time), [DateTime](&url.php-manual;class.DateTime), mysql timestamp or any string parsable by [`strtotime()`](&url.php-manual;strtotime), arrays as produced by this function if field\_array is set. No current [timestamp](&url.php-manual;function.time) What date/time to pre-select. If an array is given, the attributes field\_array and prefix are used to identify the array elements to extract hour, minute, second and meridian from.
|
time [timestamp](https://www.php.net/function.time), [DateTime](https://www.php.net/class.DateTime), mysql timestamp or any string parsable by [`strtotime()`](https://www.php.net/strtotime), arrays as produced by this function if field\_array is set. No current [timestamp](https://www.php.net/function.time) What date/time to pre-select. If an array is given, the attributes field\_array and prefix are used to identify the array elements to extract hour, minute, second and meridian from.
|
||||||
display\_hours boolean No TRUE Whether or not to display hours
|
display\_hours boolean No TRUE Whether or not to display hours
|
||||||
display\_minutes boolean No TRUE Whether or not to display minutes
|
display\_minutes boolean No TRUE Whether or not to display minutes
|
||||||
display\_seconds boolean No TRUE Whether or not to display seconds
|
display\_seconds boolean No TRUE Whether or not to display seconds
|
||||||
|
@ -13,7 +13,7 @@ template.
|
|||||||
- +, -, /, \*, abs, ceil, cos, exp, floor, log, log10, max, min, pi,
|
- +, -, /, \*, abs, ceil, cos, exp, floor, log, log10, max, min, pi,
|
||||||
pow, rand, round, sin, sqrt, srans and tan are all valid operators.
|
pow, rand, round, sin, sqrt, srans and tan are all valid operators.
|
||||||
Check the PHP documentation for further information on these
|
Check the PHP documentation for further information on these
|
||||||
[math](&url.php-manual;eval) functions.
|
[math](https://www.php.net/eval) functions.
|
||||||
|
|
||||||
- If you supply the `assign` attribute, the output of the `{math}`
|
- If you supply the `assign` attribute, the output of the `{math}`
|
||||||
function will be assigned to this template variable instead of being
|
function will be assigned to this template variable instead of being
|
||||||
@ -22,7 +22,7 @@ template.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> `{math}` is an expensive function in performance due to its use of the
|
> `{math}` is an expensive function in performance due to its use of the
|
||||||
> php [`eval()`](&url.php-manual;eval) function. Doing the math in PHP
|
> php [`eval()`](https://www.php.net/eval) function. Doing the math in PHP
|
||||||
> is much more efficient, so whenever possible do the math calculations
|
> is much more efficient, so whenever possible do the math calculations
|
||||||
> in the script and [`assign()`](#api.assign) the results to the
|
> in the script and [`assign()`](#api.assign) the results to the
|
||||||
> template. Definitely avoid repetitive `{math}` function calls, eg
|
> template. Definitely avoid repetitive `{math}` function calls, eg
|
||||||
|
@ -2,7 +2,7 @@ capitalize {#language.modifier.capitalize}
|
|||||||
==========
|
==========
|
||||||
|
|
||||||
This is used to capitalize the first letter of all words in a variable.
|
This is used to capitalize the first letter of all words in a variable.
|
||||||
This is similar to the PHP [`ucwords()`](&url.php-manual;ucwords)
|
This is similar to the PHP [`ucwords()`](https://www.php.net/ucwords)
|
||||||
function.
|
function.
|
||||||
|
|
||||||
Parameter Position Type Required Default Description
|
Parameter Position Type Required Default Description
|
||||||
|
@ -2,11 +2,11 @@ date\_format {#language.modifier.date.format}
|
|||||||
============
|
============
|
||||||
|
|
||||||
This formats a date and time into the given
|
This formats a date and time into the given
|
||||||
[`strftime()`](&url.php-manual;strftime) format. Dates can be passed to
|
[`strftime()`](https://www.php.net/strftime) format. Dates can be passed to
|
||||||
Smarty as unix [timestamps](&url.php-manual;function.time), [DateTime
|
Smarty as unix [timestamps](https://www.php.net/function.time), [DateTime
|
||||||
objects](&url.php-manual;class.DateTime), mysql timestamps or any string
|
objects](https://www.php.net/class.DateTime), mysql timestamps or any string
|
||||||
made up of month day year, parsable by php\'s
|
made up of month day year, parsable by php\'s
|
||||||
[`strtotime()`](&url.php-manual;strtotime). Designers can then use
|
[`strtotime()`](https://www.php.net/strtotime). Designers can then use
|
||||||
`date_format` to have complete control of the formatting of the date. If
|
`date_format` to have complete control of the formatting of the date. If
|
||||||
the date passed to `date_format` is empty and a second parameter is
|
the date passed to `date_format` is empty and a second parameter is
|
||||||
passed, that will be used as the date to format.
|
passed, that will be used as the date to format.
|
||||||
@ -34,9 +34,9 @@ passed, that will be used as the date to format.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> `date_format` is essentially a wrapper to PHP\'s
|
> `date_format` is essentially a wrapper to PHP\'s
|
||||||
> [`strftime()`](&url.php-manual;strftime) function. You may have more
|
> [`strftime()`](https://www.php.net/strftime) function. You may have more
|
||||||
> or less conversion specifiers available depending on your system\'s
|
> or less conversion specifiers available depending on your system\'s
|
||||||
> [`strftime()`](&url.php-manual;strftime) function where PHP was
|
> [`strftime()`](https://www.php.net/strftime) function where PHP was
|
||||||
> compiled. Check your system\'s manpage for a full list of valid
|
> compiled. Check your system\'s manpage for a full list of valid
|
||||||
> specifiers. However, a few of the specifiers are emulated on Windows.
|
> specifiers. However, a few of the specifiers are emulated on Windows.
|
||||||
> These are: %D, %e, %h, %l, %n, %r, %R, %t, %T.
|
> These are: %D, %e, %h, %l, %n, %r, %R, %t, %T.
|
||||||
@ -170,6 +170,6 @@ This above will output:
|
|||||||
- \%% - a literal \`%\' character
|
- \%% - a literal \`%\' character
|
||||||
|
|
||||||
See also [`$smarty.now`](#language.variables.smarty.now),
|
See also [`$smarty.now`](#language.variables.smarty.now),
|
||||||
[`strftime()`](&url.php-manual;strftime),
|
[`strftime()`](https://www.php.net/strftime),
|
||||||
[`{html_select_date}`](#language.function.html.select.date) and the
|
[`{html_select_date}`](#language.function.html.select.date) and the
|
||||||
[date tips](#tips.dates) page.
|
[date tips](#tips.dates) page.
|
||||||
|
@ -8,7 +8,7 @@ its `html`.
|
|||||||
Parameter Position Type Required Possible Values Default Description
|
Parameter Position Type Required Possible Values Default Description
|
||||||
-------------------- --------- ---------- ------------------------------------------------------------------------------------------------------------ --------- -------------------------------------------------------------------------------------
|
-------------------- --------- ---------- ------------------------------------------------------------------------------------------------------------ --------- -------------------------------------------------------------------------------------
|
||||||
1 string No `html`, `htmlall`, `url`, `urlpathinfo`, `quotes`, `hex`, `hexentity`, `javascript`, `mail` `html` This is the escape format to use.
|
1 string No `html`, `htmlall`, `url`, `urlpathinfo`, `quotes`, `hex`, `hexentity`, `javascript`, `mail` `html` This is the escape format to use.
|
||||||
2 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`htmlentities()`](&url.php-manual;htmlentities) `UTF-8` The character set encoding passed to htmlentities() et. al.
|
2 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`htmlentities()`](https://www.php.net/htmlentities) `UTF-8` The character set encoding passed to htmlentities() et. al.
|
||||||
3 boolean No FALSE TRUE Double encode entites from & to &amp; (applys to `html` and `htmlall` only)
|
3 boolean No FALSE TRUE Double encode entites from & to &amp; (applys to `html` and `htmlall` only)
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ modifier](#language.modifier.to_charset).
|
|||||||
|
|
||||||
Parameter Position Type Required Possible Values Default Description
|
Parameter Position Type Required Possible Values Default Description
|
||||||
-------------------- -------- ---------- -------------------------------------------------------------------------------------------------------------------------- -------------- ---------------------------------------------------------------
|
-------------------- -------- ---------- -------------------------------------------------------------------------------------------------------------------------- -------------- ---------------------------------------------------------------
|
||||||
1 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`mb_convert_encoding()`](&url.php-manual;mb_convert_encoding) `ISO-8859-1` The charset encoding the value is supposed to be decoded from
|
1 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`mb_convert_encoding()`](https://www.php.net/mb_convert_encoding) `ISO-8859-1` The charset encoding the value is supposed to be decoded from
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
|
@ -2,7 +2,7 @@ lower {#language.modifier.lower}
|
|||||||
=====
|
=====
|
||||||
|
|
||||||
This is used to lowercase a variable. This is equivalent to the PHP
|
This is used to lowercase a variable. This is equivalent to the PHP
|
||||||
[`strtolower()`](&url.php-manual;strtolower) function.
|
[`strtolower()`](https://www.php.net/strtolower) function.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -3,7 +3,7 @@ nl2br {#language.modifier.nl2br}
|
|||||||
|
|
||||||
All `"\n"` line breaks will be converted to html `<br />` tags in the
|
All `"\n"` line breaks will be converted to html `<br />` tags in the
|
||||||
given variable. This is equivalent to the PHP\'s
|
given variable. This is equivalent to the PHP\'s
|
||||||
[`nl2br()`](&url.php-manual;nl2br) function.
|
[`nl2br()`](https://www.php.net/nl2br) function.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -2,7 +2,7 @@ regex\_replace {#language.modifier.regex.replace}
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
A regular expression search and replace on a variable. Use the
|
A regular expression search and replace on a variable. Use the
|
||||||
[`preg_replace()`](&url.php-manual;preg_replace) syntax from the PHP
|
[`preg_replace()`](https://www.php.net/preg_replace) syntax from the PHP
|
||||||
manual.
|
manual.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
|
@ -2,7 +2,7 @@ replace {#language.modifier.replace}
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
A simple search and replace on a variable. This is equivalent to the
|
A simple search and replace on a variable. This is equivalent to the
|
||||||
PHP\'s [`str_replace()`](&url.php-manual;str_replace) function.
|
PHP\'s [`str_replace()`](https://www.php.net/str_replace) function.
|
||||||
|
|
||||||
Parameter Position Type Required Default Description
|
Parameter Position Type Required Default Description
|
||||||
-------------------- -------- ---------- --------- ---------------------------------------------
|
-------------------- -------- ---------- --------- ---------------------------------------------
|
||||||
|
@ -2,7 +2,7 @@ string\_format {#language.modifier.string.format}
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
This is a way to format strings, such as decimal numbers and such. Use
|
This is a way to format strings, such as decimal numbers and such. Use
|
||||||
the syntax for [`sprintf()`](&url.php-manual;sprintf) for the
|
the syntax for [`sprintf()`](https://www.php.net/sprintf) for the
|
||||||
formatting.
|
formatting.
|
||||||
|
|
||||||
Parameter Position Type Required Default Description
|
Parameter Position Type Required Default Description
|
||||||
|
@ -7,7 +7,7 @@ modifier](#language.modifier.from_charset).
|
|||||||
|
|
||||||
Parameter Position Type Required Possible Values Default Description
|
Parameter Position Type Required Possible Values Default Description
|
||||||
-------------------- -------- ---------- -------------------------------------------------------------------------------------------------------------------------- -------------- -------------------------------------------------------------
|
-------------------- -------- ---------- -------------------------------------------------------------------------------------------------------------------------- -------------- -------------------------------------------------------------
|
||||||
1 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`mb_convert_encoding()`](&url.php-manual;mb_convert_encoding) `ISO-8859-1` The charset encoding the value is supposed to be encoded to
|
1 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`mb_convert_encoding()`](https://www.php.net/mb_convert_encoding) `ISO-8859-1` The charset encoding the value is supposed to be encoded to
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
|
@ -8,7 +8,7 @@ given types.
|
|||||||
Parameter Position Type Required Possible Values Default Description
|
Parameter Position Type Required Possible Values Default Description
|
||||||
-------------------- -------- ---------- ------------------------------------------------------------------------------------------------------------ --------- ------------------------------------------------------------------------------------------------------------------------------
|
-------------------- -------- ---------- ------------------------------------------------------------------------------------------------------------ --------- ------------------------------------------------------------------------------------------------------------------------------
|
||||||
1 string No `html`, `htmlall`, `entity`, `html` This is the escape format to use.
|
1 string No `html`, `htmlall`, `entity`, `html` This is the escape format to use.
|
||||||
2 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`htmlentities()`](&url.php-manual;htmlentities) `UTF-8` The character set encoding passed to html\_entity\_decode() or htmlspecialchars\_decode() or mb\_convert\_encoding() et. al.
|
2 string No `ISO-8859-1`, `UTF-8`, and any character set supported by [`htmlentities()`](https://www.php.net/htmlentities) `UTF-8` The character set encoding passed to html\_entity\_decode() or htmlspecialchars\_decode() or mb\_convert\_encoding() et. al.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -2,7 +2,7 @@ upper {#language.modifier.upper}
|
|||||||
=====
|
=====
|
||||||
|
|
||||||
This is used to uppercase a variable. This is equivalent to the PHP
|
This is used to uppercase a variable. This is equivalent to the PHP
|
||||||
[`strtoupper()`](&url.php-manual;strtoupper) function.
|
[`strtoupper()`](https://www.php.net/strtoupper) function.
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -7,7 +7,7 @@ the next line, the default is a carriage return `"\n"`. By default,
|
|||||||
`wordwrap` will attempt to wrap at a word boundary. If you want to cut
|
`wordwrap` will attempt to wrap at a word boundary. If you want to cut
|
||||||
off at the exact character length, pass the optional third parameter as
|
off at the exact character length, pass the optional third parameter as
|
||||||
TRUE. This is equivalent to the PHP
|
TRUE. This is equivalent to the PHP
|
||||||
[`wordwrap()`](&url.php-manual;wordwrap) function.
|
[`wordwrap()`](https://www.php.net/wordwrap) function.
|
||||||
|
|
||||||
Parameter Position Type Required Default Description
|
Parameter Position Type Required Default Description
|
||||||
-------------------- --------- ---------- --------- ------------------------------------------------------------------------------------------------------
|
-------------------- --------- ---------- --------- ------------------------------------------------------------------------------------------------------
|
||||||
|
@ -7,7 +7,7 @@ environment and request variables. The full list of them follows.
|
|||||||
Request variables {#language.variables.smarty.request}
|
Request variables {#language.variables.smarty.request}
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
The [request variables](&url.php-manual;reserved.variables) such as
|
The [request variables](https://www.php.net/reserved.variables) such as
|
||||||
`$_GET`, `$_POST`, `$_COOKIE`, `$_SERVER`, `$_ENV` and `$_SESSION` can
|
`$_GET`, `$_POST`, `$_COOKIE`, `$_SERVER`, `$_ENV` and `$_SESSION` can
|
||||||
be accessed as demonstrated in the examples below:
|
be accessed as demonstrated in the examples below:
|
||||||
|
|
||||||
@ -54,11 +54,11 @@ be accessed as demonstrated in the examples below:
|
|||||||
{\$smarty.now} {#language.variables.smarty.now}
|
{\$smarty.now} {#language.variables.smarty.now}
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
The current [timestamp](&url.php-manual;function.time) can be accessed
|
The current [timestamp](https://www.php.net/function.time) can be accessed
|
||||||
with `{$smarty.now}`. The value reflects the number of seconds passed
|
with `{$smarty.now}`. The value reflects the number of seconds passed
|
||||||
since the so-called Epoch on January 1, 1970, and can be passed directly
|
since the so-called Epoch on January 1, 1970, and can be passed directly
|
||||||
to the [`date_format`](#language.modifier.date.format) modifier for
|
to the [`date_format`](#language.modifier.date.format) modifier for
|
||||||
display. Note that [`time()`](&url.php-manual;function.time) is called
|
display. Note that [`time()`](https://www.php.net/function.time) is called
|
||||||
on each invocation; eg a script that takes three seconds to execute with
|
on each invocation; eg a script that takes three seconds to execute with
|
||||||
a call to `$smarty.now` at start and end will show the three second
|
a call to `$smarty.now` at start and end will show the three second
|
||||||
difference.
|
difference.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Objects {#advanced.features.objects}
|
Objects {#advanced.features.objects}
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Smarty allows access to PHP [objects](&url.php-manual;object) through
|
Smarty allows access to PHP [objects](https://www.php.net/object) through
|
||||||
the templates.
|
the templates.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
|
@ -69,7 +69,7 @@ The `email_body.tpl` template
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
The php script using the PHP [`mail()`](&url.php-manual;function.mail)
|
The php script using the PHP [`mail()`](https://www.php.net/function.mail)
|
||||||
function
|
function
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ string
|
|||||||
muteExpectedErrors
|
muteExpectedErrors
|
||||||
|
|
||||||
muteExpectedErrors() registers a custom error handler using
|
muteExpectedErrors() registers a custom error handler using
|
||||||
[set\_error\_handler()](&url.php-manual;set_error_handler). The error
|
[set\_error\_handler()](https://www.php.net/set_error_handler). The error
|
||||||
handler merely inspects `$errno` and `$errfile` to determine if the
|
handler merely inspects `$errno` and `$errfile` to determine if the
|
||||||
given error was produced deliberately and must be ignored, or should be
|
given error was produced deliberately and must be ignored, or should be
|
||||||
passed on to the next error handler.
|
passed on to the next error handler.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
==================
|
==================
|
||||||
|
|
||||||
When this value is set to a non-null-value it\'s value is used as php\'s
|
When this value is set to a non-null-value it\'s value is used as php\'s
|
||||||
[`error_reporting`](&url.php-manual;error_reporting) level inside of
|
[`error_reporting`](https://www.php.net/error_reporting) level inside of
|
||||||
[`display()`](#api.display) and [`fetch()`](#api.fetch).
|
[`display()`](#api.display) and [`fetch()`](#api.fetch).
|
||||||
|
|
||||||
Smarty 3.1.2 introduced the
|
Smarty 3.1.2 introduced the
|
||||||
|
@ -18,7 +18,7 @@ found.
|
|||||||
>
|
>
|
||||||
> If the directories known to `$template_dir` are relative to
|
> If the directories known to `$template_dir` are relative to
|
||||||
> directories known to the
|
> directories known to the
|
||||||
> [include\_path](&url.php-manual;ini.core.php#ini.include-path) you
|
> [include\_path](https://www.php.net/ini.core.php#ini.include-path) you
|
||||||
> need to activate the [`$use_include_path`](#variable.use.include.path)
|
> need to activate the [`$use_include_path`](#variable.use.include.path)
|
||||||
> option.
|
> option.
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
====================
|
====================
|
||||||
|
|
||||||
This tells smarty to respect the
|
This tells smarty to respect the
|
||||||
[include\_path](&url.php-manual;ini.core.php#ini.include-path) within
|
[include\_path](https://www.php.net/ini.core.php#ini.include-path) within
|
||||||
the [`File Template Resource`](#resources.file) handler and the plugin
|
the [`File Template Resource`](#resources.file) handler and the plugin
|
||||||
loader to resolve the directories known to
|
loader to resolve the directories known to
|
||||||
[`$template_dir`](#variable.template.dir). The flag also makes the
|
[`$template_dir`](#variable.template.dir). The flag also makes the
|
||||||
@ -23,14 +23,14 @@ If use\_include\_path is enabled, file discovery for
|
|||||||
\$plugins\_dir) do
|
\$plugins\_dir) do
|
||||||
|
|
||||||
- Test if requested file is in `$directory` relative to the [current
|
- Test if requested file is in `$directory` relative to the [current
|
||||||
working directory](&url.php-manual;function.getcwd.php). If file
|
working directory](https://www.php.net/function.getcwd.php). If file
|
||||||
found, return it.
|
found, return it.
|
||||||
|
|
||||||
- For each `$path` in include\_path do
|
- For each `$path` in include\_path do
|
||||||
|
|
||||||
- Test if requested file is in `$directory` relative to the `$path`
|
- Test if requested file is in `$directory` relative to the `$path`
|
||||||
(possibly relative to the [current working
|
(possibly relative to the [current working
|
||||||
directory](&url.php-manual;function.getcwd.php)). If file found,
|
directory](https://www.php.net/function.getcwd.php)). If file found,
|
||||||
return it.
|
return it.
|
||||||
|
|
||||||
- Try default\_handler or fail.
|
- Try default\_handler or fail.
|
||||||
|
@ -19,7 +19,7 @@ almost nothing.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> - `$use_sub_dirs=true` doesn\'t work with
|
> - `$use_sub_dirs=true` doesn\'t work with
|
||||||
> [safe\_mode=On](&url.php-manual;features.safe-mode), that\'s why
|
> [safe\_mode=On](https://www.php.net/features.safe-mode), that\'s why
|
||||||
> it\'s switchable and why it\'s off by default.
|
> it\'s switchable and why it\'s off by default.
|
||||||
>
|
>
|
||||||
> - `$use_sub_dirs=true` on Windows can cause problems.
|
> - `$use_sub_dirs=true` on Windows can cause problems.
|
||||||
|
@ -62,7 +62,7 @@ cannot have both custom function `{func}` and block function
|
|||||||
|
|
||||||
If you have nested block functions, it\'s possible to find out what the
|
If you have nested block functions, it\'s possible to find out what the
|
||||||
parent block function is by accessing `$smarty->_tag_stack` variable.
|
parent block function is by accessing `$smarty->_tag_stack` variable.
|
||||||
Just do a [`var_dump()`](&url.php-manual;var_dump) on it and the
|
Just do a [`var_dump()`](https://www.php.net/var_dump) on it and the
|
||||||
structure should be apparent.
|
structure should be apparent.
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ The first parameter to the modifier plugin is the value on which the
|
|||||||
modifier is to operate. The rest of the parameters are optional,
|
modifier is to operate. The rest of the parameters are optional,
|
||||||
depending on what kind of operation is to be performed.
|
depending on what kind of operation is to be performed.
|
||||||
|
|
||||||
The modifier has to [return](&url.php-manual;return) the result of its
|
The modifier has to [return](https://www.php.net/return) the result of its
|
||||||
processing.
|
processing.
|
||||||
|
|
||||||
This plugin basically aliases one of the built-in PHP functions. It does
|
This plugin basically aliases one of the built-in PHP functions. It does
|
||||||
|
@ -32,7 +32,7 @@ in order to be located by Smarty.
|
|||||||
|
|
||||||
- And `name` should be a valid identifier; letters, numbers, and
|
- And `name` should be a valid identifier; letters, numbers, and
|
||||||
underscores only, see [php
|
underscores only, see [php
|
||||||
variables](&url.php-manual;language.variables).
|
variables](https://www.php.net/language.variables).
|
||||||
|
|
||||||
- Some examples: `function.html_select_date.php`, `resource.db.php`,
|
- Some examples: `function.html_select_date.php`, `resource.db.php`,
|
||||||
`modifier.spacify.php`.
|
`modifier.spacify.php`.
|
||||||
|
@ -14,7 +14,7 @@ is invoked.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> As of Smarty 3.1 the file resource no longer walks through the
|
> As of Smarty 3.1 the file resource no longer walks through the
|
||||||
> [include\_path](&url.php-manual;ini.core.php#ini.include-path) unless
|
> [include\_path](https://www.php.net/ini.core.php#ini.include-path) unless
|
||||||
> [`$use_include_path` is activated](#variable.use.include.path)
|
> [`$use_include_path` is activated](#variable.use.include.path)
|
||||||
|
|
||||||
Templates from \$template\_dir {#templates.from.template.dir}
|
Templates from \$template\_dir {#templates.from.template.dir}
|
||||||
|
@ -46,8 +46,8 @@ From within a Smarty template
|
|||||||
|
|
||||||
|
|
||||||
Both `string:` and `eval:` resources may be encoded with
|
Both `string:` and `eval:` resources may be encoded with
|
||||||
[`urlencode()`](&url.php-manual;urlencode) or
|
[`urlencode()`](https://www.php.net/urlencode) or
|
||||||
[`base64_encode()`](&url.php-manual;urlencode). This is not necessary
|
[`base64_encode()`](https://www.php.net/urlencode). This is not necessary
|
||||||
for the usual use of `string:` and `eval:`, but is required when using
|
for the usual use of `string:` and `eval:`, but is required when using
|
||||||
either of them in conjunction with
|
either of them in conjunction with
|
||||||
[`Extends Template Resource`](#resources.extends)
|
[`Extends Template Resource`](#resources.extends)
|
||||||
|
Reference in New Issue
Block a user