This commit is contained in:
didou
2004-04-18 17:18:26 +00:00
parent c9db7a285d
commit 72ab60010c

View File

@@ -1,78 +1,77 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.config.load"> <sect1 id="language.function.config.load">
<title>config_load</title> <title>config_load</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>file</entry> <entry>file</entry>
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>The name of the config file to include</entry> <entry>The name of the config file to include</entry>
</row> </row>
<row> <row>
<entry>section</entry> <entry>section</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>The name of the section to load</entry> <entry>The name of the section to load</entry>
</row> </row>
<row> <row>
<entry>scope</entry> <entry>scope</entry>
<entry>string</entry> <entry>string</entry>
<entry>no</entry> <entry>no</entry>
<entry><emphasis>local</emphasis></entry> <entry><emphasis>local</emphasis></entry>
<entry> <entry>
How the scope of the loaded variables are treated, How the scope of the loaded variables are treated,
which must be one of local, parent or global. local which must be one of local, parent or global. local
means variables are loaded into the local template means variables are loaded into the local template
context. parent means variables are loaded into both context. parent means variables are loaded into both
the local context and the parent template that called the local context and the parent template that called
it. global means variables are available to all it. global means variables are available to all
templates. templates.
</entry> </entry>
</row> </row>
<row> <row>
<entry>global</entry> <entry>global</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>No</emphasis></entry> <entry><emphasis>No</emphasis></entry>
<entry> <entry>
Whether or not variables are visible to the parent Whether or not variables are visible to the parent
template, same as scope=parent. NOTE: This attribute is template, same as scope=parent. NOTE: This attribute is
deprecated by the scope attribute, but still supported. deprecated by the scope attribute, but still supported.
If scope is supplied, this value is ignored. If scope is supplied, this value is ignored.
</entry> </entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
This function is used for loading in variables from a This function is used for loading in variables from a
configuration file into the template. configuration file into the template.
See <link linkend="config.files">Config Files</link> for more See <link linkend="config.files">Config Files</link> for more
info. info.
</para> </para>
<example> <example>
<title>function config_load</title> <title>function config_load</title>
<programlisting>
<programlisting>
<![CDATA[ <![CDATA[
{config_load file="colors.conf"} {config_load file="colors.conf"}
@@ -80,31 +79,31 @@
<title>{#pageTitle#}</title> <title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}"> <body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}"> <tr bgcolor="{#rowBgColor#}">
<td>First</td> <td>First</td>
<td>Last</td> <td>Last</td>
<td>Address</td> <td>Address</td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
Config files may also contain sections. You can load variables from Config files may also contain sections. You can load variables from
within a section with the added attribute within a section with the added attribute
<emphasis>section</emphasis>. <emphasis>section</emphasis>.
</para> </para>
<para> <para>
NOTE: <emphasis>Config file sections</emphasis> and the built-in NOTE: <emphasis>Config file sections</emphasis> and the built-in
template function called <emphasis>section</emphasis> have nothing template function called <emphasis>section</emphasis> have nothing
to do with each other, they just happen to share a common naming to do with each other, they just happen to share a common naming
convention. convention.
</para> </para>
<example> <example>
<title>function config_load with section</title> <title>function config_load with section</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{config_load file="colors.conf" section="Customer"} {config_load file="colors.conf" section="Customer"}
@@ -112,17 +111,17 @@
<title>{#pageTitle#}</title> <title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}"> <body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}"> <tr bgcolor="{#rowBgColor#}">
<td>First</td> <td>First</td>
<td>Last</td> <td>Last</td>
<td>Address</td> <td>Address</td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </html>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file