update docs, get modifiers and functions into index for easy access

This commit is contained in:
mohrt
2002-04-15 19:01:48 +00:00
parent 7912d0b3d0
commit bd4ad753d7

View File

@@ -1,14 +1,7 @@
<part id="smarty.for.designers"> <part id="smarty.for.designers">
<title>Smarty For Template Designers</title> <title>Smarty For Template Designers</title>
<chapter id="language">
<title>Template Language</title>
<para>
The templates are the language of Smarty. These are the files that the designers
work with. They're basically pages made up of static content interspersed with
template markup tags. These tags are placeholders for variables or blocks of logic.
</para>
<sect1 id="language.basic.syntax"> <chapter id="language.basic.syntax">
<title>Basic Syntax</title> <title>Basic Syntax</title>
<para> <para>
All Smarty template tags are enclosed within delimiters. By All Smarty template tags are enclosed within delimiters. By
@@ -23,7 +16,7 @@
place. place.
</para> </para>
<sect2 id="language.syntax.comments"> <sect1 id="language.syntax.comments">
<title>Comments</title> <title>Comments</title>
<para> <para>
Template comments are surrounded by asterisks, and that is surrounded Template comments are surrounded by asterisks, and that is surrounded
@@ -48,9 +41,9 @@
{html_options values=$vals selected=$selected output=$output} {html_options values=$vals selected=$selected output=$output}
&lt;/SELECT&gt;</programlisting> &lt;/SELECT&gt;</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.syntax.functions"> <sect1 id="language.syntax.functions">
<title>Functions</title> <title>Functions</title>
<para> <para>
Each Smarty tag either prints a Each Smarty tag either prints a
@@ -83,9 +76,9 @@
your liking, or you can add new ones. <command>html_options</command> and your liking, or you can add new ones. <command>html_options</command> and
<command>html_select_date</command> are examples of custom functions. <command>html_select_date</command> are examples of custom functions.
</para> </para>
</sect2> </sect1>
<sect2 id="language.syntax.attributes"> <sect1 id="language.syntax.attributes">
<title>Attributes</title> <title>Attributes</title>
<para> <para>
Most of the functions take attributes that specify or modify Most of the functions take attributes that specify or modify
@@ -116,11 +109,11 @@
{html_options values=$vals selected=$selected output=$output} {html_options values=$vals selected=$selected output=$output}
&lt;/SELECT&gt;</programlisting> &lt;/SELECT&gt;</programlisting>
</example> </example>
</sect2> </sect1>
</sect1> </chapter>
<sect1 id="language.variables"> <chapter id="language.variables">
<title>Variables</title> <title>Variables</title>
<para> <para>
Smarty has several different types of variables, all of which are Smarty has several different types of variables, all of which are
@@ -141,7 +134,7 @@
&lt;body bgcolr="{#bgcolor#}"&gt;</programlisting> &lt;body bgcolr="{#bgcolor#}"&gt;</programlisting>
</para> </para>
<sect2 id="language.assigned.variables"> <sect1 id="language.assigned.variables">
<title>Variables assigned from PHP</title> <title>Variables assigned from PHP</title>
<para> <para>
Variables that are assigned from PHP are referenced by preceding Variables that are assigned from PHP are referenced by preceding
@@ -162,7 +155,7 @@ Hello Doug, glad to see you could make it.
Your last login was on January 11th, 2001.</programlisting> Your last login was on January 11th, 2001.</programlisting>
</example> </example>
<sect3 id="language.variables.assoc.arrays"> <sect2 id="language.variables.assoc.arrays">
<title>Associative arrays</title> <title>Associative arrays</title>
<para> <para>
You can also reference associative array variables that are You can also reference associative array variables that are
@@ -186,8 +179,8 @@ zaphod@slartibartfast.com&lt;br&gt;
555-111-1234&lt;br&gt; 555-111-1234&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3 id="language.variables.array.indexes"> <sect2 id="language.variables.array.indexes">
<title>Array indexes</title> <title>Array indexes</title>
<para> <para>
You can reference arrays by their index, much like native PHP You can reference arrays by their index, much like native PHP
@@ -202,8 +195,8 @@ zaphod@slartibartfast.com&lt;br&gt;
{$Contacts[0][0]}&lt;br&gt; {$Contacts[0][0]}&lt;br&gt;
{$Contacts[0][1]}&lt;br&gt;</programlisting> {$Contacts[0][1]}&lt;br&gt;</programlisting>
</example> </example>
</sect3> </sect2>
<sect3 id="language.variables.objects"> <sect2 id="language.variables.objects">
<title>Objects</title> <title>Objects</title>
<para> <para>
Properties of objects assigned from PHP can be referenced Properties of objects assigned from PHP can be referenced
@@ -220,10 +213,10 @@ OUTPUT:
name: Zaphod Beeblebrox&lt;br&gt; name: Zaphod Beeblebrox&lt;br&gt;
email: zaphod@slartibartfast.com&lt;br&gt;</programlisting> email: zaphod@slartibartfast.com&lt;br&gt;</programlisting>
</example> </example>
</sect3> </sect2>
</sect2> </sect1>
<sect2 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 enclosing Variables that are loaded from the config files are referenced by enclosing
@@ -252,16 +245,16 @@ email: zaphod@slartibartfast.com&lt;br&gt;</programlisting>
explained later in this document under explained later in this document under
<command>config_load</command>. <command>config_load</command>.
</para> </para>
</sect2> </sect1>
<sect2 id="language.variables.smarty"> <sect1 id="language.variables.smarty">
<title>{$smarty} reserved variable</title> <title>{$smarty} reserved variable</title>
<para> <para>
The reserved {$smarty} variable can be used to access several The reserved {$smarty} variable can be used to access several
special template variables. The full list of them follows. special template variables. The full list of them follows.
</para> </para>
<sect3 id="language.variables.smarty.request"> <sect2 id="language.variables.smarty.request">
<title>Request variables</title> <title>Request variables</title>
<para> <para>
The request variables such as get, post, cookies, server, The request variables such as get, post, cookies, server,
@@ -293,9 +286,9 @@ email: zaphod@slartibartfast.com&lt;br&gt;</programlisting>
{* display the variable "username" from merged get/post/cookies/server/env *} {* display the variable "username" from merged get/post/cookies/server/env *}
{$smarty.request.username}</programlisting> {$smarty.request.username}</programlisting>
</example> </example>
</sect3> </sect2>
<sect3 id="language.variables.smarty.now"> <sect2 id="language.variables.smarty.now">
<title>Current timestamp</title> <title>Current timestamp</title>
<para> <para>
The current timestamp can be accessed with {$smarty.now}. The The current timestamp can be accessed with {$smarty.now}. The
@@ -310,18 +303,18 @@ email: zaphod@slartibartfast.com&lt;br&gt;</programlisting>
{* use the date_format modifier to show current date and time *} {* use the date_format modifier to show current date and time *}
{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}</programlisting> {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}</programlisting>
</example> </example>
</sect3> </sect2>
<sect3 id="language.variables.smarty.capture"> <sect2 id="language.variables.smarty.capture">
<title>Output capture buffer</title> <title>Output capture buffer</title>
<para> <para>
The output captured via {capture}..{/capture} construct can be The output captured via {capture}..{/capture} construct can be
accessed using {$smarty} variable. See section on accessed using {$smarty} variable. See section on
<link linkend="language.function.capture">capture</link> for an example. <link linkend="language.function.capture">capture</link> for an example.
</para> </para>
</sect3> </sect2>
<sect3 id="language.variables.smarty.loops"> <sect2 id="language.variables.smarty.loops">
<title>Loop properties</title> <title>Loop properties</title>
<para> <para>
{$smarty} variable can be used to refer to 'section' and {$smarty} variable can be used to refer to 'section' and
@@ -329,11 +322,11 @@ email: zaphod@slartibartfast.com&lt;br&gt;</programlisting>
<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>.
</para> </para>
</sect3>
</sect2> </sect2>
</sect1> </sect1>
</chapter>
<sect1 id="language.modifiers"> <chapter id="language.modifiers">
<title>Variable Modifiers</title> <title>Variable Modifiers</title>
<para> <para>
Variable modifiers can be applied to any variable to alter its contents. To Variable modifiers can be applied to any variable to alter its contents. To
@@ -360,9 +353,7 @@ Topic: {$topic|truncate:40:"..."}</programlisting>
elements in the $articleTitle array.) elements in the $articleTitle array.)
</para> </para>
<sect2 id="language.builtin.modifiers"> <sect1>
<title>Built-in Modifiers</title>
<sect3>
<title>capitalize</title> <title>capitalize</title>
<para> <para>
This is used to capitalize the first letter of all words in a variable. This is used to capitalize the first letter of all words in a variable.
@@ -378,8 +369,8 @@ OUTPUT:
Police begin campaign to rundown jaywalkers. Police begin campaign to rundown jaywalkers.
Police Begin Campaign To Rundown Jaywalkers.</programlisting> Police Begin Campaign To Rundown Jaywalkers.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>count_characters</title> <title>count_characters</title>
<para> <para>
This is used to count the number of characters in a variable. This is used to count the number of characters in a variable.
@@ -396,8 +387,8 @@ OUTPUT:
Cold Wave Linked to Temperatures Cold Wave Linked to Temperatures
32</programlisting> 32</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>count_paragraphs</title> <title>count_paragraphs</title>
<para> <para>
This is used to count the number of paragraphs in a variable. This is used to count the number of paragraphs in a variable.
@@ -416,8 +407,8 @@ War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation. Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
2</programlisting> 2</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>count_sentences</title> <title>count_sentences</title>
<para> <para>
This is used to count the number of sentences in a variable. This is used to count the number of sentences in a variable.
@@ -434,8 +425,8 @@ OUTPUT:
Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe. Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
2</programlisting> 2</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>count_words</title> <title>count_words</title>
<para> <para>
This is used to count the number of words in a variable. This is used to count the number of words in a variable.
@@ -452,8 +443,8 @@ OUTPUT:
Dealers Will Hear Car Talk at Noon. Dealers Will Hear Car Talk at Noon.
7</programlisting> 7</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="date.format"> <sect1 id="date.format">
<title>date_format</title> <title>date_format</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -589,8 +580,8 @@ on your system's strftime() function where PHP was compiled. Check your
system's manpage for a full list of valid specifiers.</programlisting> system's manpage for a full list of valid specifiers.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>default</title> <title>default</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -635,8 +626,8 @@ OUTPUT:
no title</programlisting> no title</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>escape</title> <title>escape</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=6> <tgroup cols=6>
@@ -699,8 +690,8 @@ OUTPUT:
&lt;a &lt;a
href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74"&gt;&amp;#x62;&amp;#x6f;&amp;#x62;&amp;#x40;&amp;#x6d;&amp;#x65;&amp;#x2e;&amp;#x6e;&amp;#x65;&amp;#x74;&lt;/a&gt;</programlisting> href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74"&gt;&amp;#x62;&amp;#x6f;&amp;#x62;&amp;#x40;&amp;#x6d;&amp;#x65;&amp;#x2e;&amp;#x6e;&amp;#x65;&amp;#x74;&lt;/a&gt;</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>indent</title> <title>indent</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -772,8 +763,8 @@ Statistics show that teen pregnancy drops off significantly after 25.
Sun or rain expected today, dark tonight. Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.</programlisting> Statistics show that teen pregnancy drops off significantly after 25.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>lower</title> <title>lower</title>
<para> <para>
This is used to lowercase a variable. This is used to lowercase a variable.
@@ -789,8 +780,8 @@ OUTPUT:
Two Convicts Evade Noose, Jury Hung. Two Convicts Evade Noose, Jury Hung.
two convicts evade noose, jury hung.</programlisting> two convicts evade noose, jury hung.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>regex_replace</title> <title>regex_replace</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -847,8 +838,8 @@ Infertility unlikely to
be passed on, experts say be passed on, experts say
Infertility unlikely to be passed on, experts say</programlisting> Infertility unlikely to be passed on, experts say</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>replace</title> <title>replace</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -900,8 +891,8 @@ Child's Stool Great for Use in Garden.
Child's Stool Great for Use in Vineyard. Child's Stool Great for Use in Vineyard.
Child's Stool Great for Use in Garden.</programlisting> Child's Stool Great for Use in Garden.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>spacify</title> <title>spacify</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -948,8 +939,8 @@ Something Went Wrong in Jet Crash, Experts Say.
S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y . S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.</programlisting> S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>string_format</title> <title>string_format</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -995,8 +986,8 @@ OUTPUT:
23.58 23.58
24</programlisting> 24</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>strip_tags</title> <title>strip_tags</title>
<para> <para>
This strips out markup tags, basically anything between &lt; and &gt;. This strips out markup tags, basically anything between &lt; and &gt;.
@@ -1012,8 +1003,8 @@ OUTPUT:
Blind Woman Gets &lt;font face="helvetica"&gt;New Kidney&lt;/font&gt; from Dad she Hasn't Seen in &lt;b&gt;years&lt;/b&gt;. Blind Woman Gets &lt;font face="helvetica"&gt;New Kidney&lt;/font&gt; from Dad she Hasn't Seen in &lt;b&gt;years&lt;/b&gt;.
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.</programlisting> Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>truncate</title> <title>truncate</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -1088,8 +1079,8 @@ Two Sisters Reunite after---
Two Sisters Reunite after Eigh Two Sisters Reunite after Eigh
Two Sisters Reunite after E...</programlisting> Two Sisters Reunite after E...</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>upper</title> <title>upper</title>
<para> <para>
This is used to uppercase a variable. This is used to uppercase a variable.
@@ -1105,8 +1096,8 @@ OUTPUT:
If Strike isn't Settled Quickly it may Last a While. If Strike isn't Settled Quickly it may Last a While.
IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.</programlisting> IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3> <sect1>
<title>wordwrap</title> <title>wordwrap</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -1192,10 +1183,11 @@ Blind woman gets new kidney fr
om dad she hasn't seen in om dad she hasn't seen in
years.</programlisting> years.</programlisting>
</example> </example>
</sect3> </sect1>
</sect2>
<sect2 id="language.combining.modifiers"> </chapter>
<chapter id="language.combining.modifiers">
<title>Combining Modifiers</title> <title>Combining Modifiers</title>
<para> <para>
You can apply as many modifiers as you like to a variable. The modifiers You can apply as many modifiers as you like to a variable. The modifiers
@@ -1221,17 +1213,17 @@ s m o k e r s a r e p r o d u c t i v e , b u t d e a t h c u t s...
s m o k e r s a r e p r o d u c t i v e , b u t . . . s m o k e r s a r e p r o d u c t i v e , b u t . . .
s m o k e r s a r e p. . .</programlisting> s m o k e r s a r e p. . .</programlisting>
</example> </example>
</sect2> </chapter>
</sect1>
<sect1 id="language.builtin.functions">
<chapter id="language.builtin.functions">
<title>Built-in Functions</title> <title>Built-in Functions</title>
<para> <para>
Smarty comes with several built-in functions. Built-in functions Smarty comes with several built-in functions. Built-in functions
are integral to the template language. You cannot create custom are integral to the template language. You cannot create custom
functions with the same names, nor can you modify built-in functions. functions with the same names, nor can you modify built-in functions.
</para> </para>
<sect2 id="language.function.capture"> <sect1 id="language.function.capture">
<title>capture</title> <title>capture</title>
<para> <para>
capture is used to collect the output of the template into a capture is used to collect the output of the template into a
@@ -1275,8 +1267,8 @@ s m o k e r s a r e p. . .</programlisting>
{/if}</programlisting> {/if}</programlisting>
</example> </example>
</para> </para>
</sect2> </sect1>
<sect2 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>
@@ -1393,8 +1385,8 @@ s m o k e r s a r e p. . .</programlisting>
&lt;/body&gt; &lt;/body&gt;
&lt;/html&gt;</programlisting> &lt;/html&gt;</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.include"> <sect1 id="language.function.include">
<title>include</title> <title>include</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -1495,8 +1487,8 @@ s m o k e r s a r e p. . .</programlisting>
{* include from template resource named "db" *} {* include from template resource named "db" *}
{include file="db:header.tpl"}</programlisting> {include file="db:header.tpl"}</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.include.php"> <sect1 id="language.function.include.php">
<title>include_php</title> <title>include_php</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -1586,8 +1578,8 @@ index.tpl
&lt;a href="{$curr_section.url}"&gt;{$curr_section.name}&lt;/a&gt;&lt;br&gt; &lt;a href="{$curr_section.url}"&gt;{$curr_section.name}&lt;/a&gt;&lt;br&gt;
{/foreach}</programlisting> {/foreach}</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.insert"> <sect1 id="language.function.insert">
<title>insert</title> <title>insert</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -1705,8 +1697,8 @@ index.tpl
weather, search results, user feedback areas, etc. weather, search results, user feedback areas, etc.
</para> </para>
</note> </note>
</sect2> </sect1>
<sect2 id="language.function.if"> <sect1 id="language.function.if">
<title>if,elseif,else</title> <title>if,elseif,else</title>
<para> <para>
if statements in Smarty have much the same flexibility as php if if statements in Smarty have much the same flexibility as php if
@@ -1785,8 +1777,8 @@ index.tpl
... ...
{/if}</programlisting> {/if}</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.ldelim"> <sect1 id="language.function.ldelim">
<title>ldelim,rdelim</title> <title>ldelim,rdelim</title>
<para> <para>
ldelim and rdelim are used for displaying the literal delimiter, in ldelim and rdelim are used for displaying the literal delimiter, in
@@ -1805,8 +1797,8 @@ OUTPUT:
{funcname} is how functions look in Smarty!</programlisting> {funcname} is how functions look in Smarty!</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.literal"> <sect1 id="language.function.literal">
<title>literal</title> <title>literal</title>
<para> <para>
Literal tags allow a block of data to be taken literally, Literal tags allow a block of data to be taken literally,
@@ -1837,8 +1829,8 @@ OUTPUT:
&lt;/script&gt; &lt;/script&gt;
{/literal}</programlisting> {/literal}</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.php"> <sect1 id="language.function.php">
<title>php</title> <title>php</title>
<para> <para>
php tags allow php to be embedded directly into the template. They php tags allow php to be embedded directly into the template. They
@@ -1856,8 +1848,8 @@ OUTPUT:
include("/path/to/display_weather.php"); include("/path/to/display_weather.php");
{/php}</programlisting> {/php}</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.section"> <sect1 id="language.function.section">
<title>section,sectionelse</title> <title>section,sectionelse</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2101,7 +2093,7 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
supported, but you will only see reference to the new syntax in the supported, but you will only see reference to the new syntax in the
manual examples. manual examples.
</para> </para>
<sect3> <sect2>
<title>index</title> <title>index</title>
<para> <para>
index is used to display the current loop index, starting with zero index is used to display the current loop index, starting with zero
@@ -2131,8 +2123,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
2 id: 1002&lt;br&gt; 2 id: 1002&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>index_prev</title> <title>index_prev</title>
<para> <para>
index_prev is used to display the previous loop index. index_prev is used to display the previous loop index.
@@ -2160,8 +2152,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
The customer id changed&lt;br&gt; The customer id changed&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>index_next</title> <title>index_next</title>
<para> <para>
index_next is used to display the next loop index. On the last index_next is used to display the next loop index. On the last
@@ -2190,8 +2182,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
The customer id will change&lt;br&gt; The customer id will change&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>iteration</title> <title>iteration</title>
<para> <para>
iteration is used to display the current loop iteration. iteration is used to display the current loop iteration.
@@ -2229,8 +2221,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
The customer id will change&lt;br&gt; The customer id will change&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>first</title> <title>first</title>
<para> <para>
first is set to true if the current section iteration is the first first is set to true if the current section iteration is the first
@@ -2262,8 +2254,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
&lt;/table&gt; &lt;/table&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>last</title> <title>last</title>
<para> <para>
last is set to true if the current section iteration is the last last is set to true if the current section iteration is the last
@@ -2295,8 +2287,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
&lt;/table&gt; &lt;/table&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>rownum</title> <title>rownum</title>
<para> <para>
rownum is used to display the current loop iteration, rownum is used to display the current loop iteration,
@@ -2317,8 +2309,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
3 id: 1002&lt;br&gt; 3 id: 1002&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>loop</title> <title>loop</title>
<para> <para>
loop is used to display the last index number that this section loop is used to display the last index number that this section
@@ -2342,8 +2334,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
There were 3 customers shown above. There were 3 customers shown above.
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>show</title> <title>show</title>
<para> <para>
<emphasis>show</emphasis> is used as a parameter to section. <emphasis>show</emphasis> is used as a parameter to section.
@@ -2376,8 +2368,8 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
the section was shown. the section was shown.
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
<sect3> <sect2>
<title>total</title> <title>total</title>
<para> <para>
total is used to display the number of iterations that this section total is used to display the number of iterations that this section
@@ -2404,9 +2396,9 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
There were 3 customers shown above. There were 3 customers shown above.
</programlisting> </programlisting>
</example> </example>
</sect3> </sect2>
</sect2> </sect1>
<sect2 id="language.function.foreach"> <sect1 id="language.function.foreach">
<title>foreach,foreachelse</title> <title>foreach,foreachelse</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2519,8 +2511,8 @@ phone: 555-4444&lt;br&gt;
fax: 555-3333&lt;br&gt; fax: 555-3333&lt;br&gt;
cell: 760-1234&lt;br&gt;</programlisting> cell: 760-1234&lt;br&gt;</programlisting>
</example> </example>
</sect2> </sect1>
<sect2 id="language.function.strip"> <sect1 id="language.function.strip">
<title>strip</title> <title>strip</title>
<para> <para>
Many times web designers Many times web designers
@@ -2564,19 +2556,16 @@ OUTPUT:
If you have plain text at the beginning or end of any line, If you have plain text at the beginning or end of any line,
they will be run together, and may not be desired results. they will be run together, and may not be desired results.
</para> </para>
</sect2> </sect1>
</sect1> </chapter>
<sect1 id="language.custom.functions.top"> <chapter id="language.custom.functions">
<title>Custom Functions</title> <title>Custom Functions</title>
<para> <para>
Smarty comes with several custom functions that you can Smarty comes with several custom functions that you can
use in the templates. use in the templates.
</para> </para>
<sect1 id="language.function.assign">
<sect2 id="language.custom.functions">
<title>Custom Functions</title>
<sect3 id="language.function.assign">
<title>assign</title> <title>assign</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2630,8 +2619,8 @@ OUTPUT:
The value of $name is Bob.</programlisting> The value of $name is Bob.</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.counter"> <sect1 id="language.function.counter">
<title>counter</title> <title>counter</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2727,8 +2716,8 @@ OUTPUT:
6&lt;br&gt; 6&lt;br&gt;
8&lt;br&gt;</programlisting> 8&lt;br&gt;</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.eval"> <sect1 id="language.function.eval">
<title>eval</title> <title>eval</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2824,8 +2813,8 @@ You must supply a &lt;b&gt;state&lt;/b&gt;.
</programlisting> </programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.fetch"> <sect1 id="language.function.fetch">
<title>fetch</title> <title>fetch</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2909,8 +2898,8 @@ You must supply a &lt;b&gt;state&lt;/b&gt;.
&lt;b&gt;{$weather}&lt;/b&gt; &lt;b&gt;{$weather}&lt;/b&gt;
{/if}</programlisting> {/if}</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.html.options"> <sect1 id="language.function.html.options">
<title>html_options</title> <title>html_options</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -2999,8 +2988,8 @@ OUTPUT:
&lt;option value="1003">Charlie Brown&lt;/option&gt; &lt;option value="1003">Charlie Brown&lt;/option&gt;
&lt;/select&gt;</programlisting> &lt;/select&gt;</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.html.select.date"> <sect1 id="language.function.html.select.date">
<title>html_select_date</title> <title>html_select_date</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -3283,8 +3272,8 @@ OUTPUT: (current year is 2000)
&lt;option value="2001"&gt;2001&lt;/option&gt; &lt;option value="2001"&gt;2001&lt;/option&gt;
&lt;/select&gt;</programlisting> &lt;/select&gt;</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.html.select.time"> <sect1 id="language.function.html.select.time">
<title>html_select_time</title> <title>html_select_time</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -3544,8 +3533,8 @@ OUTPUT:
&lt;option value="pm"&gt;PM&lt;/option&gt; &lt;option value="pm"&gt;PM&lt;/option&gt;
&lt;/select&gt;</programlisting> &lt;/select&gt;</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.math"> <sect1 id="language.function.math">
<title>math</title> <title>math</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -3658,8 +3647,8 @@ OUTPUT:
9.44</programlisting> 9.44</programlisting>
</example> </example>
</sect3> </sect1>
<sect3 id="language.function.popup.init"> <sect1 id="language.function.popup.init">
<title>popup_init</title> <title>popup_init</title>
<para> <para>
popup is an integration of overLib, a library used for popup popup is an integration of overLib, a library used for popup
@@ -3673,8 +3662,8 @@ OUTPUT:
<para> <para>
This was added to Smarty 1.4.4. This was added to Smarty 1.4.4.
</para> </para>
</sect3> </sect1>
<sect3 id="language.function.popup"> <sect1 id="language.function.popup">
<title>popup</title> <title>popup</title>
<informaltable frame=all> <informaltable frame=all>
<tgroup cols=5> <tgroup cols=5>
@@ -4084,10 +4073,8 @@ OUTPUT:
(See the Smarty official web site for working examples.)</programlisting> (See the Smarty official web site for working examples.)</programlisting>
</example> </example>
</sect3> </sect1>
</sect2> </chapter>
</sect1>
</chapter>
<chapter id="config.files"> <chapter id="config.files">
<title>Config Files</title> <title>Config Files</title>