mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
Moved description to top of page and some tweaks
This commit is contained in:
@@ -2,6 +2,20 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.capture">
|
<sect1 id="language.function.capture">
|
||||||
<title>{capture}</title>
|
<title>{capture}</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
{capture} is used to collect the output of the template into a
|
||||||
|
variable instead of displaying it. Any content between {capture
|
||||||
|
name="foo"} and {/capture} is collected into the variable specified
|
||||||
|
in the name attribute. The captured content can be used in the
|
||||||
|
template from the special variable <link
|
||||||
|
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
|
||||||
|
where "foo" is the value passed in the name attribute. If you do not
|
||||||
|
supply a name attribute, then "default" will be used as the name. All {capture}
|
||||||
|
commands must be paired with {/capture}. You can nest capture commands.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -36,17 +50,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
{capture} is used to collect the output of the template into a
|
|
||||||
variable instead of displaying it. Any content between {capture
|
|
||||||
name="foo"} and {/capture} is collected into the variable specified
|
|
||||||
in the name attribute. The captured content can be used in the
|
|
||||||
template from the special variable <link
|
|
||||||
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
|
|
||||||
where "foo" is the value passed in the name attribute. If you do not
|
|
||||||
supply a name attribute, then "default" will be used. All {capture}
|
|
||||||
commands must be paired with {/capture}. You can nest capture commands.
|
|
||||||
</para>
|
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -61,7 +65,7 @@
|
|||||||
linkend="language.function.insert">{insert}</link>
|
linkend="language.function.insert">{insert}</link>
|
||||||
output. If you have
|
output. If you have
|
||||||
<link linkend="caching">caching</link>
|
<link linkend="caching">caching</link>
|
||||||
turned on and you have
|
enabled and you have
|
||||||
<link linkend="language.function.insert">{insert}</link>
|
<link linkend="language.function.insert">{insert}</link>
|
||||||
commands that you expect to run
|
commands that you expect to run
|
||||||
within cached content, do not capture this content.
|
within cached content, do not capture this content.
|
||||||
@@ -74,7 +78,7 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* we don't want to print a table row unless content is displayed *}
|
{* we don't want to print a table row unless content is displayed *}
|
||||||
{capture name=banner}
|
{capture name=banner}
|
||||||
{include file="get_banner.tpl"}
|
{include file='get_banner.tpl'}
|
||||||
{/capture}
|
{/capture}
|
||||||
|
|
||||||
{if $smarty.capture.banner ne ''}
|
{if $smarty.capture.banner ne ''}
|
||||||
@@ -89,6 +93,24 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<title>capturing content to a variable</title>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
{* we don't want to print a table row unless content is displayed *}
|
||||||
|
{capture name=banner assign=foo}
|
||||||
|
.... some content ....
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{if $condition}
|
||||||
|
{$foo}
|
||||||
|
{/if}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
|
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also
|
See also
|
||||||
|
@@ -2,6 +2,12 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.config.load">
|
<sect1 id="language.function.config.load">
|
||||||
<title>{config_load}</title>
|
<title>{config_load}</title>
|
||||||
|
<para>
|
||||||
|
{config_load} is used for loading config
|
||||||
|
<link linkend="language.config.variables">#variables#</link> from a
|
||||||
|
<link linkend="config.files">configuration file</link> into the template.
|
||||||
|
</para>
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -63,11 +69,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
{config_load} is used for loading config
|
|
||||||
<link linkend="language.config.variables">#variables#</link> from a
|
|
||||||
<link linkend="config.files">configuration file</link> into the template.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>{config_load}</title>
|
<title>{config_load}</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -146,6 +148,10 @@ pageTitle = "Customer Info"
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
See <link linkend="variable.config.overwrite">$config_overwrite</link> for arrays of config variables
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="config.files">Config files</link>,
|
See also <link linkend="config.files">Config files</link>,
|
||||||
<link linkend="language.config.variables">Config variables</link>,
|
<link linkend="language.config.variables">Config variables</link>,
|
||||||
|
@@ -2,6 +2,28 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.foreach">
|
<sect1 id="language.function.foreach">
|
||||||
<title>{foreach},{foreachelse}</title>
|
<title>{foreach},{foreachelse}</title>
|
||||||
|
<para>
|
||||||
|
<emphasis>{foreach}</emphasis> loops are an alternative to
|
||||||
|
<link
|
||||||
|
linkend="language.function.section"><emphasis>{section}</emphasis></link>
|
||||||
|
loops. <emphasis>{foreach}</emphasis> is used to loop over a
|
||||||
|
<emphasis role="bold">single associative array</emphasis>. The syntax for
|
||||||
|
<emphasis>{foreach}</emphasis> is much easier than
|
||||||
|
<emphasis>{section}</emphasis>, but as a tradeoff it
|
||||||
|
<emphasis role="bold">can only be used
|
||||||
|
for a single array</emphasis>. <emphasis>{foreach}</emphasis> tags must be
|
||||||
|
paired with <emphasis>{/foreach}</emphasis> tags. Required parameters
|
||||||
|
are <emphasis>from</emphasis> and <emphasis>item</emphasis>. The
|
||||||
|
name of the {foreach} loop can be anything you like, made up of
|
||||||
|
letters, numbers and underscores. <emphasis>{foreach}</emphasis>
|
||||||
|
loops can be nested, and the nested {foreach} names must be unique
|
||||||
|
from each other. The <emphasis>from</emphasis> variable (usually an
|
||||||
|
array of values) determines the number of times
|
||||||
|
<emphasis>{foreach}</emphasis> will loop.
|
||||||
|
<emphasis>{foreachelse}</emphasis> is executed when there are no
|
||||||
|
values in the <emphasis>from</emphasis> variable.
|
||||||
|
</para>
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -52,27 +74,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
<emphasis>{foreach}</emphasis> loops are an alternative to
|
|
||||||
<link
|
|
||||||
linkend="language.function.section"><emphasis>{section}</emphasis></link>
|
|
||||||
loops. <emphasis>{foreach}</emphasis> is used to loop over a
|
|
||||||
<emphasis role="bold">single associative array</emphasis>. The syntax for
|
|
||||||
<emphasis>{foreach}</emphasis> is much easier than
|
|
||||||
<emphasis>{section}</emphasis>, but as a tradeoff it
|
|
||||||
<emphasis role="bold">can only be used
|
|
||||||
for a single array</emphasis>. <emphasis>{foreach}</emphasis> tags must be
|
|
||||||
paired with <emphasis>{/foreach}</emphasis> tags. Required parameters
|
|
||||||
are <emphasis>from</emphasis> and <emphasis>item</emphasis>. The
|
|
||||||
name of the {foreach} loop can be anything you like, made up of
|
|
||||||
letters, numbers and underscores. <emphasis>{foreach}</emphasis>
|
|
||||||
loops can be nested, and the nested {foreach} names must be unique
|
|
||||||
from each other. The <emphasis>from</emphasis> variable (usually an
|
|
||||||
array of values) determines the number of times
|
|
||||||
<emphasis>{foreach}</emphasis> will loop.
|
|
||||||
<emphasis>{foreachelse}</emphasis> is executed when there are no
|
|
||||||
values in the <emphasis>from</emphasis> variable.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>{foreach} - item</title>
|
<title>{foreach} - item</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
|
@@ -209,10 +209,17 @@
|
|||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{* ------- if with php functions ------- *}
|
||||||
{* check for array. *}
|
{* check for array. *}
|
||||||
{if is_array($foo) }
|
{if is_array($foo) }
|
||||||
...do something
|
.....
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{* check for array. *}
|
||||||
|
{if isset($foo) }
|
||||||
|
.....
|
||||||
|
{/if}
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
@@ -2,6 +2,21 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.include.php">
|
<sect1 id="language.function.include.php">
|
||||||
<title>{include_php}</title>
|
<title>{include_php}</title>
|
||||||
|
<note>
|
||||||
|
<title>Technical Note</title>
|
||||||
|
<para>
|
||||||
|
{include_php} is pretty much deprecated from Smarty, you can
|
||||||
|
accomplish the same functionality via a custom template function.
|
||||||
|
The only reason to use {include_php} is if you really have a need to
|
||||||
|
quarantine the php function away from the
|
||||||
|
<link linkend="variable.plugins.dir">plugins</link>
|
||||||
|
directory or your
|
||||||
|
application code. See the <link
|
||||||
|
linkend="tips.componentized.templates">componentized template
|
||||||
|
example</link> for details.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -45,20 +60,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<note>
|
|
||||||
<title>Technical Note</title>
|
|
||||||
<para>
|
|
||||||
{include_php} is pretty much deprecated from Smarty, you can
|
|
||||||
accomplish the same functionality via a custom template function.
|
|
||||||
The only reason to use {include_php} is if you really have a need to
|
|
||||||
quarantine the php function away from the
|
|
||||||
<link linkend="variable.plugins.dir">plugins</link>
|
|
||||||
directory or your
|
|
||||||
application code. See the <link
|
|
||||||
linkend="tips.componentized.templates">componentized template
|
|
||||||
example</link> for details.
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
<para>
|
<para>
|
||||||
{include_php} tags are used to include a php script in your template.
|
{include_php} tags are used to include a php script in your template.
|
||||||
If <link linkend="variable.security">security is enabled</link>,
|
If <link linkend="variable.security">security is enabled</link>,
|
||||||
|
@@ -2,6 +2,19 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.include">
|
<sect1 id="language.function.include">
|
||||||
<title>{include}</title>
|
<title>{include}</title>
|
||||||
|
<para>
|
||||||
|
{include} tags are used for including other templates in the current
|
||||||
|
template. Any variables available in the current template are also
|
||||||
|
available within the included template. The {include} tag must have
|
||||||
|
the attribute "file", which contains the template resource path.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
You can optionally pass the <emphasis>'assign'</emphasis> attribute,
|
||||||
|
which will specify a template variable name that the output of
|
||||||
|
{include} will be assigned to instead of
|
||||||
|
displayed.
|
||||||
|
</para>
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -44,18 +57,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
{include} tags are used for including other templates in the current
|
|
||||||
template. Any variables available in the current template are also
|
|
||||||
available within the included template. The {include} tag must have
|
|
||||||
the attribute "file", which contains the template resource path.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
You can optionally pass the <emphasis>'assign'</emphasis> attribute,
|
|
||||||
which will specify a template variable name that the output of
|
|
||||||
{include} will be assigned to instead of
|
|
||||||
displayed.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>function {include}</title>
|
<title>function {include}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@@ -65,12 +67,12 @@
|
|||||||
<title>{$title}</title>
|
<title>{$title}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{include file="page_header.tpl"}
|
{include file='page_header.tpl'}
|
||||||
|
|
||||||
{* body of template goes here *}
|
{* body of template goes here *}
|
||||||
{include file="/$tpl_name.tpl"} <-- will replace $tpl_name with value
|
{include file="$tpl_name.tpl"} <-- will replace $tpl_name with value
|
||||||
|
|
||||||
{include file="page_footer.tpl"}
|
{include file='page_footer.tpl'}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
]]>
|
]]>
|
||||||
@@ -87,11 +89,11 @@
|
|||||||
<title>{include} passing variables</title>
|
<title>{include} passing variables</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
{include file='header.tpl' title='Main Menu' table_bgcolor='#c0c0c0'}
|
||||||
|
|
||||||
{* body of template goes here *}
|
{* body of template goes here *}
|
||||||
|
|
||||||
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}
|
{include file='footer.tpl' logo='http://my.example.com/logo.gif'}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>where header.tpl could be</para>
|
<para>where header.tpl could be</para>
|
||||||
@@ -115,13 +117,13 @@
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<body>
|
<body>
|
||||||
{include file="nav.tpl" assign="navbar"}
|
{include file='nav.tpl' assign=navbar}
|
||||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
{include file='header.tpl' title='Main Menu' table_bgcolor='#effeef'}
|
||||||
{$navbar}
|
{$navbar}
|
||||||
|
|
||||||
{* body of template goes here *}
|
{* body of template goes here *}
|
||||||
|
|
||||||
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}
|
{include file='footer.tpl' logo='http://my.example.com/logo.gif'}
|
||||||
{$navbar}
|
{$navbar}
|
||||||
</body>
|
</body>
|
||||||
]]>
|
]]>
|
||||||
@@ -140,16 +142,22 @@
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* absolute filepath *}
|
{* absolute filepath *}
|
||||||
{include file="/usr/local/include/templates/header.tpl"}
|
{include file='/usr/local/include/templates/header.tpl'}
|
||||||
|
|
||||||
{* absolute filepath (same thing) *}
|
{* absolute filepath (same thing) *}
|
||||||
{include file="file:/usr/local/include/templates/header.tpl"}
|
{include file='file:/usr/local/include/templates/header.tpl'}
|
||||||
|
|
||||||
{* windows absolute filepath (MUST use "file:" prefix) *}
|
{* windows absolute filepath (MUST use "file:" prefix) *}
|
||||||
{include file="file:C:/www/pub/templates/header.tpl"}
|
{include file='file:C:/www/pub/templates/header.tpl'}
|
||||||
|
|
||||||
{* include from template resource named "db" *}
|
{* include from template resource named "db" *}
|
||||||
{include file="db:header.tpl"}
|
{include file='db:header.tpl'}
|
||||||
|
|
||||||
|
{* include a $variable template - eg $module = 'contacts' *}
|
||||||
|
{include file="$module.tpl"}
|
||||||
|
{* wont work as its single quotes ie no variable substitution *}
|
||||||
|
{include file='$module.tpl'}
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
@@ -2,6 +2,14 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.insert">
|
<sect1 id="language.function.insert">
|
||||||
<title>{insert}</title>
|
<title>{insert}</title>
|
||||||
|
<para>
|
||||||
|
{insert} tags work much like <link
|
||||||
|
linkend="language.function.include">{include}</link> tags,
|
||||||
|
except that {insert} tags are NOT cached when you have
|
||||||
|
template <link linkend="caching">caching</link> enabled. They
|
||||||
|
will be executed on every invocation of the template.
|
||||||
|
</para>
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -52,13 +60,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
Insert tags work much like <link
|
|
||||||
linkend="language.function.include">{include}</link> tags,
|
|
||||||
except that {insert} tags are not cached when you have
|
|
||||||
template <link linkend="caching">caching</link> enabled. They
|
|
||||||
will be executed on every invocation of the template.
|
|
||||||
</para>
|
|
||||||
<para>
|
<para>
|
||||||
Let's say you have a template with a banner slot at the top of
|
Let's say you have a template with a banner slot at the top of
|
||||||
the page. The banner can contain any mixture of HTML, images,
|
the page. The banner can contain any mixture of HTML, images,
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
{php}
|
{php}
|
||||||
// including a php script directly
|
// including a php script directly
|
||||||
// from the template.
|
// from the template.
|
||||||
include("/path/to/display_weather.php");
|
include('/path/to/display_weather.php');
|
||||||
{/php}
|
{/php}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -29,6 +29,20 @@
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<title>{php} tags with global</title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
{php}
|
||||||
|
global $foo, $bar;
|
||||||
|
if($foo == $bar){
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
{/php}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
See also
|
See also
|
||||||
<link linkend="variable.php.handling">$php_handling</link>,
|
<link linkend="variable.php.handling">$php_handling</link>,
|
||||||
|
@@ -2,6 +2,23 @@
|
|||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.section">
|
<sect1 id="language.function.section">
|
||||||
<title>{section},{sectionelse}</title>
|
<title>{section},{sectionelse}</title>
|
||||||
|
<para>
|
||||||
|
Template sections are used for looping over
|
||||||
|
<emphasis role="bold">arrays of data</emphasis>
|
||||||
|
(just like <link linkend="language.function.foreach">{foreach}</link>). All
|
||||||
|
<emphasis>{section}</emphasis> tags must be paired with
|
||||||
|
<emphasis>{/section}</emphasis> tags. Required parameters are
|
||||||
|
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
|
||||||
|
of the {section} can be anything you like, made up of letters,
|
||||||
|
numbers and underscores. Sections can be nested, and the nested
|
||||||
|
section names must be unique from each other. The loop variable
|
||||||
|
(usually an array of values) determines the number of times the
|
||||||
|
section will loop. When printing a variable within a section, the
|
||||||
|
section name must be given next to variable name within brackets
|
||||||
|
[]. <emphasis>{sectionelse}</emphasis> is
|
||||||
|
executed when there are no values in the loop variable.
|
||||||
|
</para>
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -74,22 +91,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
|
||||||
Template sections are used for looping over
|
|
||||||
<emphasis role="bold">arrays of data</emphasis>
|
|
||||||
(just like <link linkend="language.function.foreach">{foreach}</link>). All
|
|
||||||
<emphasis>{section}</emphasis> tags must be paired with
|
|
||||||
<emphasis>{/section}</emphasis> tags. Required parameters are
|
|
||||||
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
|
|
||||||
of the {section} can be anything you like, made up of letters,
|
|
||||||
numbers and underscores. Sections can be nested, and the nested
|
|
||||||
section names must be unique from each other. The loop variable
|
|
||||||
(usually an array of values) determines the number of times the
|
|
||||||
section will loop. When printing a variable within a section, the
|
|
||||||
section name must be given next to variable name within brackets
|
|
||||||
[]. <emphasis>{sectionelse}</emphasis> is
|
|
||||||
executed when there are no values in the loop variable.
|
|
||||||
</para>
|
|
||||||
<example>
|
<example>
|
||||||
<title>{section}</title>
|
<title>{section}</title>
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<table border=0><tr><td><A HREF="http://w... snipped...</td></tr></table>
|
<table border='0'><tr><td><a href="http://. snipped...</a></td></tr></table>
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
Reference in New Issue
Block a user