mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
Lots of additional cross linking by Peter.
This commit is contained in:
@@ -4,16 +4,24 @@
|
|||||||
<title>Debugging Console</title>
|
<title>Debugging Console</title>
|
||||||
<para>
|
<para>
|
||||||
There is a debugging console included with Smarty. The console informs you
|
There is a debugging console included with Smarty. The console informs you
|
||||||
of all the included templates, assigned variables and config file variables
|
of all the
|
||||||
|
<link linkend="language.function.include">included</link> templates,
|
||||||
|
<link linkend="api.assign">assigned</link> variables and
|
||||||
|
<link linkend="language.config.variables">config</link>
|
||||||
|
file variables
|
||||||
for the current invocation of the template. A template named "debug.tpl" is
|
for the current invocation of the template. A template named "debug.tpl" is
|
||||||
included with the distribution of Smarty which controls the formatting of
|
included with the distribution of Smarty which controls the formatting of
|
||||||
the console. Set $debugging to true in Smarty, and if needed set $debug_tpl
|
the console. Set
|
||||||
to the template resource path for debug.tpl (this is in SMARTY_DIR by
|
<link linkend="variable.debugging">$debugging</link> to true in Smarty, and if needed set
|
||||||
|
<link linkend="variable.debug.tpl">$debug_tpl</link>
|
||||||
|
to the template resource path for debug.tpl (this is in
|
||||||
|
<link linkend="constant.smarty.dir">SMARTY_DIR</link> by
|
||||||
default.) When you load the page, a javascript console window should pop up
|
default.) When you load the page, a javascript console window should pop up
|
||||||
and give you the names of all the included templates and assigned variables
|
and give you the names of all the included templates and assigned variables
|
||||||
for the current page. To see the available variables for a particular
|
for the current page. To see the available variables for a particular
|
||||||
templates, see the <link linkend="language.function.debug">{debug}</link>
|
templates, see the <link linkend="language.function.debug">{debug}</link>
|
||||||
template function. To disable the debugging console, set $debugging to
|
template function. To disable the debugging console, set
|
||||||
|
<link linkend="variable.debugging">$debugging</link> to
|
||||||
false. You can also temporarily turn on the debugging console by putting
|
false. You can also temporarily turn on the debugging console by putting
|
||||||
SMARTY_DEBUG in the URL if you enable this option with <link
|
SMARTY_DEBUG in the URL if you enable this option with <link
|
||||||
linkend="variable.debugging.ctrl">$debugging_ctrl</link>.
|
linkend="variable.debugging.ctrl">$debugging_ctrl</link>.
|
||||||
@@ -21,8 +29,11 @@
|
|||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
The debugging console does not work when you use the fetch()
|
The debugging console does not work when you use the
|
||||||
API, only when using display(). It is a set of javascript statements added
|
<link linkend="api.fetch">fetch()</link>
|
||||||
|
API, only when using
|
||||||
|
<link linkend="api.display">display()</link>.
|
||||||
|
It is a set of javascript statements added
|
||||||
to the very bottom of the generated template. If you do not like javascript,
|
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 however you like.
|
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 included in the output of
|
Debug data is not cached and debug.tpl info is not included in the output of
|
||||||
@@ -57,3 +68,5 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,7 +40,9 @@ pass=foobar
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Values of config file variables can be in quotes, but not necessary.
|
Values of
|
||||||
|
<link linkend="language.config.variables">config file variables</link>
|
||||||
|
can be in quotes, but not necessary.
|
||||||
You can use either single or double quotes. If you have a value that
|
You can use either single or double quotes. If you have a value that
|
||||||
spans more than one line, enclose the entire value with triple quotes
|
spans more than one line, enclose the entire value with triple quotes
|
||||||
("""). You can put comments into config files by any syntax that is not
|
("""). You can put comments into config files by any syntax that is not
|
||||||
@@ -56,11 +58,16 @@ pass=foobar
|
|||||||
section is loaded, then the global variables and the variables from that
|
section is loaded, then the global variables and the variables from that
|
||||||
section are also loaded. If a variable exists both as a global and in a
|
section are also loaded. If a variable exists both as a global and in a
|
||||||
section, the section variable is used. If you name two variables the
|
section, the section variable is used. If you name two variables the
|
||||||
same within a section, the last one will be used.
|
same within a section, the last one will be used. (see
|
||||||
|
<link linkend="variable.config.overwrite">$config_overwrite</link>)
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Config files are loaded into templates with the built-in function
|
Config files are loaded into templates with the built-in function
|
||||||
<command>config_load</command>.
|
<link
|
||||||
|
linkend="language.function.config.load"><command>{config_load}</command></link>
|
||||||
|
, and
|
||||||
|
<link
|
||||||
|
linkend="api.config.load"><command>config_load()</command></link>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You can hide variables or entire sections by prepending the variable
|
You can hide variables or entire sections by prepending the variable
|
||||||
|
@@ -20,8 +20,7 @@
|
|||||||
Similar to HTML entity usage, you can use <link
|
Similar to HTML entity usage, you can use <link
|
||||||
linkend="language.function.ldelim">{ldelim}</link>,<link
|
linkend="language.function.ldelim">{ldelim}</link>,<link
|
||||||
linkend="language.function.ldelim">{rdelim}</link> or <link
|
linkend="language.function.ldelim">{rdelim}</link> or <link
|
||||||
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>,<link
|
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>
|
||||||
linkend="language.variables.smarty.rdelim">{$smarty.rdelim}</link>
|
|
||||||
to display the current delimiters.
|
to display the current delimiters.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -60,6 +59,9 @@ dosomething();
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="language.modifier.escape">escape modifier</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -32,14 +32,14 @@
|
|||||||
and <link linkend="language.custom.functions">custom functions</link>
|
and <link linkend="language.custom.functions">custom functions</link>
|
||||||
have the same syntax in the templates. Built-in functions are the
|
have the same syntax in the templates. Built-in functions are the
|
||||||
inner workings of Smarty, such as
|
inner workings of Smarty, such as
|
||||||
<link linkend="language.function.if"><command>if</command></link>,
|
<link linkend="language.function.if">{if}</link>,
|
||||||
<link linkend="language.function.section"><command>section</command></link> and
|
<link linkend="language.function.section">{section}</link> and
|
||||||
<link linkend="language.function.strip"><command>strip</command></link>.
|
<link linkend="language.function.strip">{strip}</link>.
|
||||||
They cannot be modified. Custom functions are
|
They cannot be modified. Custom functions are
|
||||||
additional functions implemented via <link linkend="plugins">plugins</link>.
|
additional functions implemented via <link linkend="plugins">plugins</link>.
|
||||||
They can be modified to your liking, or you can add new ones.
|
They can be modified to your liking, or you can add new ones.
|
||||||
<link linkend="language.function.html.options"><command>html_options</command></link> and
|
<link linkend="language.function.html.options">{html_options}</link> and
|
||||||
<link linkend="language.function.html.select.date"><command>html_select_date</command></link>
|
<link linkend="language.function.html.select.date">{html_select_date}</link>
|
||||||
are examples of custom functions.
|
are examples of custom functions.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -3,11 +3,15 @@
|
|||||||
<sect1 id="language.syntax.quotes">
|
<sect1 id="language.syntax.quotes">
|
||||||
<title>Embedding Vars in Double Quotes</title>
|
<title>Embedding Vars in Double Quotes</title>
|
||||||
<para>
|
<para>
|
||||||
Smarty will recognize assigned variables embedded in double quotes so long as
|
Smarty will recognize <link
|
||||||
|
linkend="api.assign">assigned</link>
|
||||||
|
<link linkend="language.syntax.variables">variables</link>
|
||||||
|
embedded in double quotes so long as
|
||||||
the variables contain only numbers, letters, underscores and brackets [].
|
the variables contain only numbers, letters, underscores and brackets [].
|
||||||
With any other characters (period, object reference, etc.) the variable must
|
With any other characters (period, object reference, etc.) the variable must
|
||||||
be surrounded by backticks. You cannot embed modifiers, they must always be
|
be surrounded by backticks. You cannot embed
|
||||||
applied outside of quotes.
|
<link linkend="language.modifiers">modifiers</link>,
|
||||||
|
they must always be applied outside of quotes.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>embedded quotes syntax</title>
|
<title>embedded quotes syntax</title>
|
||||||
|
@@ -4,10 +4,14 @@
|
|||||||
<title>Variables</title>
|
<title>Variables</title>
|
||||||
<para>
|
<para>
|
||||||
Template variables start with a dollar sign. They can contain numbers,
|
Template variables start with a dollar sign. They can contain numbers,
|
||||||
letters and underscores, much like a PHP variable. You can reference arrays
|
letters and underscores, much like a
|
||||||
|
<ulink url="&url.php-manual;language.variables">PHP variable</ulink>.
|
||||||
|
You can reference arrays
|
||||||
that are indexed numerically or non-numerically. You can also reference
|
that are indexed numerically or non-numerically. You can also reference
|
||||||
object properties and methods. Config file variables are an exception to the
|
object properties and methods.
|
||||||
dollar sign syntax. They can be referenced with surrounding hashmarks, or
|
<link linkend="language.config.variables">Config file variables</link>
|
||||||
|
are an exception to the dollar sign syntax.
|
||||||
|
They can be referenced with surrounding #hashmarks#, or
|
||||||
with the special
|
with the special
|
||||||
<link linkend="language.variables.smarty.config">$smarty.config</link> variable.
|
<link linkend="language.variables.smarty.config">$smarty.config</link> variable.
|
||||||
</para>
|
</para>
|
||||||
|
@@ -59,7 +59,9 @@
|
|||||||
<para>
|
<para>
|
||||||
Be careful when capturing <link
|
Be careful when capturing <link
|
||||||
linkend="language.function.insert"><command>insert</command></link>
|
linkend="language.function.insert"><command>insert</command></link>
|
||||||
output. If you have caching turned on and you have
|
output. If you have
|
||||||
|
<link linkend="caching">caching</link>
|
||||||
|
turned on and you have
|
||||||
<command>insert</command> commands that you expect to run
|
<command>insert</command> commands that you expect to run
|
||||||
within cached content, do not capture this content.
|
within cached content, do not capture this content.
|
||||||
</para>
|
</para>
|
||||||
@@ -85,7 +87,8 @@
|
|||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="language.function.assign">assign </link>.
|
See also <link linkend="language.function.eval">{eval}</link>
|
||||||
|
and <link linkend="language.function.assign">{assign}</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -64,7 +64,9 @@
|
|||||||
linkend="variable.trusted.dir">$trusted_dir</link> path.
|
linkend="variable.trusted.dir">$trusted_dir</link> path.
|
||||||
The include_php tag must have the attribute
|
The include_php tag must have the attribute
|
||||||
"file", which contains the path to the included php file, either
|
"file", which contains the path to the included php file, either
|
||||||
relative to $trusted_dir, or an absolute path.
|
relative to
|
||||||
|
<link linkend="variable.trusted.dir">$trusted_dir</link>,
|
||||||
|
or an absolute path.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
include_php is a nice way to handle <link
|
include_php is a nice way to handle <link
|
||||||
@@ -126,6 +128,16 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.include">{include}</link>,
|
||||||
|
<link linkend="language.function.php">{php}</link>,
|
||||||
|
<link linkend="language.function.capture">{capture}</link>,
|
||||||
|
<link linkend="template.resources">Template Resources</link> and
|
||||||
|
<link linkend="tips.componentized.templates">Componentized Templates</link>
|
||||||
|
</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
"{" or "}". You can also use <link
|
"{" or "}". You can also use <link
|
||||||
linkend="language.function.literal">{literal}{/literal}</link> to escape
|
linkend="language.function.literal">{literal}{/literal}</link> to escape
|
||||||
blocks of text.
|
blocks of text.
|
||||||
See also <link linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>
|
See also <link
|
||||||
and <link linkend="language.variables.smarty.rdelim">{$smarty.rdelim}</link>
|
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>ldelim, rdelim</title>
|
<title>ldelim, rdelim</title>
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
assign is used for assigning template variables during the execution
|
{assign} is used for assigning template variables during the execution
|
||||||
of the template.
|
of the template.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -58,6 +58,11 @@ The value of $name is Bob.
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.assign">assign()</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -37,6 +37,9 @@
|
|||||||
are in use. But, you see all the currently available variables
|
are in use. But, you see all the currently available variables
|
||||||
within the scope of this template.
|
within the scope of this template.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="chapter.debugging.console">Debugging console</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -63,7 +63,7 @@
|
|||||||
If template security is turned on and you are
|
If template security is turned on and you are
|
||||||
fetching a file from the local file system, this will only allow
|
fetching a file from the local file system, this will only allow
|
||||||
files from within one of the defined secure directories.
|
files from within one of the defined secure directories.
|
||||||
($secure_dir)
|
(<link linkend="variable.secure.dir">$secure_dir</link>)
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
@@ -87,6 +87,9 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.fetch">api fetch()</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<para>
|
<para>
|
||||||
Variables that are assigned from PHP are referenced by preceding them with
|
Variables that are assigned from PHP are referenced by preceding them with
|
||||||
a dollar sign <literal>$</literal>. Variables assigned from within the
|
a dollar sign <literal>$</literal>. Variables assigned from within the
|
||||||
template with the <link linkend="language.function.assign">assign</link>
|
template with the <link linkend="language.function.assign">{assign}</link>
|
||||||
function are also displayed this way.
|
function are also displayed this way.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
|
@@ -3,7 +3,9 @@
|
|||||||
<sect1 id="language.config.variables">
|
<sect1 id="language.config.variables">
|
||||||
<title>Variables loaded from config files</title>
|
<title>Variables loaded from config files</title>
|
||||||
<para>
|
<para>
|
||||||
Variables that are loaded from the config files are referenced by
|
Variables that are loaded from the
|
||||||
|
<link linkend="config.files">config files</link>
|
||||||
|
are referenced by
|
||||||
enclosing them within hash marks (#), or with the smarty variable
|
enclosing them within hash marks (#), or with the smarty variable
|
||||||
<link
|
<link
|
||||||
linkend="language.variables.smarty.config">$smarty.config</link>.
|
linkend="language.variables.smarty.config">$smarty.config</link>.
|
||||||
@@ -89,7 +91,8 @@ rowBgColor = "#cccccc"
|
|||||||
after they are loaded in from a config file. This procedure is
|
after they are loaded in from a config file. This procedure is
|
||||||
explained later in this document under <link linkend="api.config.load"><command>config_load</command></link>.
|
explained later in this document under <link linkend="api.config.load"><command>config_load</command></link>.
|
||||||
</para>
|
</para>
|
||||||
<para>See also <link linkend="language.syntax.variables">Variables</link> and <link linkend="language.variables.smarty">$smarty reserved variables</link></para>
|
<para>See also <link linkend="language.syntax.variables">Variables</link> and <link linkend="language.variables.smarty">$smarty reserved
|
||||||
|
variables</link></para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -72,6 +72,8 @@
|
|||||||
<title>{$smarty.const}</title>
|
<title>{$smarty.const}</title>
|
||||||
<para>
|
<para>
|
||||||
You can access PHP constant values directly.
|
You can access PHP constant values directly.
|
||||||
|
See also <link
|
||||||
|
linkend="smarty.constants">smarty constants</link>
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>using {$smarty.const}</title>
|
<title>using {$smarty.const}</title>
|
||||||
@@ -95,19 +97,22 @@
|
|||||||
<sect2 id="language.variables.smarty.config">
|
<sect2 id="language.variables.smarty.config">
|
||||||
<title>{$smarty.config}</title>
|
<title>{$smarty.config}</title>
|
||||||
<para>
|
<para>
|
||||||
{$smarty} variable can be used to refer to loaded config variables.
|
{$smarty} variable can be used to refer to loaded
|
||||||
|
<link
|
||||||
|
linkend="language.config.variables">config variables</link>.
|
||||||
{$smarty.config.foo} is a synonym for {#foo#}. See the section on
|
{$smarty.config.foo} is a synonym for {#foo#}. See the section on
|
||||||
<link linkend="language.function.config.load">config_load</link> for an example.
|
<link
|
||||||
|
linkend="language.function.config.load">config_load</link> for an example.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="language.variables.smarty.loops">
|
<sect2 id="language.variables.smarty.loops">
|
||||||
<title>{$smarty.section}, {$smarty.foreach}</title>
|
<title>{$smarty.section}, {$smarty.foreach}</title>
|
||||||
<para>
|
<para>
|
||||||
{$smarty} variable can be used to refer to 'section' and
|
{$smarty} variable can be used to refer to
|
||||||
'foreach' loop properties. See docs for
|
<link linkend="language.function.section">'section'</link> and
|
||||||
<link linkend="language.function.section">section</link> and
|
<link linkend="language.function.foreach">'foreach'</link>
|
||||||
<link linkend="language.function.foreach">foreach</link>.
|
loop properties.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
@@ -125,20 +130,20 @@
|
|||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="language.variables.smarty.ldelim">
|
<sect2 id="language.variables.smarty.ldelim">
|
||||||
<title>{$smarty.ldelim}</title>
|
<title>{$smarty.ldelim}, {$smarty.rdelim}</title>
|
||||||
<para>
|
<para>
|
||||||
This variable is used for printing the left-delimiter value literally.
|
This variable is used for printing the left-delimiter and right-delimiter value literally.
|
||||||
See also <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
|
See <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.syntax.variables">Variables</link> and
|
||||||
|
<link linkend="language.config.variables">Config Variables</link>
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="language.variables.smarty.rdelim">
|
|
||||||
<title>{$smarty.rdelim}</title>
|
|
||||||
<para>
|
|
||||||
This variable is used for printing the right-delimiter value literally.
|
|
||||||
See also <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
|
|
||||||
</para>
|
|
||||||
<para>See also <link linkend="language.syntax.variables">Variables</link> and <link linkend="language.config.variables">Config Variables</link></para>
|
|
||||||
</sect2>
|
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
@@ -161,3 +166,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -85,42 +85,53 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Configurable template delimiter tag syntax, so you can use
|
Configurable template
|
||||||
|
<link linkend="variable.left.delimiter">delimiter tag</link>
|
||||||
|
syntax, so you can use
|
||||||
{}, {{}}, <!--{}-->, etc.
|
{}, {{}}, <!--{}-->, etc.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The if/elseif/else/endif constructs are passed to the
|
The <link
|
||||||
|
linkend="language.function.if">if/elseif/else/endif</link>
|
||||||
|
constructs are passed to the
|
||||||
PHP parser, so the {if ...} expression syntax can be as simple or as
|
PHP parser, so the {if ...} expression syntax can be as simple or as
|
||||||
complex as you like.
|
complex as you like.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Unlimited nesting of sections, ifs, etc. allowed.
|
Unlimited nesting of
|
||||||
|
<link linkend="language.function.section">sections</link>,
|
||||||
|
ifs, etc. allowed.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
It is possible to embed PHP code right in your template files, although
|
It is possible to
|
||||||
|
<link linkend="language.function.php">embed PHP code</link>
|
||||||
|
right in your template files, although
|
||||||
this may not be needed (nor recommended) since the engine is so
|
this may not be needed (nor recommended) since the engine is so
|
||||||
customizable.
|
customizable.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Built-in caching support
|
Built-in <link linkend="caching">caching</link> support
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Arbitrary template sources
|
Arbitrary <link
|
||||||
|
linkend="template.resources">template</link> sources
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Custom cache handling functions
|
Custom <link
|
||||||
|
linkend="section.template.cache.handler.func">cache handling</link>
|
||||||
|
functions
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -241,9 +252,16 @@ $smarty = new Smarty;
|
|||||||
<filename class="directory">templates_c</filename>, <filename
|
<filename class="directory">templates_c</filename>, <filename
|
||||||
class="directory">configs</filename> and <filename
|
class="directory">configs</filename> and <filename
|
||||||
class="directory">cache</filename>. Each of these are definable by the
|
class="directory">cache</filename>. Each of these are definable by the
|
||||||
Smarty class properties <varname>$template_dir</varname>,
|
Smarty class properties
|
||||||
<varname>$compile_dir</varname>, <varname>$config_dir</varname>, and
|
<link linkend="variable.template.dir">
|
||||||
<varname>$cache_dir</varname> respectively. It is highly recommended
|
<varname>$template_dir</varname></link>,
|
||||||
|
<link linkend="variable.compile.dir">
|
||||||
|
<varname>$compile_dir</varname></link>,
|
||||||
|
<link linkend="variable.config.dir">
|
||||||
|
<varname>$config_dir</varname></link>, and
|
||||||
|
<link linkend="variable.cache.dir">
|
||||||
|
<varname>$cache_dir</varname></link> respectively.
|
||||||
|
It is highly recommended
|
||||||
that you setup a separate set of these directories for each application
|
that you setup a separate set of these directories for each application
|
||||||
that will use Smarty.
|
that will use Smarty.
|
||||||
</para>
|
</para>
|
||||||
@@ -310,8 +328,12 @@ $smarty = new Smarty;
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Smarty will need write access to the <emphasis>$compile_dir</emphasis> and
|
Smarty will need write access to the
|
||||||
<emphasis>$cache_dir</emphasis>, so be sure the web server user can write
|
<link linkend="variable.compile.dir">
|
||||||
|
<emphasis>$compile_dir</emphasis></link> and
|
||||||
|
<link linkend="variable.cache.dir">
|
||||||
|
<emphasis>$cache_dir</emphasis></link>,
|
||||||
|
so be sure the web server user can write
|
||||||
to them. This is usually user "nobody" and group "nobody". For OS X users,
|
to them. This is usually user "nobody" and group "nobody". For OS X users,
|
||||||
the default is user "www" and group "www". If you are using Apache, you can
|
the default is user "www" and group "www". If you are using Apache, you can
|
||||||
look in your httpd.conf file (usually in "/usr/local/apache/conf/") to see
|
look in your httpd.conf file (usually in "/usr/local/apache/conf/") to see
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
<para>
|
<para>
|
||||||
The <parameter>merge</parameter> parameter respects array keys, so if
|
The <parameter>merge</parameter> parameter respects array keys, so if
|
||||||
you merge two numerically indexed arrays, they may overwrite each other
|
you merge two numerically indexed arrays, they may overwrite each other
|
||||||
or result in non-sequential keys. This is unlike the array_merge() function
|
or result in non-sequential keys. This is unlike the
|
||||||
|
<ulink url="&url.php-manual;array_merge">array_merge()</ulink> function
|
||||||
of PHP which wipes out numerical keys and renumbers them.
|
of PHP which wipes out numerical keys and renumbers them.
|
||||||
</para>
|
</para>
|
||||||
</note>'>
|
</note>'>
|
||||||
@@ -15,10 +16,13 @@
|
|||||||
This is in the event that you want to compile different versions of
|
This is in the event that you want to compile different versions of
|
||||||
the same template, such as having separate templates compiled
|
the same template, such as having separate templates compiled
|
||||||
for different languages. Another use for compile_id is when you
|
for different languages. Another use for compile_id is when you
|
||||||
use more than one $template_dir but only one $compile_dir. Set
|
use more than one
|
||||||
a separate <parameter>compile_id</parameter> for each $template_dir, otherwise
|
<link linkend="variable.template.dir">$template_dir</link>
|
||||||
|
but only one
|
||||||
|
<link linkend="variable.compile.dir">$compile_dir</link>.
|
||||||
|
Set a separate <parameter>$compile_id</parameter> for each
|
||||||
|
<link linkend="variable.template.dir">$template_dir</link>, otherwise
|
||||||
templates of the same name will overwrite each other. You can
|
templates of the same name will overwrite each other. You can
|
||||||
also set the <link
|
also set the $compile_id variable once
|
||||||
linkend="variable.compile.id">$compile_id</link> variable once
|
|
||||||
instead of passing this to each call to this function.
|
instead of passing this to each call to this function.
|
||||||
</para>'>
|
</para>'>
|
||||||
|
@@ -4,18 +4,22 @@
|
|||||||
<title>Objects</title>
|
<title>Objects</title>
|
||||||
<para>
|
<para>
|
||||||
Smarty allows access to PHP objects through the templates. There are
|
Smarty allows access to PHP objects through the templates. There are
|
||||||
two ways to access them. One way is to register objects to the template,
|
two ways to access them. One way is to
|
||||||
|
<link linkend="api.register.object">register objects</link> to the template,
|
||||||
then use access them via syntax similar to custom functions. The other way
|
then use access them via syntax similar to custom functions. The other way
|
||||||
is to assign objects to the templates and access them much like any other
|
is to <link linkend="api.assign">assign objects</link>
|
||||||
|
to the templates and access them much like any other
|
||||||
assigned variable. The first method has a much nicer template syntax. It
|
assigned variable. The first method has a much nicer template syntax. It
|
||||||
is also more secure, as a registered object can be restricted to certain
|
is also more secure, as a registered object can be restricted to certain
|
||||||
methods or properties. However, a registered object cannot be looped over
|
methods or properties. However,
|
||||||
or assigned in arrays of objects, etc. The method you choose will be
|
<emphasis role="bold">a registered object cannot be looped over
|
||||||
|
or assigned in arrays of objects</emphasis>, etc. The method you choose will be
|
||||||
determined by your needs, but use the first method whenever possible to
|
determined by your needs, but use the first method whenever possible to
|
||||||
keep template syntax to a minimum.
|
keep template syntax to a minimum.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If security is enabled, no private methods or functions can be accessed
|
If <link linkend="variable.security">security is enabled</link>,
|
||||||
|
no private methods or functions can be accessed
|
||||||
(begininning with "_"). If a method and property of the same name exist,
|
(begininning with "_"). If a method and property of the same name exist,
|
||||||
the method will be used.
|
the method will be used.
|
||||||
</para>
|
</para>
|
||||||
@@ -25,7 +29,9 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
By default, parameters passed to objects through the templates are passed
|
By default, parameters passed to objects through the templates are passed
|
||||||
the same way custom functions get them. An associative array is passed
|
the same way
|
||||||
|
<link linkend="language.custom.functions">custom functions</link> get them.
|
||||||
|
An associative array is passed
|
||||||
as the first parameter, and the smarty object as the second. If you want
|
as the first parameter, and the smarty object as the second. If you want
|
||||||
the parameters passed one at a time for each argument like traditional
|
the parameters passed one at a time for each argument like traditional
|
||||||
object parameter passing, set the fourth registration parameter to false.
|
object parameter passing, set the fourth registration parameter to false.
|
||||||
|
@@ -3,7 +3,9 @@
|
|||||||
<sect1 id="template.resources">
|
<sect1 id="template.resources">
|
||||||
<title>Resources</title>
|
<title>Resources</title>
|
||||||
<para>
|
<para>
|
||||||
The templates may come from a variety of sources. When you display or fetch
|
The templates may come from a variety of sources. When you
|
||||||
|
<link linkend="api.display">display()</link> or
|
||||||
|
<link linkend="api.fetch">fetch()</link>
|
||||||
a template, or when you include a template from within another template,
|
a template, or when you include a template from within another template,
|
||||||
you supply a resource type, followed by the appropriate path and template
|
you supply a resource type, followed by the appropriate path and template
|
||||||
name. If a resource is not explicitly given the value of <link
|
name. If a resource is not explicitly given the value of <link
|
||||||
@@ -13,10 +15,12 @@
|
|||||||
<sect2 id="templates.from.template.dir">
|
<sect2 id="templates.from.template.dir">
|
||||||
<title>Templates from $template_dir</title>
|
<title>Templates from $template_dir</title>
|
||||||
<para>
|
<para>
|
||||||
Templates from the $template_dir do not require a template
|
Templates from the
|
||||||
|
<link linkend="variable.template.dir">$template_dir</link> do not require a template
|
||||||
resource, although you can use the file: resource for consistancy.
|
resource, although you can use the file: resource for consistancy.
|
||||||
Just supply the path to the template you want to use relative to
|
Just supply the path to the template you want to use relative to the
|
||||||
the $template_dir root directory.
|
<link linkend="variable.template.dir">$template_dir</link>
|
||||||
|
root directory.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>using templates from $template_dir</title>
|
<title>using templates from $template_dir</title>
|
||||||
@@ -38,7 +42,9 @@ $smarty->display("file:admin/menu.tpl"); // same as one above
|
|||||||
<sect2 id="templates.from.any.dir">
|
<sect2 id="templates.from.any.dir">
|
||||||
<title>Templates from any directory</title>
|
<title>Templates from any directory</title>
|
||||||
<para>
|
<para>
|
||||||
Templates outside of the $template_dir require the file: template
|
Templates outside of the
|
||||||
|
<link linkend="variable.template.dir">$template_dir</link>
|
||||||
|
require the file: template
|
||||||
resource type, followed by the absolute path and name of the
|
resource type, followed by the absolute path and name of the
|
||||||
template.
|
template.
|
||||||
</para>
|
</para>
|
||||||
@@ -200,7 +206,8 @@ $smarty->display("db:index.tpl");
|
|||||||
<?php
|
<?php
|
||||||
// put this function somewhere in your application
|
// put this function somewhere in your application
|
||||||
|
|
||||||
function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
|
function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp,
|
||||||
|
&$smarty_obj)
|
||||||
{
|
{
|
||||||
if( $resource_type == 'file' ) {
|
if( $resource_type == 'file' ) {
|
||||||
if ( ! is_readable ( $resource_name )) {
|
if ( ! is_readable ( $resource_name )) {
|
||||||
@@ -244,3 +251,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -14,9 +14,11 @@
|
|||||||
<methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam>
|
<methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam>
|
||||||
</methodsynopsis>
|
</methodsynopsis>
|
||||||
<para>
|
<para>
|
||||||
This is used to append values to the templates by reference.
|
This is used to
|
||||||
|
<link linkend="api.append">append</link> values to the templates by reference.
|
||||||
If you append a variable by reference then change its
|
If you append a variable by reference then change its
|
||||||
value, the appended value sees the change as well. For objects,
|
value, the appended value sees the change as well. For
|
||||||
|
<link linkend="advanced.features.objects">objects</link>,
|
||||||
append_by_ref() also avoids an in-memory copy of the appended object.
|
append_by_ref() also avoids an in-memory copy of the appended object.
|
||||||
See the PHP manual on variable referencing for an in-depth
|
See the PHP manual on variable referencing for an in-depth
|
||||||
explanation. If you pass the optional third parameter of true,
|
explanation. If you pass the optional third parameter of true,
|
||||||
@@ -29,12 +31,17 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
// appending name/value pairs
|
// appending name/value pairs
|
||||||
$smarty->append_by_ref("Name", $myname);
|
$smarty->append_by_ref('Name', $myname);
|
||||||
$smarty->append_by_ref("Address", $address);
|
$smarty->append_by_ref('Address', $address);
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.append">append()</link> and
|
||||||
|
<link linkend="api.assign">assign()</link>.
|
||||||
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -36,11 +36,17 @@ $smarty->append("Name", "Fred");
|
|||||||
$smarty->append("Address", $address);
|
$smarty->append("Address", $address);
|
||||||
|
|
||||||
// passing an associative array
|
// passing an associative array
|
||||||
$smarty->append(array("city" => "Lincoln", "state" => "Nebraska"));
|
$smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>See also
|
||||||
|
<link linkend="api.append.by.ref">append_by_ref()</link>,
|
||||||
|
<link linkend="api.assign">assign()</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.get.template.vars">get_template_vars()</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
<para>
|
<para>
|
||||||
This is used to assign values to the templates by reference.
|
This is used to assign values to the templates by reference.
|
||||||
If you assign a variable by reference then change its
|
If you assign a variable by reference then change its
|
||||||
value, the assigned value sees the change as well. For objects,
|
value, the assigned value sees the change as well. For
|
||||||
|
<link linkend="advanced.features.objects">objects</link>,
|
||||||
assign_by_ref() also avoids an in-memory copy of the assigned object.
|
assign_by_ref() also avoids an in-memory copy of the assigned object.
|
||||||
See the PHP manual on variable referencing for an in-depth
|
See the PHP manual on variable referencing for an in-depth
|
||||||
explanation.
|
explanation.
|
||||||
@@ -39,6 +40,13 @@ $smarty->assign_by_ref('Address', $address);
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.assign">assign()</link>,
|
||||||
|
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
|
||||||
|
<link linkend="api.append">append()</link>
|
||||||
|
and <link linkend="language.function.assign">{assign} function</link>
|
||||||
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
@@ -61,3 +69,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -31,11 +31,19 @@ $smarty->assign('Name', 'Fred');
|
|||||||
$smarty->assign('Address', $address);
|
$smarty->assign('Address', $address);
|
||||||
|
|
||||||
// passing an associative array
|
// passing an associative array
|
||||||
$smarty->assign(array("city" => "Lincoln", "state" => "Nebraska"));
|
$smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||||
|
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||||
|
<link linkend="api.append">append()</link>,
|
||||||
|
<link linkend="language.function.assign">{assign}</link>.
|
||||||
|
and
|
||||||
|
<link linkend="api.get.template.vars">get_template_vars()</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -25,6 +25,13 @@ $smarty->clear_all_assign();
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||||
|
<link linkend="api.clear.config">clear_config()</link>,
|
||||||
|
<link linkend="api.assign">assign()</link>
|
||||||
|
and <link linkend="api.append">append()</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
@@ -47,3 +54,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -27,6 +27,12 @@ $smarty->clear_all_cache();
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.clear.cache">clear_cache()</link>
|
||||||
|
and
|
||||||
|
<link linkend="caching">caching</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -29,6 +29,13 @@ $smarty->clear_assign(array("Name", "Address", "Zip"));
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
|
||||||
|
<link linkend="api.clear.config">clear_config()</link>,
|
||||||
|
<link linkend="api.assign">assign()</link>
|
||||||
|
and <link linkend="api.append">append()</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -40,6 +40,10 @@ $smarty->clear_cache("index.tpl", "CACHEID");
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="caching">caching</link>.
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -12,7 +12,9 @@
|
|||||||
<methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam>
|
<methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam>
|
||||||
</methodsynopsis>
|
</methodsynopsis>
|
||||||
<para>
|
<para>
|
||||||
This clears all assigned config variables. If a variable name is
|
This clears all assigned
|
||||||
|
<link linkend="language.config.variables">config variables</link>.
|
||||||
|
If a variable name is
|
||||||
supplied, only that variable is cleared.
|
supplied, only that variable is cleared.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -29,6 +31,15 @@ $smarty->clear_config('foobar');
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.config.variables">config variables</link>,
|
||||||
|
<link linkend="config.files">config files</link>,
|
||||||
|
<link linkend="language.function.config.load">{config_load}</link>,
|
||||||
|
<link linkend="api.config.load">config_load()</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.clear.assign">clear_assign()</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -13,20 +13,25 @@
|
|||||||
<methodparam choice="opt"><type>string</type><parameter>section</parameter></methodparam>
|
<methodparam choice="opt"><type>string</type><parameter>section</parameter></methodparam>
|
||||||
</methodsynopsis>
|
</methodsynopsis>
|
||||||
<para>
|
<para>
|
||||||
This loads config <parameter>file</parameter> data and assigns it to
|
This loads
|
||||||
|
<link linkend="config.files">config file</link>
|
||||||
|
data and assigns it to
|
||||||
the template. This works identical to the template <link
|
the template. This works identical to the template <link
|
||||||
linkend="language.function.config.load">config_load</link>
|
linkend="language.function.config.load">{config_load}</link>
|
||||||
function.
|
function.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
As of Smarty 2.4.0, assigned template variables are kept across
|
As of Smarty 2.4.0, assigned template variables are kept across
|
||||||
invocations of fetch() and display(). Config vars loaded from
|
invocations of
|
||||||
|
<link linkend="api.fetch">fetch()</link>
|
||||||
|
and <link linkend="api.display">display()</link>.
|
||||||
|
Config vars loaded from
|
||||||
config_load() are always global scope. Config files are also
|
config_load() are always global scope. Config files are also
|
||||||
compiled for faster execution, and respect the <link
|
compiled for faster execution, and respect the <link
|
||||||
linkend="variable.force.compile">force_compile</link> and <link
|
linkend="variable.force.compile">$force_compile</link> and <link
|
||||||
linkend="variable.compile.check">compile_check</link> settings.
|
linkend="variable.compile.check">$compile_check</link> settings.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
@@ -43,6 +48,13 @@ $smarty->config_load('my.conf', 'foobar');
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.config.load">{config_load}</link>,
|
||||||
|
<link linkend="api.clear.config">clear_config()</link>,
|
||||||
|
and
|
||||||
|
<link linkend="language.config.variables">config variables</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
This displays the template. Supply a valid <link
|
This displays the template. Supply a valid <link
|
||||||
linkend="template.resources">template resource</link>
|
linkend="template.resources">template resource</link>
|
||||||
type and path. As an optional second parameter, you can pass a
|
type and path. As an optional second parameter, you can pass a
|
||||||
cache id. See the <link linkend="caching">caching
|
$cache id.
|
||||||
|
See the <link linkend="caching">caching
|
||||||
section</link> for more information.
|
section</link> for more information.
|
||||||
</para>
|
</para>
|
||||||
¶meter.compileid;
|
¶meter.compileid;
|
||||||
@@ -80,7 +81,7 @@ $smarty->display("db:header.tpl");
|
|||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="api.fetch">fetch()</link> and
|
See also <link linkend="api.fetch">fetch()</link> and
|
||||||
<link linkend="api.template.exists">template_exists</link>.
|
<link linkend="api.template.exists">template_exists()</link>.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -62,8 +62,12 @@ echo $output;
|
|||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="api.display">display()</link> and
|
See also
|
||||||
<link linkend="api.template.exists">template_exists</link>.
|
<link linkend="language.function.fetch">{fetch}</link>
|
||||||
|
<link linkend="api.display">display()</link>,
|
||||||
|
<link linkend="language.function.eval">{eval}</link>,
|
||||||
|
and
|
||||||
|
<link linkend="api.template.exists">template_exists()</link>.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -32,6 +32,16 @@ print_r($config_vars);
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.clear.config">clear_config()</link>,
|
||||||
|
<link linkend="language.function.config.load">{config_load}</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.config.load">config_load()</link>,
|
||||||
|
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
<para>
|
<para>
|
||||||
This returns &true; if there is a valid cache for this template.
|
This returns &true; if there is a valid cache for this template.
|
||||||
This only works if <link
|
This only works if <link
|
||||||
linkend="variable.caching">caching</link> is set to true.
|
linkend="variable.caching">$caching</link> is set to true.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>is_cached</title>
|
<title>is_cached</title>
|
||||||
@@ -35,11 +35,13 @@ $smarty->display("index.tpl");
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
You can also pass a cache id as an optional second parameter
|
You can also pass a $cache id as an optional second parameter
|
||||||
in case you want multiple caches for the given template.
|
in case you want multiple caches for the given template.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You can supply a compile id as an optional third parameter.
|
You can supply a
|
||||||
|
<link linkend="variable.compile.id">$compile id</link>
|
||||||
|
as an optional third parameter.
|
||||||
If you omit that parameter the persistent
|
If you omit that parameter the persistent
|
||||||
<link linkend="variable.compile.id">$compile_id</link> is used.
|
<link linkend="variable.compile.id">$compile_id</link> is used.
|
||||||
</para>
|
</para>
|
||||||
@@ -78,7 +80,7 @@ $smarty->display("index.tpl", "FrontPage");
|
|||||||
display in the example above. This also means calls to
|
display in the example above. This also means calls to
|
||||||
<link linkend="api.clear.cache">clear_cache()</link>
|
<link linkend="api.clear.cache">clear_cache()</link>
|
||||||
and other changes of the cache-settings may have no effect after
|
and other changes of the cache-settings may have no effect after
|
||||||
<literal>is_cached</literal> returned true.
|
is_cached() returned true.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
@@ -6,7 +6,9 @@
|
|||||||
This is the name of the directory where template caches are
|
This is the name of the directory where template caches are
|
||||||
stored. By default this is "./cache", meaning that it will look
|
stored. By default this is "./cache", meaning that it will look
|
||||||
for the cache directory in the same directory as the executing
|
for the cache directory in the same directory as the executing
|
||||||
php script. You can also use your own custom cache handler
|
php script. You can also use your own
|
||||||
|
<link linkend="section.template.cache.handler.func">
|
||||||
|
custom cache handler</link>
|
||||||
function to control cache files, which will ignore this
|
function to control cache files, which will ignore this
|
||||||
setting.
|
setting.
|
||||||
</para>
|
</para>
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
<title>$cache_handler_func</title>
|
<title>$cache_handler_func</title>
|
||||||
<para>
|
<para>
|
||||||
You can supply a custom function to handle cache files instead
|
You can supply a custom function to handle cache files instead
|
||||||
of using the built-in method using the $cache_dir. See the
|
of using the built-in method using the
|
||||||
|
<link linkend="variable.cache.dir">$cache_dir</link>. See the
|
||||||
custom <link linkend="section.template.cache.handler.func">cache
|
custom <link linkend="section.template.cache.handler.func">cache
|
||||||
handler function section</link> for details.
|
handler function section</link> for details.
|
||||||
</para>
|
</para>
|
||||||
|
@@ -24,8 +24,9 @@
|
|||||||
<para>
|
<para>
|
||||||
If you want to give certain templates their own cache lifetime, you could
|
If you want to give certain templates their own cache lifetime, you could
|
||||||
do this by setting <link linkend="variable.caching">$caching</link> = 2,
|
do this by setting <link linkend="variable.caching">$caching</link> = 2,
|
||||||
then set $cache_lifetime to a unique value just before calling display()
|
then set $cache_lifetime to a unique value just before calling
|
||||||
or fetch().
|
<link linkend="api.display">display()</link>
|
||||||
|
or <link linkend="api.fetch">fetch()</link>.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -8,17 +8,22 @@
|
|||||||
redundant redundant content, it is advisable to turn on caching. This
|
redundant redundant content, it is advisable to turn on caching. This
|
||||||
will result in significant performance gains. You can also have multiple
|
will result in significant performance gains. You can also have multiple
|
||||||
caches for the same template. A value of 1 or 2 enables caching. 1 tells
|
caches for the same template. A value of 1 or 2 enables caching. 1 tells
|
||||||
Smarty to use the current $cache_lifetime variable to determine if the
|
Smarty to use the current
|
||||||
|
<link linkend="variable.cache.lifetime">$cache_lifetime</link>
|
||||||
|
variable to determine if the
|
||||||
cache has expired. A value of 2 tells Smarty to use the cache_lifetime
|
cache has expired. A value of 2 tells Smarty to use the cache_lifetime
|
||||||
value at the time the cache was generated. This way you can set the
|
value at the time the cache was generated. This way you can set the
|
||||||
cache_lifetime just before fetching the template to have granular
|
cache_lifetime just before fetching the template to have granular
|
||||||
control over when that particular cache expires. See also <link
|
control over when that particular cache expires.
|
||||||
linkend="api.is.cached">is_cached</link>.
|
See also <link linkend="api.is.cached">is_cached()</link>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If $compile_check is enabled, the cached content will be regenerated if
|
If <link linkend="variable.compile.check">$compile_check</link>
|
||||||
|
is enabled, the cached content will be regenerated if
|
||||||
any of the templates or config files that are part of this cache are
|
any of the templates or config files that are part of this cache are
|
||||||
changed. If $force_compile is enabled, the cached content will always be
|
changed. If
|
||||||
|
<link linkend="variable.force.compile">$force_compile</link>
|
||||||
|
is enabled, the cached content will always be
|
||||||
regenerated.
|
regenerated.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -12,11 +12,13 @@
|
|||||||
step is no longer needed. Be sure to set $compile_check to "false" for
|
step is no longer needed. Be sure to set $compile_check to "false" for
|
||||||
maximal performance. Note that if you change this to "false" and a
|
maximal performance. Note that if you change this to "false" and a
|
||||||
template file is changed, you will *not* see the change since the
|
template file is changed, you will *not* see the change since the
|
||||||
template will not get recompiled. If caching is enabled and
|
template will not get recompiled. If
|
||||||
|
<link linkend="variable.caching">caching</link>
|
||||||
|
is enabled and
|
||||||
compile_check is enabled, then the cache files will get regenerated if
|
compile_check is enabled, then the cache files will get regenerated if
|
||||||
an involved template file or config file was updated. See <link
|
an involved template file or config file was updated. See <link
|
||||||
linkend="variable.force.compile">$force_compile</link> or <link
|
linkend="variable.force.compile">$force_compile</link> or <link
|
||||||
linkend="api.clear.compiled.tpl">clear_compiled_tpl</link>.
|
linkend="api.clear.compiled.tpl">clear_compiled_tpl()</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -9,12 +9,17 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
With a compile_id you can work around the limitation that you cannot
|
With a compile_id you can work around the limitation that you cannot
|
||||||
use the same compile_dir for different template_dirs. If you set a
|
use the same
|
||||||
|
<link linkend="variable.compile.dir">$compile_dir</link>
|
||||||
|
for different
|
||||||
|
<link linkend="variable.template.dir">$template_dirs</link>. If you set a
|
||||||
distinct compile_id for each template_dir then smarty can tell the
|
distinct compile_id for each template_dir then smarty can tell the
|
||||||
compiled templates apart by their compile_id.
|
compiled templates apart by their compile_id.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If you have for example a prefilter that localizes your templates
|
If you have for example a
|
||||||
|
<link linkend="plugins.prefilters.postfilters">prefilter</link>
|
||||||
|
that localizes your templates
|
||||||
(that is: translates language dependend parts) at compile time, then
|
(that is: translates language dependend parts) at compile time, then
|
||||||
you should use the current language as compile_id and you will get a
|
you should use the current language as compile_id and you will get a
|
||||||
set of compiled templates for each language you use.
|
set of compiled templates for each language you use.
|
||||||
|
@@ -3,7 +3,9 @@
|
|||||||
<sect1 id="variable.config.dir">
|
<sect1 id="variable.config.dir">
|
||||||
<title>$config_dir</title>
|
<title>$config_dir</title>
|
||||||
<para>
|
<para>
|
||||||
This is the directory used to store config files used in the
|
This is the directory used to store
|
||||||
|
<link linkend="config.files">config files</link>
|
||||||
|
used in the
|
||||||
templates. Default is "./configs", meaning that it will look
|
templates. Default is "./configs", meaning that it will look
|
||||||
for the configs directory in the same directory as the
|
for the configs directory in the same directory as the
|
||||||
executing php script.
|
executing php script.
|
||||||
|
@@ -4,7 +4,9 @@
|
|||||||
<title>$config_read_hidden</title>
|
<title>$config_read_hidden</title>
|
||||||
<para>
|
<para>
|
||||||
If set to true, hidden sections (section names beginning with a period)
|
If set to true, hidden sections (section names beginning with a period)
|
||||||
in config files can be read from templates. Typically you would leave
|
in
|
||||||
|
<link linkend="config.files">config files</link>
|
||||||
|
can be read from templates. Typically you would leave
|
||||||
this false, that way you can store sensitive data in the config files
|
this false, that way you can store sensitive data in the config files
|
||||||
such as database parameters and not worry about the template loading
|
such as database parameters and not worry about the template loading
|
||||||
them. false by default.
|
them. false by default.
|
||||||
|
@@ -7,6 +7,12 @@
|
|||||||
default, it is named debug.tpl and is located in the <link
|
default, it is named debug.tpl and is located in the <link
|
||||||
linkend="constant.smarty.dir">SMARTY_DIR</link>.
|
linkend="constant.smarty.dir">SMARTY_DIR</link>.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="variable.debugging">$debugging</link>
|
||||||
|
and
|
||||||
|
<link linkend="chapter.debugging.console">Debugging console</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -6,9 +6,13 @@
|
|||||||
This allows alternate ways to enable debugging. NONE means no
|
This allows alternate ways to enable debugging. NONE means no
|
||||||
alternate methods are allowed. URL means when the keyword
|
alternate methods are allowed. URL means when the keyword
|
||||||
SMARTY_DEBUG is found in the QUERY_STRING, debugging is enabled
|
SMARTY_DEBUG is found in the QUERY_STRING, debugging is enabled
|
||||||
for that invocation of the script. If $debugging is true, this
|
for that invocation of the script. If
|
||||||
|
<link linkend="variable.debugging">$debugging</link> is true, this
|
||||||
value is ignored.
|
value is ignored.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="chapter.debugging.console">Debugging console</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -9,6 +9,12 @@
|
|||||||
included templates and assigned variables for the current
|
included templates and assigned variables for the current
|
||||||
template page.
|
template page.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.debug">{debug}</link>,
|
||||||
|
<link linkend="variable.debug.tpl">$debug_tpl</link>,
|
||||||
|
and <link linkend="variable.debugging.ctrl">$debuging_ctrl</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
<title>$error_reporting</title>
|
<title>$error_reporting</title>
|
||||||
<para>
|
<para>
|
||||||
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-level inside of <link linkend="api.display">display()</link>
|
<ulink url="&url.php-manual;error_reporting">error_reporting</ulink>
|
||||||
|
level inside of <link linkend="api.display">display()</link>
|
||||||
and <link linkend="api.fetch">fetch()</link>. When <link
|
and <link linkend="api.fetch">fetch()</link>. When <link
|
||||||
linkend="chapter.debugging.console">debugging</link> is enabled this value
|
linkend="chapter.debugging.console">debugging</link> is enabled this value
|
||||||
is ignored and the error-level is left untouched.
|
is ignored and the error-level is left untouched.
|
||||||
|
@@ -4,9 +4,13 @@
|
|||||||
<title>$force_compile</title>
|
<title>$force_compile</title>
|
||||||
<para>
|
<para>
|
||||||
This forces Smarty to (re)compile templates on every
|
This forces Smarty to (re)compile templates on every
|
||||||
invocation. This setting overrides $compile_check. By default
|
invocation. This setting overrides
|
||||||
this is disabled. This is handy for development and debugging.
|
<link linkend="variable.compile.check">$compile_check</link>.
|
||||||
It should never be used in a production environment. If caching
|
By default
|
||||||
|
this is disabled. This is handy for development and
|
||||||
|
<link linkend="chapter.debugging.console">debugging</link>.
|
||||||
|
It should never be used in a production environment. If
|
||||||
|
<link linkend="variable.caching">caching</link>
|
||||||
is enabled, the cache file(s) will be regenerated every time.
|
is enabled, the cache file(s) will be regenerated every time.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -4,8 +4,10 @@
|
|||||||
<title>$plugins_dir</title>
|
<title>$plugins_dir</title>
|
||||||
<para>
|
<para>
|
||||||
This is the directory (or directories) where Smarty will look for the
|
This is the directory (or directories) where Smarty will look for the
|
||||||
plugins that it needs. Default is "plugins" under the SMARTY_DIR. If you
|
plugins that it needs. Default is "plugins" under the
|
||||||
supply a relative path, Smarty will first look under the SMARTY_DIR, then
|
<link linkend="constant.smarty.dir">SMARTY_DIR</link>. If you
|
||||||
|
supply a relative path, Smarty will first look under the
|
||||||
|
<link linkend="constant.smarty.dir">SMARTY_DIR</link>, then
|
||||||
relative to the cwd (current working directory), then relative to the PHP
|
relative to the cwd (current working directory), then relative to the PHP
|
||||||
include_path. If $plugins_dir is an array of directories, Smarty will
|
include_path. If $plugins_dir is an array of directories, Smarty will
|
||||||
search for your plugin in each plugin directory in the order they are
|
search for your plugin in each plugin directory in the order they are
|
||||||
|
@@ -6,9 +6,10 @@
|
|||||||
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
|
||||||
$_*[] ($request_use_auto_globals=true). This affects templates
|
$_*[] ($request_use_auto_globals=true). This affects templates
|
||||||
that make use of {$smarty.request.*}, {$smarty.get.*} etc. .
|
that make use of
|
||||||
|
<link linkend="language.variables.smarty">{$smarty.request.*}, {$smarty.get.*}</link> etc. .
|
||||||
Caution: If you set $request_use_auto_globals to true, <link
|
Caution: If you set $request_use_auto_globals to true, <link
|
||||||
linkend="variable.request.vars.order">variable.request.vars.order
|
linkend="variable.request.vars.order">$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>
|
||||||
|
@@ -6,6 +6,11 @@
|
|||||||
The order in which request variables are registered, similar to
|
The order in which request variables are registered, similar to
|
||||||
variables_order in php.ini
|
variables_order in php.ini
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="language.variables.smarty">$smarty.request</link>
|
||||||
|
and
|
||||||
|
<link linkend="variable.request.use.auto.globals">$request_use_auto_globals</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -4,8 +4,18 @@
|
|||||||
<title>$secure_dir</title>
|
<title>$secure_dir</title>
|
||||||
<para>
|
<para>
|
||||||
This is an array of all local directories that are considered
|
This is an array of all local directories that are considered
|
||||||
secure. {include} and {fetch} use this when security is enabled.
|
secure.
|
||||||
|
<link linkend="language.function.include">{include}</link>
|
||||||
|
and <link linkend="language.function.fetch">{fetch}</link>
|
||||||
|
use this when
|
||||||
|
<link linkend="variable.security">security is enabled</link>.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="variable.security.settings">Security settings</link>,
|
||||||
|
and <link linkend="variable.trusted.dir">$trusted_dir</link>.
|
||||||
|
</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -4,23 +4,51 @@
|
|||||||
<title>$security_settings</title>
|
<title>$security_settings</title>
|
||||||
<para>
|
<para>
|
||||||
These are used to override or specify the security settings when
|
These are used to override or specify the security settings when
|
||||||
security is enabled. These are the possible settings:
|
<link linkend="variable.security">security is enabled</link>.
|
||||||
|
These are the possible settings:
|
||||||
</para>
|
</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>PHP_HANDLING - true/false. If set to true, the
|
<listitem>
|
||||||
$php_handling setting is not checked for security.</para></listitem>
|
<para>
|
||||||
<listitem><para>IF_FUNCS - This is an array of the names of permitted
|
PHP_HANDLING - true/false. If set to true, the
|
||||||
PHP functions in IF statements.</para></listitem>
|
<link linkend="variable.php.handling">$php_handling</link>
|
||||||
<listitem><para>INCLUDE_ANY - true/false. If set to true, any
|
setting is not checked for security.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
IF_FUNCS - This is an array of the names of permitted PHP functions in
|
||||||
|
<link linkend="language.function.if">IF</link> statements.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
INCLUDE_ANY - true/false. If set to true, any
|
||||||
template can be included from the file system, regardless of the
|
template can be included from the file system, regardless of the
|
||||||
$secure_dir list.</para></listitem>
|
<link linkend="variable.secure.dir">$secure_dir</link> list.
|
||||||
<listitem><para>PHP_TAGS - true/false. If set to true, {php}{/php}
|
</para>
|
||||||
tags are permitted in the templates.</para></listitem>
|
</listitem>
|
||||||
<listitem><para>MODIFIER_FUNCS - This is an array of the names of permitted
|
<listitem>
|
||||||
PHP functions used as variable modifiers.</para></listitem>
|
<para>
|
||||||
<listitem><para>ALLOW_CONSTANTS - true/false. If set to true, constants via
|
PHP_TAGS - true/false. If set to true,
|
||||||
{$smarty.const.name} are allowed in the templates. The defaults is set to
|
<link linkend="language.function.php">{php}{/php}</link>
|
||||||
"false" for security.</para></listitem>
|
tags are permitted in the templates.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
MODIFIER_FUNCS - This is an array of the names of permitted
|
||||||
|
PHP functions used as variable modifiers.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
ALLOW_CONSTANTS - true/false. If set to true, constants via
|
||||||
|
<link linkend="language.variables.smarty.const">{$smarty.const.name}</link>
|
||||||
|
are allowed in the templates. The defaults is set to
|
||||||
|
"false" for security.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -8,20 +8,39 @@
|
|||||||
(via ftp for example) and you want to reduce the risk of system
|
(via ftp for example) and you want to reduce the risk of system
|
||||||
security compromises through the template language. Turning on
|
security compromises through the template language. Turning on
|
||||||
security enforces the following rules to the template language,
|
security enforces the following rules to the template language,
|
||||||
unless specifially overridden with $security_settings:
|
unless specifially overridden with
|
||||||
|
<link linkend="variable.security.settings">$security_settings</link>:
|
||||||
</para>
|
</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>If $php_handling is set to SMARTY_PHP_ALLOW, this is
|
<listitem>
|
||||||
implicitly changed to SMARTY_PHP_PASSTHRU</para></listitem>
|
<para>If <link linkend="variable.php.handling">$php_handling</link>
|
||||||
<listitem><para>PHP functions are not allowed in IF statements,
|
is set to SMARTY_PHP_ALLOW, this is
|
||||||
except those specified in the $security_settings</para></listitem>
|
implicitly changed to SMARTY_PHP_PASSTHRU
|
||||||
<listitem><para>templates can only be included from directories
|
</para></listitem>
|
||||||
listed in the $secure_dir array</para></listitem>
|
<listitem>
|
||||||
<listitem><para>local files can only be fetched from directories
|
<para>
|
||||||
listed in the $secure_dir array using {fetch}</para></listitem>
|
PHP functions are not allowed in <link
|
||||||
<listitem><para>{php}{/php} tags are not allowed</para></listitem>
|
linkend="language.function.if">{if}</link> statements,
|
||||||
<listitem><para>PHP functions are not allowed as modifiers, except
|
except those specified in the
|
||||||
those specified in the $security_settings</para></listitem>
|
<link linkend="variable.security.settings">$security_settings</link>
|
||||||
|
</para></listitem>
|
||||||
|
<listitem><para>
|
||||||
|
templates can only be included from directories
|
||||||
|
listed in the
|
||||||
|
<link linkend="variable.secure.dir">$secure_dir</link> array
|
||||||
|
</para></listitem>
|
||||||
|
<listitem><para>
|
||||||
|
local files can only be fetched from directories listed in the
|
||||||
|
<link linkend="variable.secure.dir">$secure_dir</link>
|
||||||
|
array using <link linkend="language.function.fetch">{fetch}</link>
|
||||||
|
</para></listitem>
|
||||||
|
<listitem><para>
|
||||||
|
<link linkend="language.function.php">{php}{/php}</link> tags are not allowed
|
||||||
|
</para></listitem>
|
||||||
|
<listitem><para>
|
||||||
|
PHP functions are not allowed as modifiers, except those specified in the
|
||||||
|
<link linkend="variable.security.settings">$security_settings</link>
|
||||||
|
</para></listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -3,9 +3,11 @@
|
|||||||
<sect1 id="variable.trusted.dir">
|
<sect1 id="variable.trusted.dir">
|
||||||
<title>$trusted_dir</title>
|
<title>$trusted_dir</title>
|
||||||
<para>
|
<para>
|
||||||
$trusted_dir is only for use when $security is enabled. This is an array
|
$trusted_dir is only for use when
|
||||||
of all directories that are considered trusted. Trusted directories are
|
<link linkend="variable.security">$security</link> is enabled.
|
||||||
where you keep php scripts that are executed directly from the templates
|
This is an array of all directories that are considered trusted.
|
||||||
|
Trusted directories are where you keep php scripts that are executed
|
||||||
|
directly from the templates
|
||||||
with <link linkend="language.function.include.php">{include_php}</link>.
|
with <link linkend="language.function.include.php">{include_php}</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -9,7 +9,9 @@
|
|||||||
cached version of the call is available, that is displayed instead of
|
cached 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() or fetch() is cached, one cache file could conceivably be made up
|
<link linkend="api.display">display()</link> or
|
||||||
|
<link linkend="api.fetch">fetch()</link> is cached,
|
||||||
|
one cache file could conceivably be made up
|
||||||
of several template files, config files, etc.
|
of several template files, config files, etc.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
@@ -31,7 +31,9 @@ $smarty->display('index.tpl');
|
|||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
The files in the $cache_dir are named similar to the template name.
|
The files in the
|
||||||
|
<link linkend="variable.cache.dir">$cache_dir</link>
|
||||||
|
are named similar to the template name.
|
||||||
Although they end in the ".php" extention, they are not really executable
|
Although they end in the ".php" extention, they are not really executable
|
||||||
php scripts. Do not edit these files!
|
php scripts. Do not edit these files!
|
||||||
</para>
|
</para>
|
||||||
@@ -41,7 +43,9 @@ $smarty->display('index.tpl');
|
|||||||
linkend="variable.cache.lifetime">$cache_lifetime</link>. The default value
|
linkend="variable.cache.lifetime">$cache_lifetime</link>. The default value
|
||||||
is 3600 seconds, or 1 hour. After that time expires, the cache is
|
is 3600 seconds, or 1 hour. After that time expires, the cache is
|
||||||
regenerated. It is possible to give individual caches their own expiration
|
regenerated. It is possible to give individual caches their own expiration
|
||||||
time by setting $caching = 2. See the documentation on <link
|
time by setting
|
||||||
|
<link linkend="variable.caching">$caching</link> = 2.
|
||||||
|
See the documentation on <link
|
||||||
linkend="variable.cache.lifetime">$cache_lifetime</link> for details.
|
linkend="variable.cache.lifetime">$cache_lifetime</link> for details.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -77,7 +81,9 @@ $smarty->display('home.tpl');
|
|||||||
every template file and config file that is involved with the cache file is
|
every template file and config file that is involved with the cache file is
|
||||||
checked for modification. If any of the files have been modified since the
|
checked for modification. If any of the files have been modified since the
|
||||||
cache was generated, the cache is immediately regenerated. This is a slight
|
cache was generated, the cache is immediately regenerated. This is a slight
|
||||||
overhead so for optimum performance, leave $compile_check set to false.
|
overhead so for optimum performance, leave
|
||||||
|
<link linkend="variable.compile.check">$compile_check</link>
|
||||||
|
set to false.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>enabling $compile_check</title>
|
<title>enabling $compile_check</title>
|
||||||
@@ -98,7 +104,9 @@ $smarty->display('index.tpl');
|
|||||||
<para>
|
<para>
|
||||||
If <link linkend="variable.force.compile">$force_compile</link> is enabled,
|
If <link linkend="variable.force.compile">$force_compile</link> is enabled,
|
||||||
the cache files will always be regenerated. This effectively turns off
|
the cache files will always be regenerated. This effectively turns off
|
||||||
caching. $force_compile is usually for debugging purposes only, a more
|
caching.
|
||||||
|
<link linkend="variable.force.compile">$force_compile</link>
|
||||||
|
is usually for debugging purposes only, a more
|
||||||
efficient way of disabling caching is to set <link
|
efficient way of disabling caching is to set <link
|
||||||
linkend="variable.caching">$caching</link> = false (or 0.)
|
linkend="variable.caching">$caching</link> = false (or 0.)
|
||||||
</para>
|
</para>
|
||||||
@@ -131,11 +139,11 @@ $smarty->display('index.tpl');
|
|||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
You can keep parts of a page dynamic with the <link
|
You can keep parts of a page dynamic with the <link
|
||||||
linkend="language.function.insert">insert</link> template function. Let's
|
linkend="language.function.insert">{insert}</link> template function. Let's
|
||||||
say the whole page can be cached except for a banner that is displayed down
|
say the whole page can be cached except for a banner that is displayed down
|
||||||
the right side of the page. By using an insert function for the banner, you
|
the right side of the page. By using an insert function for the banner, you
|
||||||
can keep this element dynamic within the cached content. See the
|
can keep this element dynamic within the cached content. See the
|
||||||
documentation on <link linkend="language.function.insert">insert</link> for
|
documentation on <link linkend="language.function.insert">{insert}</link> for
|
||||||
details and examples.
|
details and examples.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
@@ -24,13 +24,19 @@ require_once(SMARTY_DIR."Smarty.class.php");
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.variables.smarty.const">$smarty.const</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="constant.smarty.core.dir">
|
<sect1 id="constant.smarty.core.dir">
|
||||||
<title>SMARTY_CORE_DIR</title>
|
<title>SMARTY_CORE_DIR</title>
|
||||||
<para>
|
<para>
|
||||||
This should be the full system path to the location of the Smarty core
|
This should be the full system path to the location of the Smarty core
|
||||||
files. If not defined, Smarty will default this constant to the internals/
|
files. If not defined, Smarty will default this constant to the internals/
|
||||||
sub-directory below SMARTY_DIR. If defined, the path must end with a slash.
|
sub-directory below
|
||||||
|
<link linkend="constant.smarty.dir">SMARTY_DIR</link>.
|
||||||
|
If defined, the path must end with a slash.
|
||||||
Use this constant when manually including any of the core.* files.
|
Use this constant when manually including any of the core.* files.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -45,6 +51,11 @@ require_once(SMARTY_CORE_DIR."core.get_microtime.php");
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.variables.smarty.const">$smarty.const</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
</chapter>
|
</chapter>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
Reference in New Issue
Block a user