mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
indentation
This commit is contained in:
@@ -3,17 +3,12 @@
|
|||||||
<chapter id="config.files">
|
<chapter id="config.files">
|
||||||
<title>Config Files</title>
|
<title>Config Files</title>
|
||||||
<para>
|
<para>
|
||||||
Config files are handy for designers to manage global
|
Config files are handy for designers to manage global template
|
||||||
template
|
variables from one file. One example is template colors. Normally
|
||||||
variables from one file. One example is template colors.
|
if you wanted to change the color scheme of an application, you
|
||||||
Normally if
|
would have to go through each and every template file and change the
|
||||||
you wanted to change the color scheme of an application, you
|
colors. With a config file, the colors can be kept in one place, and
|
||||||
would have
|
only one file needs to be updated.
|
||||||
to go through each and every template file and change the
|
|
||||||
colors. With
|
|
||||||
a config file, the colors can be kept in one place, and only
|
|
||||||
one file
|
|
||||||
needs to be updated.
|
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Example of config file syntax</title>
|
<title>Example of config file syntax</title>
|
||||||
@@ -45,78 +40,50 @@ pass=foobar
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Values of
|
Values of <link linkend="language.config.variables">config file
|
||||||
<link linkend="language.config.variables">config file
|
variables</link> can be in quotes, but not necessary. You can use
|
||||||
variables</link>
|
either single or double quotes. If you have a value that spans more
|
||||||
can be in quotes, but not necessary.
|
than one line, enclose the entire value with triple quotes
|
||||||
You can use either single or double quotes. If you have a
|
("""). You can put comments into config files by any syntax that is
|
||||||
value that
|
not a valid config file syntax. We recommend using a <literal>
|
||||||
spans more than one line, enclose the entire value with
|
#</literal> (hash) at the beginning of the line.
|
||||||
triple quotes
|
|
||||||
("""). You can put comments into config files by any syntax
|
|
||||||
that is not
|
|
||||||
a valid config file syntax. We recommend using a <literal>
|
|
||||||
#</literal>
|
|
||||||
(hash) at the beginning of the line.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
This config file example has two sections. Section names are
|
This config file example has two sections. Section names are
|
||||||
enclosed in
|
enclosed in brackets []. Section names can be arbitrary strings not
|
||||||
brackets []. Section names can be arbitrary strings not
|
containing <literal>[</literal> or <literal>]</literal> symbols. The
|
||||||
containing
|
four variables at the top are global variables, or variables not
|
||||||
<literal>[</literal> or <literal>]</literal> symbols. The
|
within a section. These variables are always loaded from the config
|
||||||
four variables
|
file. If a particular section is loaded, then the global variables
|
||||||
at the top are global variables, or variables not within a
|
and the variables from that section are also loaded. If a variable
|
||||||
section.
|
exists both as a global and in a section, the section variable is
|
||||||
These variables are always loaded from the config file. If a
|
used. If you name two variables the same within a section, the last
|
||||||
particular
|
one will be used unless <link linkend="variable.config.overwrite">
|
||||||
section is loaded, then the global variables and the
|
$config_overwrite</link> is disabled.
|
||||||
variables from that
|
|
||||||
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
|
|
||||||
same within a section, the last one will be used unless
|
|
||||||
<link linkend="variable.config.overwrite">
|
|
||||||
$config_overwrite</link>
|
|
||||||
is disabled.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Config files are loaded into templates with the built-in
|
Config files are loaded into templates with the built-in function
|
||||||
function
|
<link linkend="language.function.config.load"><command>
|
||||||
<link
|
{config_load}</command></link> (see also <link
|
||||||
linkend="language.function.config.load"><command>
|
|
||||||
{config_load}</command></link>
|
|
||||||
(see also
|
|
||||||
<link
|
|
||||||
linkend="api.config.load"><command>config_load()</command></link> ).
|
linkend="api.config.load"><command>config_load()</command></link> ).
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You can hide variables or entire sections by prepending the
|
You can hide variables or entire sections by prepending the variable
|
||||||
variable
|
|
||||||
name or section name with a period. This is useful if your
|
name or section name with a period. This is useful if your
|
||||||
application
|
application reads the config files and gets sensitive data from them
|
||||||
reads the config files and gets sensitive data from them
|
that the template engine does not need. If you have third parties
|
||||||
that the
|
doing template editing, you can be certain that they cannot read
|
||||||
template engine does not need. If you have third parties
|
sensitive data from the config file by loading it into the template.
|
||||||
doing template
|
</para>
|
||||||
editing, you can be certain that they cannot read sensitive
|
<para>
|
||||||
data from
|
See also <link
|
||||||
the config file by loading it into the template.
|
linkend="language.function.config.load">{config_load}</link>, <link
|
||||||
|
linkend="variable.config.overwrite">$config_overwrite</link>, <link
|
||||||
|
linkend="api.get.config.vars">get_config_vars()</link>, <link
|
||||||
|
linkend="api.clear.config">clear_config()</link> and <link
|
||||||
|
linkend="api.config.load">config_load()</link>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
|
||||||
See also
|
|
||||||
<link linkend="language.function.config.load">{config_load}</link>,
|
|
||||||
<link linkend="variable.config.overwrite">$config_overwrite</link>,
|
|
||||||
<link linkend="api.get.config.vars">get_config_vars()</link>,
|
|
||||||
<link linkend="api.clear.config">clear_config()</link>
|
|
||||||
and
|
|
||||||
<link linkend="api.config.load">config_load()</link>
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
mode: sgml
|
mode: sgml
|
||||||
@@ -137,4 +104,3 @@ 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
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user