mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
added docs for php-functions as modifiers
This commit is contained in:
@@ -490,6 +490,27 @@ Topic: {$topic|truncate:40:"..."}
|
|||||||
<literal>{$articleTitle|@count}</literal> (this will print out the number of
|
<literal>{$articleTitle|@count}</literal> (this will print out the number of
|
||||||
elements in the $articleTitle array.)
|
elements in the $articleTitle array.)
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
Modifiers can be autoloaded from your <link
|
||||||
|
linkend="variable.plugins.dir">$plugins_dir</link> (also see:
|
||||||
|
<link linkend="plugins.naming.conventions">Naming
|
||||||
|
Conventions</link>) or can be registered explicitely (see: <link
|
||||||
|
linkend="api.register.modifier">register_modifier</link>). Additionally
|
||||||
|
all php-functions can be used as modifiers implicitely. (The
|
||||||
|
<literal>@count</literal>-example above actually uses php's
|
||||||
|
count-function and not a smarty-modifier). Using php-functions
|
||||||
|
as modifiers has two little pitfalls: First: Sometimes the order
|
||||||
|
of the function-parameters is not the desirable one
|
||||||
|
(<literal>{"%2.f"|sprintf:$float}</literal> actually works, but
|
||||||
|
asks for the more intuitive <literal>{For example:
|
||||||
|
$float|string_format:"%2.f"}</literal> that is provided by the
|
||||||
|
Smarty distribution). Second: with <link
|
||||||
|
linkend="variable.security">$security</link> turned on all
|
||||||
|
php-functions that are to be used as modifiers have to be
|
||||||
|
declared trusted in the <link
|
||||||
|
linkend="variable.security.settings">
|
||||||
|
$security_settings['MODIFIER_FUNCS']</link>-array.
|
||||||
|
</para>
|
||||||
|
|
||||||
<sect1 id="language.modifier.capitalize">
|
<sect1 id="language.modifier.capitalize">
|
||||||
<title>capitalize</title>
|
<title>capitalize</title>
|
||||||
|
@@ -457,7 +457,6 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
|
|||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="variable.request.use.auto.globals">
|
<sect1 id="variable.request.use.auto.globals">
|
||||||
<title>$request_use_auto_globals</title>
|
<title>$request_use_auto_globals</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Specifies if Smarty should use php's $HTTP_*_VARS[]
|
Specifies if Smarty should use php's $HTTP_*_VARS[]
|
||||||
($request_use_auto_globals=false which is the default value) or
|
($request_use_auto_globals=false which is the default value) or
|
||||||
@@ -467,7 +466,6 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
|
|||||||
linkend="variable.request.vars.order">variable.request.vars.order
|
linkend="variable.request.vars.order">variable.request.vars.order
|
||||||
</link> has no effect but php's configuration value
|
</link> has no effect but php's configuration value
|
||||||
<literal>gpc_order</literal> is used.
|
<literal>gpc_order</literal> is used.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="variable.compile.id">
|
<sect1 id="variable.compile.id">
|
||||||
@@ -2495,9 +2493,10 @@ $smarty->default_template_handler_func = 'make_template';
|
|||||||
depends on the order in which they are registered or loaded.
|
depends on the order in which they are registered or loaded.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
There is only one plugins directory (for performance reasons). To
|
The <link linkend="variable.plugins.dir">plugins directory</link>
|
||||||
install a plugin, simply place it in the directory and Smarty will use
|
can be a string containing a path or an array containing multiple
|
||||||
it automatically.
|
paths. To install a plugin, simply place it in one of the
|
||||||
|
directories and Smarty will use it automatically.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user