mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 09:54:27 +02:00
Added TOCs, rewrote most important links in documentation. Linked README to new Github Pages site
This commit is contained in:
@@ -4,7 +4,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation
|
|||||||

|

|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Read the [documentation](https://www.smarty.net/docs/en/) to find out how to use it.
|
Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
Smarty can be run with PHP 7.1 to PHP 8.0.
|
Smarty can be run with PHP 7.1 to PHP 8.0.
|
||||||
|
@@ -2,32 +2,32 @@ Debugging Console {#chapter.debugging.console}
|
|||||||
=================
|
=================
|
||||||
|
|
||||||
There is a debugging console included with Smarty. The console informs
|
There is a debugging console included with Smarty. The console informs
|
||||||
you of all the [included](#language.function.include) templates,
|
you of all the [included](./language-builtin-functions/language-function-include.md) templates,
|
||||||
[assigned](#api.assign) variables and
|
[assigned](../programmers/api-functions/api-assign.md) variables and
|
||||||
[config](#language.config.variables) file variables for the current
|
[config](./language-variables/language-config-variables.md) file variables for the current
|
||||||
invocation of the template. A template file named `debug.tpl` is
|
invocation of the template. A template file named `debug.tpl` is
|
||||||
included with the distribution of Smarty which controls the formatting
|
included with the distribution of Smarty which controls the formatting
|
||||||
of the console.
|
of the console.
|
||||||
|
|
||||||
Set [`$debugging`](#variable.debugging) to TRUE in Smarty, and if needed
|
Set [`$debugging`](../programmers/api-variables/variable-debugging.md) to TRUE in Smarty, and if needed
|
||||||
set [`$debug_tpl`](#variable.debug_template) to the template resource
|
set [`$debug_tpl`](../programmers/api-variables/variable-debug-template.md) to the template resource
|
||||||
path to `debug.tpl` (this is in [`SMARTY_DIR`](#constant.smarty.dir) by
|
path to `debug.tpl` (this is in [`SMARTY_DIR`](../programmers/smarty-constants.md) by
|
||||||
default). When you load the page, a Javascript console window will pop
|
default). When you load the page, a Javascript console window will pop
|
||||||
up and give you the names of all the included templates and assigned
|
up and give you the names of all the included templates and assigned
|
||||||
variables for the current page.
|
variables for the current page.
|
||||||
|
|
||||||
To see the available variables for a particular template, see the
|
To see the available variables for a particular template, see the
|
||||||
[`{debug}`](#language.function.debug) template function. To disable the
|
[`{debug}`](./language-builtin-functions/language-function-debug.md) template function. To disable the
|
||||||
debugging console, set [`$debugging`](#variable.debugging) to FALSE. You
|
debugging console, set [`$debugging`](../programmers/api-variables/variable-debugging.md) to FALSE. You
|
||||||
can also temporarily turn on the debugging console by putting
|
can also temporarily turn on the debugging console by putting
|
||||||
`SMARTY_DEBUG` in the URL if you enable this option with
|
`SMARTY_DEBUG` in the URL if you enable this option with
|
||||||
[`$debugging_ctrl`](#variable.debugging.ctrl).
|
[`$debugging_ctrl`](../programmers/api-variables/variable-debugging-ctrl.md).
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> The debugging console does not work when you use the
|
> The debugging console does not work when you use the
|
||||||
> [`fetch()`](#api.fetch) API, only when using
|
> [`fetch()`](../programmers/api-functions/api-fetch.md) API, only when using
|
||||||
> [`display()`](#api.display). It is a set of javascript statements
|
> [`display()`](../programmers/api-functions/api-display.md). It is a set of javascript statements
|
||||||
> added to the very bottom of the generated template. If you do not like
|
> added to the very bottom of the generated template. If you do not like
|
||||||
> javascript, you can edit the `debug.tpl` template to format the output
|
> javascript, you can edit the `debug.tpl` template to format the output
|
||||||
> however you like. Debug data is not cached and `debug.tpl` info is not
|
> however you like. Debug data is not cached and `debug.tpl` info is not
|
||||||
@@ -38,4 +38,4 @@ can also temporarily turn on the debugging console by putting
|
|||||||
> The load times of each template and config file are in seconds, or
|
> The load times of each template and config file are in seconds, or
|
||||||
> fractions thereof.
|
> fractions thereof.
|
||||||
|
|
||||||
See also [troubleshooting](#troubleshooting).
|
See also [troubleshooting](../appendixes/troubleshooting.md).
|
||||||
|
@@ -34,7 +34,7 @@ updated.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Values of [config file variables](#language.config.variables) can be in
|
Values of [config file variables](./language-variables/language-config-variables.md) can be in
|
||||||
quotes, but not necessary. You can use either single or double quotes.
|
quotes, but not necessary. You can use either single or double quotes.
|
||||||
If you have a value that spans more than one line, enclose the entire
|
If you have a value that spans more than one line, enclose the entire
|
||||||
value with triple quotes (\"\"\"). You can put comments into config
|
value with triple quotes (\"\"\"). You can put comments into config
|
||||||
@@ -51,12 +51,12 @@ global variables and the variables from that section are also loaded. If
|
|||||||
a variable exists both as a global and in a section, the section
|
a variable exists both as a global and in a section, the section
|
||||||
variable is used. If you name two variables the same within a section,
|
variable is used. If you name two variables the same within a section,
|
||||||
the last one will be used unless
|
the last one will be used unless
|
||||||
[`$config_overwrite`](#variable.config.overwrite) is disabled.
|
[`$config_overwrite`](../programmers/api-variables/variable-config-overwrite.md) is disabled.
|
||||||
|
|
||||||
Config files are loaded into templates with the built-in template
|
Config files are loaded into templates with the built-in template
|
||||||
function [`
|
function [`
|
||||||
{config_load}`](#language.function.config.load) or the API
|
{config_load}`](./language-builtin-functions/language-function-config-load.md) or the API
|
||||||
[`configLoad()`](#api.config.load) function.
|
[`configLoad()`](../programmers/api-functions/api-config-load.md) function.
|
||||||
|
|
||||||
You can hide variables or entire sections by prepending the variable
|
You can hide variables or entire sections by prepending the variable
|
||||||
name or section name with a period(.) eg `[.hidden]`. This is useful if
|
name or section name with a period(.) eg `[.hidden]`. This is useful if
|
||||||
@@ -69,9 +69,9 @@ Config files (or resources) are loaded by the same resource facilities
|
|||||||
as templates. That means that a config file can also be loaded from a db
|
as templates. That means that a config file can also be loaded from a db
|
||||||
`$smarty->configLoad("db:my.conf")`.
|
`$smarty->configLoad("db:my.conf")`.
|
||||||
|
|
||||||
See also [`{config_load}`](#language.function.config.load),
|
See also [`{config_load}`](./language-builtin-functions/language-function-config-load.md),
|
||||||
[`$config_overwrite`](#variable.config.overwrite),
|
[`$config_overwrite`](../programmers/api-variables/variable-config-overwrite.md),
|
||||||
[`$default_config_handler_func`](#variable.default.config.handler.func),
|
[`$default_config_handler_func`](../programmers/api-variables/variable-default-config-handler-func.md),
|
||||||
[`getConfigVars()`](#api.get.config.vars),
|
[`getConfigVars()`](../programmers/api-functions/api-get-config-vars.md),
|
||||||
[`clearConfig()`](#api.clear.config) and
|
[`clearConfig()`](../programmers/api-functions/api-clear-config.md) and
|
||||||
[`configLoad()`](#api.config.load)
|
[`configLoad()`](../programmers/api-functions/api-config-load.md)
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
Basic Syntax {#language.basic.syntax}
|
Basic Syntax
|
||||||
============
|
============
|
||||||
|
|
||||||
All Smarty template tags are enclosed within delimiters. By default
|
All Smarty template tags are enclosed within delimiters. By default
|
||||||
these are `{` and `}`, but they can be
|
these are `{` and `}`, but they can be
|
||||||
[changed](#variable.left.delimiter).
|
[changed](../programmers/api-variables/variable-left-delimiter.md).
|
||||||
|
|
||||||
For the examples in this manual, we will assume that you are using the
|
For the examples in this manual, we will assume that you are using the
|
||||||
default delimiters. In Smarty, all content outside of delimiters is
|
default delimiters. In Smarty, all content outside of delimiters is
|
||||||
@@ -11,10 +11,10 @@ displayed as static content, or unchanged. When Smarty encounters
|
|||||||
template tags, it attempts to interpret them, and displays the
|
template tags, it attempts to interpret them, and displays the
|
||||||
appropriate output in their place.
|
appropriate output in their place.
|
||||||
|
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-SYNTAX-COMMENTS
|
- [Comments](./language-basic-syntax/language-syntax-comments.md)
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-SYNTAX-VARIABLES
|
- [Variables](./language-basic-syntax/language-syntax-variables.md)
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-SYNTAX-FUNCTIONS
|
- [Functions](./language-basic-syntax/language-syntax-functions.md)
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-SYNTAX-ATTRIBUTES
|
- [Attributes](./language-basic-syntax/language-syntax-attributes.md)
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-SYNTAX-QUOTES
|
- [Quotes](./language-basic-syntax/language-syntax-quotes.md)
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-MATH
|
- [Math](./language-basic-syntax/language-math.md)
|
||||||
DESIGNERS.LANGUAGE-BASIC-SYNTAX.LANGUAGE-ESCAPING
|
- [Escaping](./language-basic-syntax/language-escaping.md)
|
||||||
|
@@ -1,39 +1,40 @@
|
|||||||
Built-in Functions {#language.builtin.functions}
|
Built-in Functions {#language.builtin.functions}
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
- [{$var=...}](./language-builtin-functions.md)
|
||||||
|
- [{append}](./language-builtin-functions/language-function-append.md)
|
||||||
|
- [{assign}](./language-builtin-functions/language-function-assign.md)
|
||||||
|
- [{block}](./language-builtin-functions/language-function-block.md)
|
||||||
|
- [{call}](./language-builtin-functions/language-function-call.md)
|
||||||
|
- [{capture}](./language-builtin-functions/language-function-capture.md)
|
||||||
|
- [{config_load}](./language-builtin-functions/language-function-config.load)
|
||||||
|
- [{debug}](./language-builtin-functions/language-function-debug.md)
|
||||||
|
- [{extends}](./language-builtin-functions/language-function-extends.md)
|
||||||
|
- [{for}](./language-builtin-functions/language-function-for.md)
|
||||||
|
- [{foreach},{foreachelse}](./language-builtin-functions/language-function-foreach.md)
|
||||||
|
- [{function}](./language-builtin-functions/language-function-function.md)
|
||||||
|
- [{if},{elseif},{else}](./language-builtin-functions/language-function-if.md)
|
||||||
|
- [{include}](./language-builtin-functions/language-function-include.md)
|
||||||
|
- [{include_php}](./language-builtin-functions/language-function-include.php)
|
||||||
|
- [{insert}](./language-builtin-functions/language-function-insert.md)
|
||||||
|
- [{ldelim},{rdelim}](./language-builtin-functions/language-function-ldelim.md)
|
||||||
|
- [{literal}](./language-builtin-functions/language-function-literal.md)
|
||||||
|
- [{nocache}](./language-builtin-functions/language-function-nocache.md)
|
||||||
|
- [{php}](./language-builtin-functions/language-function-php.md)
|
||||||
|
- [{section},{sectionelse}](./language-builtin-functions/language-function-section.md)
|
||||||
|
- [{setfilter}](./language-builtin-functions/language-function-setfilter.md)
|
||||||
|
- [{strip}](./language-builtin-functions/language-function-strip.md)
|
||||||
|
- [{while}](./language-builtin-functions/language-function-while.md)
|
||||||
|
|
||||||
Smarty comes with several built-in functions. These built-in functions
|
Smarty comes with several built-in functions. These built-in functions
|
||||||
are the integral part of the smarty template engine. They are compiled
|
are the integral part of the smarty template engine. They are compiled
|
||||||
into corresponding inline PHP code for maximum performance.
|
into corresponding inline PHP code for maximum performance.
|
||||||
|
|
||||||
You cannot create your own [custom
|
You cannot create your own [custom
|
||||||
functions](#language.custom.functions) with the same name; and you
|
functions](./language-custom-functions.md) with the same name; and you
|
||||||
should not need to modify the built-in functions.
|
should not need to modify the built-in functions.
|
||||||
|
|
||||||
A few of these functions have an `assign` attribute which collects the
|
A few of these functions have an `assign` attribute which collects the
|
||||||
result the function to a named template variable instead of being
|
result the function to a named template variable instead of being
|
||||||
output; much like the [`{assign}`](#language.function.assign) function.
|
output; much like the [`{assign}`](./language-builtin-functions/language-function-assign.md) function.
|
||||||
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-SHORTFORM-ASSIGN
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-APPEND
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-ASSIGN
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-BLOCK
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-CALL
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-CAPTURE
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-CONFIG-LOAD
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-DEBUG
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-EXTENDS
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-FOR
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-FOREACH
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-FUNCTION
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-IF
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-INCLUDE
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-INCLUDE-PHP
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-INSERT
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-LDELIM
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-LITERAL
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-NOCACHE
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-PHP
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-SECTION
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-SETFILTER
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-STRIP
|
|
||||||
DESIGNERS.LANGUAGE-BUILTIN-FUNCTIONS.LANGUAGE-FUNCTION-WHILE
|
|
||||||
|
@@ -4,17 +4,18 @@ Custom Functions {#language.custom.functions}
|
|||||||
Smarty comes with several custom plugin functions that you can use in
|
Smarty comes with several custom plugin functions that you can use in
|
||||||
the templates.
|
the templates.
|
||||||
|
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-COUNTER
|
## Table of contents
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-CYCLE
|
- [{counter}](./language-custom-functions/language-function-counter.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-EVAL
|
- [{cycle}](./language-custom-functions/language.function.cycle.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-FETCH
|
- [{eval}](./language-custom-functions/language.function.eval.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-CHECKBOXES
|
- [{fetch}](./language-custom-functions/language.function.fetch.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-IMAGE
|
- [{html_checkboxes}](./language-custom-functions/language.function.html.checkboxes.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-OPTIONS
|
- [{html_image}](./language-custom-functions/language.function.html.image.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-RADIOS
|
- [{html_options}](./language-custom-functions/language.function.html.options.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-SELECT-DATE
|
- [{html_radios}](./language-custom-functions/language.function.html.radios.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-SELECT-TIME
|
- [{html_select_date}](./language-custom-functions/language.function.html.select.date.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-HTML-TABLE
|
- [{html_select_time}](./language-custom-functions/language.function.html.select.time.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-MAILTO
|
- [{html_table}](./language-custom-functions/language.function.html.table.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-MATH
|
- [{mailto}](./language-custom-functions/language.function.mailto.md)
|
||||||
DESIGNERS.LANGUAGE-CUSTOM-FUNCTIONS.LANGUAGE-FUNCTION-TEXTFORMAT
|
- [{math}](./language-custom-functions/language.function.math.md)
|
||||||
|
- [{textformat}](./language-custom-functions/language.function.textformat.md)
|
||||||
|
@@ -1,15 +1,41 @@
|
|||||||
Variable Modifiers {#language.modifiers}
|
Variable Modifiers {#language.modifiers}
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
- [capitalize](./language-modifiers/language.modifiers.md)
|
||||||
|
- [cat](./language-modifiers/language.modifier.md)
|
||||||
|
- [count_characters](./language-modifiers/language.modifier.md)
|
||||||
|
- [count_paragraphs](./language-modifiers/language.modifier.md)
|
||||||
|
- [count_sentences](./language-modifiers/language.modifier.md)
|
||||||
|
- [count_words](./language-modifiers/language.modifier.md)
|
||||||
|
- [date_format](./language-modifiers/language.modifier.md)
|
||||||
|
- [default](./language-modifiers/language.modifier.md)
|
||||||
|
- [escape](./language-modifiers/language.modifier.md)
|
||||||
|
- [from_charset](./language-modifiers/language.modifier.md)
|
||||||
|
- [indent](./language-modifiers/language.modifier.md)
|
||||||
|
- [lower](./language-modifiers/language.modifier.md)
|
||||||
|
- [nl2br](./language-modifiers/language.modifier.md)
|
||||||
|
- [regex_replace](./language-modifiers/language.modifier.md)
|
||||||
|
- [replace](./language-modifiers/language.modifier.md)
|
||||||
|
- [spacify](./language-modifiers/language.modifier.md)
|
||||||
|
- [string_format](./language-modifiers/language.modifier.md)
|
||||||
|
- [strip](./language-modifiers/language.modifier.md)
|
||||||
|
- [strip_tags](./language-modifiers/language.modifier.md)
|
||||||
|
- [to_charset](./language-modifiers/language.modifier.md)
|
||||||
|
- [truncate](./language-modifiers/language.modifier.md)
|
||||||
|
- [unescape](./language-modifiers/language.modifier.md)
|
||||||
|
- [upper](./language-modifiers/language.modifier.md)
|
||||||
|
- [wordwrap](./language-modifiers/language.modifier.md)
|
||||||
|
|
||||||
Variable modifiers can be applied to
|
Variable modifiers can be applied to
|
||||||
[variables](#language.syntax.variables), [custom
|
[variables](./language-variables.md), [custom
|
||||||
functions](#language.custom.functions) or strings. To apply a modifier,
|
functions](./language-custom-functions.md) or strings. To apply a modifier,
|
||||||
specify the value followed by a `|` (pipe) and the modifier name. A
|
specify the value followed by a `|` (pipe) and the modifier name. A
|
||||||
modifier may accept additional parameters that affect its behavior.
|
modifier may accept additional parameters that affect its behavior.
|
||||||
These parameters follow the modifier name and are separated by a `:`
|
These parameters follow the modifier name and are separated by a `:`
|
||||||
(colon). Also, *all php-functions can be used as modifiers implicitly*
|
(colon). Also, *all php-functions can be used as modifiers implicitly*
|
||||||
(more below) and modifiers can be
|
(more below) and modifiers can be
|
||||||
[combined](#language.combining.modifiers).
|
[combined](./language-combining-modifiers.md).
|
||||||
|
|
||||||
|
|
||||||
{* apply modifier to a variable *}
|
{* apply modifier to a variable *}
|
||||||
@@ -46,7 +72,7 @@ These parameters follow the modifier name and are separated by a `:`
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
- Modifiers can be applied to any type of variables, including arrays
|
- Modifiers can be applied to any type of variables, including arrays
|
||||||
and objects.
|
and objects.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
@@ -71,13 +97,13 @@ These parameters follow the modifier name and are separated by a `:`
|
|||||||
> gives 9. To get the old result use parentheses like
|
> gives 9. To get the old result use parentheses like
|
||||||
> `{(8+2)|count_characters}`.
|
> `{(8+2)|count_characters}`.
|
||||||
|
|
||||||
- Modifiers are autoloaded from the
|
- Modifiers are autoloaded from the
|
||||||
[`$plugins_dir`](#variable.plugins.dir) or can be registered
|
[`$plugins_dir`](../programmers/api-variables/variable-plugins-dir.md) or can be registered
|
||||||
explicitly with the [`registerPlugin()`](#api.register.plugin)
|
explicitly with the [`registerPlugin()`](../programmers/api-functions/api-register-plugin.md)
|
||||||
function. The later is useful for sharing a function between php
|
function. The later is useful for sharing a function between php
|
||||||
scripts and smarty templates.
|
scripts and smarty templates.
|
||||||
|
|
||||||
- All php-functions can be used as modifiers implicitly, as
|
- All php-functions can be used as modifiers implicitly, as
|
||||||
demonstrated in the example above. However, using php-functions as
|
demonstrated in the example above. However, using php-functions as
|
||||||
modifiers has two little pitfalls:
|
modifiers has two little pitfalls:
|
||||||
|
|
||||||
@@ -90,33 +116,8 @@ These parameters follow the modifier name and are separated by a `:`
|
|||||||
- Secondly - if security is enabled, all php-functions that are to
|
- Secondly - if security is enabled, all php-functions that are to
|
||||||
be used as modifiers have to be declared trusted in the
|
be used as modifiers have to be declared trusted in the
|
||||||
`$modifiers` property of the securty policy. See the
|
`$modifiers` property of the securty policy. See the
|
||||||
[Security](#advanced.features.security) section for details.
|
[Security](../programmers/advanced-features/advanced-features-security.md) section for details.
|
||||||
|
|
||||||
See also [`registerPlugin()`](#api.register.plugin), [combining
|
See also [`registerPlugin()`](../programmers/api-functions/api-register-plugin.md), [combining
|
||||||
modifiers](#language.combining.modifiers). and [extending smarty with
|
modifiers](./language-combining-modifiers.md). and [extending smarty with
|
||||||
plugins](#plugins)
|
plugins](../programmers/plugins.md)
|
||||||
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-CAPITALIZE
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-CAT
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-COUNT-CHARACTERS
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-COUNT-PARAGRAPHS
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-COUNT-SENTENCES
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-COUNT-WORDS
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-DATE-FORMAT
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-DEFAULT
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-ESCAPE
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-FROM-CHARSET
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-INDENT
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-LOWER
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-NL2BR
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-REGEX-REPLACE
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-REPLACE
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-SPACIFY
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-STRING-FORMAT
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-STRIP
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-STRIP-TAGS
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-TO-CHARSET
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-TRUNCATE
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-UNESCAPE
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-UPPER
|
|
||||||
DESIGNERS.LANGUAGE-MODIFIERS.LANGUAGE-MODIFIER-WORDWRAP
|
|
||||||
|
@@ -1,15 +1,22 @@
|
|||||||
Variables {#language.variables}
|
Variables
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
- [Variables assigned from PHP](./language-variables/language-assigned-variables.md)
|
||||||
|
- [Variable scopes](./language-variables/language-variable-scopes.md)
|
||||||
|
- [Variables loaded from config files](./language-variables/language-config-variables.md)
|
||||||
|
- [{$smarty} reserved variable](./language-variables/language-variables-smarty.md)
|
||||||
|
|
||||||
|
|
||||||
Smarty has several different types of variables. The type of the
|
Smarty has several different types of variables. The type of the
|
||||||
variable depends on what symbol it is prefixed or enclosed within.
|
variable depends on what symbol it is prefixed or enclosed within.
|
||||||
|
|
||||||
Variables in Smarty can be either displayed directly or used as
|
Variables in Smarty can be either displayed directly or used as
|
||||||
arguments for [functions](#language.syntax.functions),
|
arguments for [functions](./language-basic-syntax/language-syntax-functions.md),
|
||||||
[attributes](#language.syntax.attributes) and
|
[attributes](./language-basic-syntax/language-syntax-attributes.md) and
|
||||||
[modifiers](#language.modifiers), inside conditional expressions, etc.
|
[modifiers](./language-modifiers.md), inside conditional expressions, etc.
|
||||||
To print a variable, simply enclose it in the
|
To print a variable, simply enclose it in the
|
||||||
[delimiters](#variable.left.delimiter) so that it is the only thing
|
[delimiters](../programmers/api-variables/variable-left-delimiter.md) so that it is the only thing
|
||||||
contained between them.
|
contained between them.
|
||||||
|
|
||||||
|
|
||||||
@@ -26,9 +33,5 @@ contained between them.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> An easy way to examine assigned Smarty variables is with the
|
> An easy way to examine assigned Smarty variables is with the
|
||||||
> [debugging console](#chapter.debugging.console).
|
> [debugging console](./chapter-debugging-console.md).
|
||||||
|
|
||||||
DESIGNERS.LANGUAGE-VARIABLES.LANGUAGE-ASSIGNED-VARIABLES
|
|
||||||
DESIGNERS.LANGUAGE-VARIABLES.LANGUAGE-VARIABLE-SCOPES
|
|
||||||
DESIGNERS.LANGUAGE-VARIABLES.LANGUAGE-CONFIG-VARIABLES
|
|
||||||
DESIGNERS.LANGUAGE-VARIABLES.LANGUAGE-VARIABLES-SMARTY
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
What is Smarty? {#what.is.smarty}
|
What is Smarty?
|
||||||
===============
|
===============
|
||||||
|
|
||||||
Smarty is a template engine for PHP. More specifically, it facilitates a
|
Smarty is a template engine for PHP. More specifically, it facilitates a
|
||||||
|
@@ -6,7 +6,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation
|
|||||||
- [Preface](./preface.md)
|
- [Preface](./preface.md)
|
||||||
- [Getting Started](./getting-started.md)
|
- [Getting Started](./getting-started.md)
|
||||||
|
|
||||||
## Smarty for Designers
|
## Smarty for template developers
|
||||||
- [Basic Syntax](./designers/language-basic-syntax.md)
|
- [Basic Syntax](./designers/language-basic-syntax.md)
|
||||||
- [Variables](./designers/language-variables.md)
|
- [Variables](./designers/language-variables.md)
|
||||||
- [Variable Modifiers](./designers/language-modifiers.md)
|
- [Variable Modifiers](./designers/language-modifiers.md)
|
||||||
@@ -16,7 +16,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation
|
|||||||
- [Config Files](./designers/config-files.md)
|
- [Config Files](./designers/config-files.md)
|
||||||
- [Debugging Console](./designers/chapter-debugging-console.md)
|
- [Debugging Console](./designers/chapter-debugging-console.md)
|
||||||
|
|
||||||
## Smarty of Programmers
|
## Smarty for php developers
|
||||||
- [Charset Encoding](./programmers/charset.md)
|
- [Charset Encoding](./programmers/charset.md)
|
||||||
- [Constants](./programmers/smarty-constants.md)
|
- [Constants](./programmers/smarty-constants.md)
|
||||||
- [Smarty Class Variables](./programmers/api-variables.md)
|
- [Smarty Class Variables](./programmers/api-variables.md)
|
||||||
|
@@ -6,21 +6,13 @@ Preface
|
|||||||
The Smarty design was largely driven by these goals:
|
The Smarty design was largely driven by these goals:
|
||||||
|
|
||||||
- clean separation of presentation from application code
|
- clean separation of presentation from application code
|
||||||
|
|
||||||
- PHP backend, Smarty template frontend
|
- PHP backend, Smarty template frontend
|
||||||
|
|
||||||
- complement PHP, not replace it
|
- complement PHP, not replace it
|
||||||
|
|
||||||
- fast development/deployment for programmers and designers
|
- fast development/deployment for programmers and designers
|
||||||
|
|
||||||
- quick and easy to maintain
|
- quick and easy to maintain
|
||||||
|
|
||||||
- syntax easy to understand, no PHP knowledge necessary
|
- syntax easy to understand, no PHP knowledge necessary
|
||||||
|
|
||||||
- flexibility for custom development
|
- flexibility for custom development
|
||||||
|
|
||||||
- security: insulation from PHP
|
- security: insulation from PHP
|
||||||
|
|
||||||
- free, open source
|
- free, open source
|
||||||
|
|
||||||
**What is Smarty?**
|
**What is Smarty?**
|
||||||
@@ -202,7 +194,7 @@ website.
|
|||||||
|
|
||||||
There are tens of thousands of unique visitors on the Smarty website
|
There are tens of thousands of unique visitors on the Smarty website
|
||||||
daily, mostly developers reading documentation. Many well-known PHP
|
daily, mostly developers reading documentation. Many well-known PHP
|
||||||
projects make use of Smarty such as XOOPS CMS, CMS Made Simple , Tiki
|
projects make use of Smarty such as XOOPS CMS, CMS Made Simple, Tiki
|
||||||
CMS/Groupware and X-Cart to name a few.
|
CMS/Groupware and X-Cart to name a few.
|
||||||
|
|
||||||
**Summary**
|
**Summary**
|
||||||
@@ -212,15 +204,9 @@ solution, it can accommodate your needs. There are numerous features
|
|||||||
that make Smarty a great choice:
|
that make Smarty a great choice:
|
||||||
|
|
||||||
- separation of PHP from HTML/CSS just makes sense
|
- separation of PHP from HTML/CSS just makes sense
|
||||||
|
|
||||||
- readability for organization and management
|
- readability for organization and management
|
||||||
|
|
||||||
- security for 3rd party template access
|
- security for 3rd party template access
|
||||||
|
|
||||||
- feature completeness, and easily extendable to your own needs
|
- feature completeness, and easily extendable to your own needs
|
||||||
|
|
||||||
- massive user base, Smarty is here to stay
|
- massive user base, Smarty is here to stay
|
||||||
|
|
||||||
- LGPL license for commercial use
|
- LGPL license for commercial use
|
||||||
|
|
||||||
- 100% free to use, open source project
|
- 100% free to use, open source project
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
Advanced Features {#advanced.features}
|
Advanced Features {#advanced.features}
|
||||||
=================
|
=================
|
||||||
|
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-SECURITY
|
## Table of contents
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-TEMPLATE-SETTINGS
|
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-TEMPLATE-INHERITANCE
|
- [Security](./advanced-features/advanced-features-security.md)
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-STREAMS
|
- [Changing settings by template](./advanced-features/advanced-features-template-settings.md)
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-OBJECTS
|
- [Template Inheritance](./advanced-features/advanced-features-template-inheritance.md)
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-STATIC-CLASSES
|
- [Streams](./advanced-features/advanced-features-streams.md)
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-PREFILTERS
|
- [Objects](./advanced-features/advanced-features-objects.md)
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-POSTFILTERS
|
- [Static Classes](./advanced-features/advanced-features-static-classes.md)
|
||||||
PROGRAMMERS.ADVANCED-FEATURES.ADVANCED-FEATURES-OUTPUTFILTERS
|
- [Prefilters](./advanced-features/advanced-features-prefilters.md)
|
||||||
|
- [Postfilters](./advanced-features/advanced-features-postfilters.md)
|
||||||
|
- [Output Filters](./advanced-features/advanced-features-outputfilters.md)
|
||||||
|
@@ -1,62 +1,64 @@
|
|||||||
Smarty Class Methods {#api.functions}
|
Smarty Class Methods {#api.functions}
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
|
||||||
|
- [addConfigDir()](./api-functions/api-add-config-dir.md) — add a directory to the list of directories where config files are stored
|
||||||
|
- [addPluginsDir()](./api-functions/api-add-plugins-dir.md) — add a directory to the list of directories where plugins are stored
|
||||||
|
- [addTemplateDir()](./api-functions/api-add-template-dir.md) — add a directory to the list of directories where templates are stored
|
||||||
|
- [append()](./api-functions/api-append.md) — append an element to an assigned array
|
||||||
|
- [appendByRef()](./api-functions/api-append-by-ref.md) — append values by reference
|
||||||
|
- [assign()](./api-functions/api-assign.md) — assign variables/objects to the templates
|
||||||
|
- [assignByRef()](./api-functions/api-assign-by-ref.md) — assign values by reference
|
||||||
|
- [clearAllAssign()](./api-functions/api-clear-all-assign.md) — clears the values of all assigned variables
|
||||||
|
- [clearAllCache()](./api-functions/api-clear-all-cache.md) — clears the entire template cache
|
||||||
|
- [clearAssign()](./api-functions/api-clear-assign.md) — clears the value of an assigned variable
|
||||||
|
- [clearCache()](./api-functions/api-clear-cache.md) — clears the cache for a specific template
|
||||||
|
- [clearCompiledTemplate()](./api-functions/api-clear-compiled-tpl.md) — clears the compiled version of the specified template resource
|
||||||
|
- [clearConfig()](./api-functions/api-clear-config.md) — clears assigned config variables
|
||||||
|
- [compileAllConfig()](./api-functions/api-compile-all-config.md) — compiles all known config files
|
||||||
|
- [compileAllTemplates()](./api-functions/api-compile-all-templates.md) — compiles all known templates
|
||||||
|
- [configLoad()](./api-functions/api-config-load.md) — loads config file data and assigns it to the template
|
||||||
|
- [createData()](./api-functions/api-create-data.md) — creates a data object
|
||||||
|
- [createTemplate()](./api-functions/api-create-template.md) — returns a template object
|
||||||
|
- [disableSecurity()](./api-functions/api-disable-security.md) — disables template security
|
||||||
|
- [display()](./api-functions/api-display.md) — displays the template
|
||||||
|
- [enableSecurity()](./api-functions/api-enable-security.md) — enables template security
|
||||||
|
- [fetch()](./api-functions/api-fetch.md) — returns the template output
|
||||||
|
- [getCacheDir()](./api-functions/api-get-cache-dir.md) — return the directory where the rendered template's output is stored
|
||||||
|
- [getCompileDir()](./api-functions/api-get-compile-dir.md) — returns the directory where compiled templates are stored
|
||||||
|
- [getConfigDir()](./api-functions/api-get-config-dir.md) — return the directory where config files are stored
|
||||||
|
- [getConfigVars()](./api-functions/api-get-config-vars.md) — returns the given loaded config variable value
|
||||||
|
- [getPluginsDir()](./api-functions/api-get-plugins-dir.md) — return the directory where plugins are stored
|
||||||
|
- [getRegisteredObject()](./api-functions/api-get-registered-object.md) — returns a reference to a registered object
|
||||||
|
- [getTags()](./api-functions/api-get-tags.md) — return tags used by template
|
||||||
|
- [getTemplateDir()](./api-functions/api-get-template-dir.md) — return the directory where templates are stored
|
||||||
|
- [getTemplateVars()](./api-functions/api-get-template-vars.md) — returns assigned variable value(s)
|
||||||
|
- [isCached()](./api-functions/api-is-cached.md) — returns true if there is a valid cache for this template
|
||||||
|
- [loadFilter()](./api-functions/api-load-filter.md) — load a filter plugin
|
||||||
|
- [muteExpectedErrors()](./api-functions/api-mute-expected-errors.md) — mutes expected warnings and notices deliberately generated by Smarty
|
||||||
|
- [registerCacheResource()](./api-functions/api-register-cacheresource.md) — dynamically register CacheResources
|
||||||
|
- [registerClass()](./api-functions/api-register-class.md) — register a class for use in the templates
|
||||||
|
- [registerDefaultPluginHandler()](./api-functions/api-register-default-plugin-handler.md) — register a function which gets called on undefined tags
|
||||||
|
- [registerFilter()](./api-functions/api-register-filter.md) — dynamically register filters
|
||||||
|
- [registerPlugin()](./api-functions/api-register-plugin.md) — dynamically register plugins
|
||||||
|
- [registerObject()](./api-functions/api-register-object.md) — register an object for use in the templates
|
||||||
|
- [registerResource()](./api-functions/api-register-resource.md) — dynamically register resources
|
||||||
|
- [setCacheDir()](./api-functions/api-set-cache-dir.md) — set the directory where the rendered template's output is stored
|
||||||
|
- [setCompileDir()](./api-functions/api-set-compile-dir.md) — set the directory where compiled templates are stored
|
||||||
|
- [setConfigDir()](./api-functions/api-set-config-dir.md) — set the directories where config files are stored
|
||||||
|
- [setPluginsDir()](./api-functions/api-set-plugins-dir.md) — set the directories where plugins are stored
|
||||||
|
- [setTemplateDir()](./api-functions/api-set-template-dir.md) — set the directories where templates are stored
|
||||||
|
- [templateExists()](./api-functions/api-template-exists.md) — checks whether the specified template exists
|
||||||
|
- [unregisterCacheResource()](./api-functions/api-unregister-cacheresource.md) — dynamically unregister a CacheResource plugin
|
||||||
|
- [unregisterFilter()](./api-functions/api-unregister-filter.md) — dynamically unregister a filter
|
||||||
|
- [unregisterPlugin()](./api-functions/api-unregister-plugin.md) — dynamically unregister plugins
|
||||||
|
- [unregisterObject()](./api-functions/api-unregister-object.md) — dynamically unregister an object
|
||||||
|
- [unregisterResource()](./api-functions/api-unregister-resource.md) — dynamically unregister a resource plugin
|
||||||
|
- [testInstall()](./api-functions/api-test-install.md) — checks Smarty installation
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> See
|
> See
|
||||||
> [`Changing settings by template`](#advanced.features.template.settings)
|
> [`Changing settings by template`](./advanced-features/advanced-features-template-settings.md)
|
||||||
> section for how to use the functions for individual templates.
|
> section for how to use the functions for individual templates.
|
||||||
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-ADD-CONFIG-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-ADD-PLUGINS-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-ADD-TEMPLATE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-APPEND
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-APPEND-BY-REF
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-ASSIGN
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-ASSIGN-BY-REF
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CLEAR-ALL-ASSIGN
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CLEAR-ALL-CACHE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CLEAR-ASSIGN
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CLEAR-CACHE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CLEAR-COMPILED-TPL
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CLEAR-CONFIG
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-COMPILE-ALL-CONFIG
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-COMPILE-ALL-TEMPLATES
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CONFIG-LOAD
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CREATE-DATA
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-CREATE-TEMPLATE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-DISABLE-SECURITY
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-DISPLAY
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-ENABLE-SECURITY
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-FETCH
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-CACHE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-COMPILE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-CONFIG-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-CONFIG-VARS
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-PLUGINS-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-REGISTERED-OBJECT
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-TAGS
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-TEMPLATE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-GET-TEMPLATE-VARS
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-IS-CACHED
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-LOAD-FILTER
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-MUTE-EXPECTED-ERRORS
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-CACHERESOURCE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-CLASS
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-DEFAULT-PLUGIN-HANDLER
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-FILTER
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-PLUGIN
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-OBJECT
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-REGISTER-RESOURCE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-SET-CACHE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-SET-COMPILE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-SET-CONFIG-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-SET-PLUGINS-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-SET-TEMPLATE-DIR
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-TEMPLATE-EXISTS
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-UNREGISTER-CACHERESOURCE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-UNREGISTER-FILTER
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-UNREGISTER-PLUGIN
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-UNREGISTER-OBJECT
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-UNREGISTER-RESOURCE
|
|
||||||
PROGRAMMERS.API-FUNCTIONS.API-TEST-INSTALL
|
|
||||||
|
@@ -4,6 +4,50 @@ Smarty Class Variables {#api.variables}
|
|||||||
These are all of the available Smarty class variables. You can access
|
These are all of the available Smarty class variables. You can access
|
||||||
them directly, or use the corresponding setter/getter methods.
|
them directly, or use the corresponding setter/getter methods.
|
||||||
|
|
||||||
|
- [$allow_php_templates](./api-variables/variable-allow-php-templates.md)
|
||||||
|
- [$auto_literal](./api-variables/variable-auto-literal.md)
|
||||||
|
- [$autoload_filters](./api-variables/variable-autoload-filters.md)
|
||||||
|
- [$cache_dir](./api-variables/variable-cache-dir.md)
|
||||||
|
- [$cache_id](./api-variables/variable-cache-id.md)
|
||||||
|
- [$cache_lifetime](./api-variables/variable-cache-lifetime.md)
|
||||||
|
- [$cache_locking](./api-variables/variable-cache-locking.md)
|
||||||
|
- [$cache_modified_check](./api-variables/variable-cache-modified-check.md)
|
||||||
|
- [$caching](./api-variables/variable-caching.md)
|
||||||
|
- [$caching_type](./api-variables/variable-caching-type.md)
|
||||||
|
- [$compile_check](./api-variables/variable-compile-check.md)
|
||||||
|
- [$compile_dir](./api-variables/variable-compile-dir.md)
|
||||||
|
- [$compile_id](./api-variables/variable-compile-id.md)
|
||||||
|
- [$compile_locking](./api-variables/variable-compile-locking.md)
|
||||||
|
- [$compiler_class](./api-variables/variable-compiler-class.md)
|
||||||
|
- [$config_booleanize](./api-variables/variable-config-booleanize.md)
|
||||||
|
- [$config_dir](./api-variables/variable-config-dir.md)
|
||||||
|
- [$config_overwrite](./api-variables/variable-config-overwrite.md)
|
||||||
|
- [$config_read_hidden](./api-variables/variable-config-read-hidden.md)
|
||||||
|
- [$debug_tpl](./api-variables/variable-debug-template.md)
|
||||||
|
- [$debugging](./api-variables/variable-debugging.md)
|
||||||
|
- [$debugging_ctrl](./api-variables/variable-debugging-ctrl.md)
|
||||||
|
- [$default_config_type](./api-variables/variable-default-config-type.md)
|
||||||
|
- [$default_modifiers](./api-variables/variable-default-modifiers.md)
|
||||||
|
- [$default_resource_type](./api-variables/variable-default-resource-type.md)
|
||||||
|
- [$default_config_handler_func](./api-variables/variable-default-config-handler-func.md)
|
||||||
|
- [$default_template_handler_func](./api-variables/variable-default-template-handler-func.md)
|
||||||
|
- [$direct_access_security](./api-variables/variable-direct-access-security.md)
|
||||||
|
- [$error_reporting](./api-variables/variable-error-reporting.md)
|
||||||
|
- [$escape_html](./api-variables/variable-escape-html.md)
|
||||||
|
- [$force_cache](./api-variables/variable-force-cache.md)
|
||||||
|
- [$force_compile](./api-variables/variable-force-compile.md)
|
||||||
|
- [$left_delimiter](./api-variables/variable-left-delimiter.md)
|
||||||
|
- [$locking_timeout](./api-variables/variable-locking-timeout.md)
|
||||||
|
- [$merge_compiled_includes](./api-variables/variable-merge-compiled-includes.md)
|
||||||
|
- [$php_handling](./api-variables/variable-php-handling.md)
|
||||||
|
- [$plugins_dir](./api-variables/variable-plugins-dir.md)
|
||||||
|
- [$right_delimiter](./api-variables/variable-right-delimiter.md)
|
||||||
|
- [$smarty_debug_id](./api-variables/variable-smarty-debug-id.md)
|
||||||
|
- [$template_dir](./api-variables/variable-template-dir.md)
|
||||||
|
- [$trusted_dir](./api-variables/variable-trusted-dir.md)
|
||||||
|
- [$use_include_path](./api-variables/variable-use-include-path.md)
|
||||||
|
- [$use_sub_dirs](./api-variables/variable-use-sub-dirs.md)
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> All class variables have magic setter/getter methods available.
|
> All class variables have magic setter/getter methods available.
|
||||||
@@ -15,50 +59,6 @@ them directly, or use the corresponding setter/getter methods.
|
|||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> See
|
> See
|
||||||
> [`Changing settings by template`](#advanced.features.template.settings)
|
> [`Changing settings by template`](./advanced-features/advanced-features-template-settings.md)
|
||||||
> section for how to change Smarty class variables for individual
|
> section for how to change Smarty class variables for individual
|
||||||
> templates.
|
> templates.
|
||||||
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-ALLOW-PHP-TEMPLATES
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-AUTO-LITERAL
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-AUTOLOAD-FILTERS
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHE-DIR
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHE-ID
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHE-LIFETIME
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHE-LOCKING
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHE-MODIFIED-CHECK
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHING
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CACHING-TYPE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-COMPILE-CHECK
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-COMPILE-DIR
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-COMPILE-ID
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-COMPILE-LOCKING
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-COMPILER-CLASS
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CONFIG-BOOLEANIZE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CONFIG-DIR
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CONFIG-OVERWRITE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-CONFIG-READ-HIDDEN
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEBUG-TEMPLATE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEBUGGING
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEBUGGING-CTRL
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEFAULT-CONFIG-TYPE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEFAULT-MODIFIERS
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEFAULT-RESOURCE-TYPE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEFAULT-CONFIG-HANDLER-FUNC
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DEFAULT-TEMPLATE-HANDLER-FUNC
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-DIRECT-ACCESS-SECURITY
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-ERROR-REPORTING
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-ESCAPE-HTML
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-FORCE-CACHE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-FORCE-COMPILE
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-LEFT-DELIMITER
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-LOCKING-TIMEOUT
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-MERGE-COMPILED-INCLUDES
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-PHP-HANDLING
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-PLUGINS-DIR
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-RIGHT-DELIMITER
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-SMARTY-DEBUG-ID
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-TEMPLATE-DIR
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-TRUSTED-DIR
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-USE-INCLUDE-PATH
|
|
||||||
PROGRAMMERS.API-VARIABLES.VARIABLE-USE-SUB-DIRS
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
Caching
|
Caching
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Caching is used to speed up a call to [`display()`](#api.display) or
|
Caching is used to speed up a call to [`display()`](./api-functions/api-display.md) or
|
||||||
[`fetch()`](#api.fetch) by saving its output to a file. If a cached
|
[`fetch()`](./api-functions/api-fetch.md) by saving its output to a file. If a cached
|
||||||
version of the call is available, that is displayed instead of
|
version of the call is available, that is displayed instead of
|
||||||
regenerating the output. Caching can speed things up tremendously,
|
regenerating the output. Caching can speed things up tremendously,
|
||||||
especially templates with longer computation times. Since the output of
|
especially templates with longer computation times. Since the output of
|
||||||
[`display()`](#api.display) or [`fetch()`](#api.fetch) is cached, one
|
[`display()`](./api-functions/api-display.md) or [`fetch()`](./api-functions/api-fetch.md) is cached, one
|
||||||
cache file could conceivably be made up of several template files,
|
cache file could conceivably be made up of several template files,
|
||||||
config files, etc.
|
config files, etc.
|
||||||
|
|
||||||
@@ -17,7 +17,8 @@ might work well to cache this page for an hour or more. On the other
|
|||||||
hand, if you are displaying a page with a timetable containing new
|
hand, if you are displaying a page with a timetable containing new
|
||||||
information by the minute, it would not make sense to cache this page.
|
information by the minute, it would not make sense to cache this page.
|
||||||
|
|
||||||
PROGRAMMERS.CACHING.CACHING-SETTING-UP
|
## Table of contents
|
||||||
PROGRAMMERS.CACHING.CACHING-MULTIPLE-CACHES
|
- [Setting Up Caching](./caching/caching-setting-up.md)
|
||||||
PROGRAMMERS.CACHING.CACHING-GROUPS PROGRAMMERS.CACHING.CACHING-CACHEABLE
|
- [Multiple Caches Per Page](./caching/caching-multiple-caches.md)
|
||||||
PROGRAMMERS.CACHING.CACHING-CUSTOM
|
- [Controlling Cacheability of Output](./caching/caching-groups.md)
|
||||||
|
- [Custom Cache Implementation](./caching/caching-custom.md)
|
||||||
|
@@ -7,7 +7,7 @@ Charset Encoding {#charset.encoding}
|
|||||||
There are a variety of encodings for textual data, ISO-8859-1 (Latin1)
|
There are a variety of encodings for textual data, ISO-8859-1 (Latin1)
|
||||||
and UTF-8 being the most popular. Unless specified otherwise with the
|
and UTF-8 being the most popular. Unless specified otherwise with the
|
||||||
`SMARTY_RESOURCE_CHAR_SET` constant, Smarty recognizes `UTF-8` as the
|
`SMARTY_RESOURCE_CHAR_SET` constant, Smarty recognizes `UTF-8` as the
|
||||||
internal charset if [Multibyte String](&url.php-manual;mbstring) is
|
internal charset if [Multibyte String](https://www.php.net/mbstring) is
|
||||||
available, `ISO-8859-1` if not.
|
available, `ISO-8859-1` if not.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
@@ -27,7 +27,7 @@ available, `ISO-8859-1` if not.
|
|||||||
>
|
>
|
||||||
> Smarty\'s internals and core plugins are truly UTF-8 compatible since
|
> Smarty\'s internals and core plugins are truly UTF-8 compatible since
|
||||||
> Smarty 3.1. To achieve unicode compatibility, the [Multibyte
|
> Smarty 3.1. To achieve unicode compatibility, the [Multibyte
|
||||||
> String](&url.php-manual;mbstring) PECL is required. Unless your PHP
|
> String](https://www.php.net/mbstring) PECL is required. Unless your PHP
|
||||||
> environment offers this package, Smarty will not be able to offer
|
> environment offers this package, Smarty will not be able to offer
|
||||||
> full-scale UTF-8 compatibility.
|
> full-scale UTF-8 compatibility.
|
||||||
|
|
||||||
|
@@ -1,6 +1,20 @@
|
|||||||
Extending Smarty With Plugins {#plugins}
|
Extending Smarty With Plugins {#plugins}
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
|
||||||
|
- [How Plugins Work](./plugins/plugins-howto.md)
|
||||||
|
- [Naming Conventions](./plugins/plugins-naming-conventions.md)
|
||||||
|
- [Writing Plugins](./plugins/plugins-writing.md)
|
||||||
|
- [Template Functions](./plugins/plugins-functions.md)
|
||||||
|
- [Modifiers](./plugins/plugins-modifiers.md)
|
||||||
|
- [Block Functions](./plugins/plugins-block-functions.md)
|
||||||
|
- [Compiler Functions](./plugins/plugins-compiler-functions.md)
|
||||||
|
- [Prefilters/Postfilters](./plugins/plugins-prefilters-postfilters.md)
|
||||||
|
- [Output Filters](./plugins/plugins-outputfilters.md)
|
||||||
|
- [Resources](./plugins/plugins-resources.md)
|
||||||
|
- [Inserts](./plugins/plugins-inserts.md)
|
||||||
|
|
||||||
Version 2.0 introduced the plugin architecture that is used for almost
|
Version 2.0 introduced the plugin architecture that is used for almost
|
||||||
all the customizable functionality of Smarty. This includes:
|
all the customizable functionality of Smarty. This includes:
|
||||||
|
|
||||||
@@ -28,15 +42,3 @@ If you did not use the API but instead modified the class variables
|
|||||||
`$custom_funcs`, `$custom_mods`, and other ones directly, then you will
|
`$custom_funcs`, `$custom_mods`, and other ones directly, then you will
|
||||||
need to adjust your scripts to either use the API or convert your custom
|
need to adjust your scripts to either use the API or convert your custom
|
||||||
functionality into plugins.
|
functionality into plugins.
|
||||||
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-HOWTO
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-NAMING-CONVENTIONS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-WRITING
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-FUNCTIONS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-MODIFIERS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-BLOCK-FUNCTIONS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-COMPILER-FUNCTIONS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-PREFILTERS-POSTFILTERS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-OUTPUTFILTERS
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-RESOURCES
|
|
||||||
PROGRAMMERS.PLUGINS.PLUGINS-INSERTS
|
|
||||||
|
@@ -2,15 +2,18 @@ Resources
|
|||||||
=========
|
=========
|
||||||
|
|
||||||
The templates may come from a variety of sources. When you
|
The templates may come from a variety of sources. When you
|
||||||
[`display()`](#api.display) or [`fetch()`](#api.fetch) a template, or
|
[`display()`](./api-functions/api-display.md) or [`fetch()`](./api-functions/api-fetch.md) a template, or
|
||||||
when you include a template from within another template, you supply a
|
when you include a template from within another template, you supply a
|
||||||
resource type, followed by the appropriate path and template name. If a
|
resource type, followed by the appropriate path and template name. If a
|
||||||
resource is not explicitly given, the value of
|
resource is not explicitly given, the value of
|
||||||
[`$default_resource_type`](#variable.default.resource.type) (default:
|
[`$default_resource_type`](./api-variables/variable-default-resource-type.md) (default:
|
||||||
\"file\") is assumed.
|
\"file\") is assumed.
|
||||||
|
|
||||||
PROGRAMMERS.RESOURCES.RESOURCES-FILE
|
## Table of contents
|
||||||
PROGRAMMERS.RESOURCES.RESOURCES-STRING
|
|
||||||
PROGRAMMERS.RESOURCES.RESOURCES-STREAMS
|
- [File Template Resources](./resources/resources-file.md)
|
||||||
PROGRAMMERS.RESOURCES.RESOURCES-EXTENDS
|
- [String Template Resources](./resources/resources-string.md)
|
||||||
PROGRAMMERS.RESOURCES.RESOURCES-CUSTOM
|
- [Stream Template Resources](./resources/resources-streams.md)
|
||||||
|
- [Extends Template Resources](./resources/resources-extends.md)
|
||||||
|
- [Custom Template Resources](./resources/resources-custom.md)
|
||||||
|
|
||||||
|
@@ -23,5 +23,5 @@ to determine the appropriate value automatically. If defined, the path
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
See also [`$smarty.const`](#language.variables.smarty.const) and
|
See also [`$smarty.const`](../designers/language-variables/language-variables-smarty.md) and
|
||||||
[`$php_handling constants`](#variable.php.handling)
|
[`$php_handling constants`](./api-variables/variable-php-handling.md)
|
||||||
|
Reference in New Issue
Block a user