aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md')
-rw-r--r--vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md148
1 files changed, 64 insertions, 84 deletions
diff --git a/vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md b/vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md
index e2949e0e5..da543fb62 100644
--- a/vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md
+++ b/vendor/smarty/smarty/docs/designers/language-variables/language-variables-smarty.md
@@ -1,43 +1,40 @@
-{\$smarty} reserved variable {#language.variables.smarty}
-============================
+# {$smarty} reserved variable
The PHP reserved `{$smarty}` variable can be used to access several
environment and request variables. The full list of them follows.
-Request variables {#language.variables.smarty.request}
------------------
+## Request variables
-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
be accessed as demonstrated in the examples below:
+```smarty
+{* display value of page from URL ($_GET) http://www.example.com/index.php?page=foo *}
+{$smarty.get.page}
- {* display value of page from URL ($_GET) http://www.example.com/index.php?page=foo *}
- {$smarty.get.page}
+{* display the variable "page" from a form ($_POST['page']) *}
+{$smarty.post.page}
- {* display the variable "page" from a form ($_POST['page']) *}
- {$smarty.post.page}
+{* display the value of the cookie "username" ($_COOKIE['username']) *}
+{$smarty.cookies.username}
- {* display the value of the cookie "username" ($_COOKIE['username']) *}
- {$smarty.cookies.username}
+{* display the server variable "SERVER_NAME" ($_SERVER['SERVER_NAME'])*}
+{$smarty.server.SERVER_NAME}
- {* display the server variable "SERVER_NAME" ($_SERVER['SERVER_NAME'])*}
- {$smarty.server.SERVER_NAME}
+{* display the system environment variable "PATH" *}
+{$smarty.env.PATH}
- {* display the system environment variable "PATH" *}
- {$smarty.env.PATH}
+{* display the php session variable "id" ($_SESSION['id']) *}
+{$smarty.session.id}
- {* display the php session variable "id" ($_SESSION['id']) *}
- {$smarty.session.id}
-
- {* display the variable "username" from merged get/post/cookies/server/env *}
- {$smarty.request.username}
-
-
+{* display the variable "username" from merged get/post/cookies/server/env *}
+{$smarty.request.username}
+```
> **Note**
>
-> For historical reasons `{$SCRIPT_NAME}` is short-hand for
+> For historical reasons `{$SCRIPT_NAME}` is shorthand for
> `{$smarty.server.SCRIPT_NAME}`.
>
>
@@ -51,46 +48,38 @@ be accessed as demonstrated in the examples below:
> globals mixes underlying application code structure with templates. A
> good practice is to assign specific needed values to template vars.
-{\$smarty.now} {#language.variables.smarty.now}
---------------
+## {$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
since the so-called Epoch on January 1, 1970, and can be passed directly
-to the [`date_format`](#language.modifier.date.format) modifier for
-display. Note that [`time()`](&url.php-manual;function.time) is called
+to the [`date_format`](../language-modifiers/language-modifier-date-format.md) modifier for
+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
-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.
-::: {.informalexample}
-
- {* use the date_format modifier to show current date and time *}
- {$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}
-
-
-:::
+```smarty
+{* use the date_format modifier to show current date and time *}
+{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}
+```
-{\$smarty.const} {#language.variables.smarty.const}
-----------------
+## {$smarty.const}
You can access PHP constant values directly. See also [smarty
-constants](#smarty.constants).
+constants](../../programmers/smarty-constants.md).
-::: {.informalexample}
-
- <?php
- // the constant defined in php
- define('MY_CONST_VAL','CHERRIES');
- ?>
-:::
+```php
+<?php
+// the constant defined in php
+define('MY_CONST_VAL','CHERRIES');
+```
Output the constant in a template with
-::: {.informalexample}
-
- {$smarty.const.MY_CONST_VAL}
-:::
+```smarty
+{$smarty.const.MY_CONST_VAL}
+```
> **Note**
>
@@ -99,78 +88,69 @@ Output the constant in a template with
> application code structure into the templates. A good practice is to
> assign specific needed values to template vars.
-{\$smarty.capture} {#language.variables.smarty.capture}
-------------------
+## {$smarty.capture}
Template output captured via the built-in
-[`{capture}..{/capture}`](#language.function.capture) function can be
+[`{capture}..{/capture}`](../language-builtin-functions/language-function-capture.md) function can be
accessed using the `{$smarty.capture}` variable. See the
-[`{capture}`](#language.function.capture) page for more information.
+[`{capture}`](../language-builtin-functions/language-function-capture.md) page for more information.
-{\$smarty.config} {#language.variables.smarty.config}
------------------
+## {$smarty.config}
`{$smarty.config}` variable can be used to refer to loaded [config
-variables](#language.config.variables). `{$smarty.config.foo}` is a
+variables](language-config-variables.md). `{$smarty.config.foo}` is a
synonym for `{#foo#}`. See the
-[{config\_load}](#language.function.config.load) page for more info.
+[{config_load}](../language-builtin-functions/language-function-config-load.md) page for more info.
-{\$smarty.section} {#language.variables.smarty.loops}
-------------------
+## {$smarty.section}
The `{$smarty.section}` variables can be used to refer to
-[`{section}`](#language.function.section) loop properties. These have
+[`{section}`](../language-builtin-functions/language-function-section.md) loop properties. These have
some very useful values such as `.first`, `.index`, etc.
> **Note**
>
> The `{$smarty.foreach}` variable is no longer used with the new
-> [`{foreach}`](#language.function.foreach) syntax, but is still
+> [`{foreach}`](../language-builtin-functions/language-function-foreach.md) syntax, but is still
> supported with Smarty 2.x style foreach syntax.
-{\$smarty.template} {#language.variables.smarty.template}
--------------------
+## {$smarty.template}
Returns the name of the current template being processed (without the
directory).
-{\$smarty.template\_object} {#language.variables.smarty.template_object}
----------------------------
+## {$smarty.template_object}
Returns the template object of the current template being processed.
-{\$smarty.current\_dir} {#language.variables.smarty.current_dir}
------------------------
+## {$smarty.current_dir}
Returns the name of the directory for the current template being
-processed.
+processed if it is loaded from the filesystem (the default).
-{\$smarty.version} {#language.variables.smarty.version}
-------------------
+## {$smarty.version}
Returns the version of Smarty the template was compiled with.
+```smarty
+<div id="footer">Powered by Smarty {$smarty.version}</div>
+```
- <div id="footer">Powered by Smarty {$smarty.version}</div>
-
-{\$smarty.block.child} {#language.variables.smarty.block.child}
-----------------------
+## {$smarty.block.child}
Returns block text from child template. See [Template
-inheritance](#advanced.features.template.inheritance).
+inheritance](../../programmers/advanced-features/advanced-features-template-inheritance.md).
-{\$smarty.block.parent} {#language.variables.smarty.block.parent}
------------------------
+## {$smarty.block.parent}
Returns block text from parent template. See [Template
-inheritance](#advanced.features.template.inheritance)
+inheritance](../../programmers/advanced-features/advanced-features-template-inheritance.md)
-{\$smarty.ldelim}, {\$smarty.rdelim} {#language.variables.smarty.ldelim}
-------------------------------------
+## {$smarty.ldelim}, {$smarty.rdelim}
These variables are used for printing the left-delimiter and
right-delimiter value literally, the same as
-[`{ldelim},{rdelim}`](#language.function.ldelim).
+[`{ldelim},{rdelim}`](../language-builtin-functions/language-function-ldelim.md).
-See also [assigned variables](#language.assigned.variables) and [config
-variables](#language.config.variables)
+See also [assigned variables](language-assigned-variables.md) and [config
+variables](language-config-variables.md)