cvs: smarty /docs/en/designers/language-builtin-functions language-function-section.xml
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1117115270@cvsserver> |
messju Thu May 26 09:47:50 2005 EDT
Modified files:
/smarty/docs/en/designers/language-builtin-functions
language-function-section.xml
Log:
fixed whitespaces by Peter
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
messju-20050526094750.txt
(text/plain, 11.9 KB)
http://cvs.php.net/diff.php/smarty/docs/en/designers/language-builtin-functions/language-function-section.xml?r1=1.9&r2=1.10&ty=u
Index: smarty/docs/en/designers/language-builtin-functions/language-function-section.xml
diff -u smarty/docs/en/designers/language-builtin-functions/language-function-section.xml:1.9 smarty/docs/en/designers/language-builtin-functions/language-function-section.xml:1.10
--- smarty/docs/en/designers/language-builtin-functions/language-function-section.xml:1.9 Wed May 25 15:13:20 2005
+++ smarty/docs/en/designers/language-builtin-functions/language-function-section.xml Thu May 26 09:47:49 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.9 $ -->
+<!-- $Revision: 1.10 $ -->
<sect1 id="language.function.section">
<title>{section},{sectionelse}</title>
<informaltable frame="all">
@@ -105,10 +105,10 @@
</programlisting>
<programlisting>
<![CDATA[
- {* this example will print out all the values of the $custid array *}
- {section name=customer loop=$custid}
- id: {$custid[customer]}<br />
- {/section}
+{* this example will print out all the values of the $custid array *}
+{section name=customer loop=$custid}
+ id: {$custid[customer]}<br />
+{/section}
<hr />
{* print out all the values of the $custid array reversed *}
{section name=foo loop=$custid step=-1}
@@ -121,9 +121,9 @@
</para>
<screen>
<![CDATA[
- id: 1000<br />
- id: 1001<br />
- id: 1002<br />
+id: 1000<br />
+id: 1001<br />
+id: 1002<br />
<hr />
id: 1002<br />
id: 1001<br />
@@ -183,13 +183,13 @@
This example assumes that $custid, $name and $address are all
arrays containing the same number of values
*}
- {section name=customer loop=$custid}
+{section name=customer loop=$custid}
<p>
- id: {$custid[customer]}<br />
- name: {$name[customer]}<br />
+ id: {$custid[customer]}<br />
+ name: {$name[customer]}<br />
address: {$address[customer]}
</p>
- {/section}
+{/section}
]]>
</programlisting>
<para>
@@ -198,18 +198,18 @@
<screen>
<![CDATA[
<p>
- id: 1000<br />
- name: John Smith<br />
+ id: 1000<br />
+ name: John Smith<br />
address: 253 N 45th
</p>
- <p>
- id: 1001<br />
- name: Jack Jones<br />
+<p>
+ id: 1001<br />
+ name: Jack Jones<br />
address: 417 Mulberry ln
</p>
- <p>
- id: 1002<br />
- name: Jane Munson<br />
+<p>
+ id: 1002<br />
+ name: Jane Munson<br />
address: 5605 apple st
</p>
]]>
@@ -225,12 +225,12 @@
as it is used to reference the data within the section
*}
{section name=anything loop=$custid}
- <p>
+<p>
id: {$custid[anything]}<br />
name: {$name[anything]}<br />
address: {$address[anything]}
</p>
- {/section}
+{/section}
]]>
</programlisting>
</example>
@@ -275,15 +275,15 @@
arrays. In this example, $contact_type[customer] is an array of
contact types for the current customer.
*}
- {section name=customer loop=$custid}
+{section name=customer loop=$custid}
<hr>
- id: {$custid[customer]}<br />
- name: {$name[customer]}<br />
- address: {$address[customer]}<br />
- {section name=contact loop=$contact_type[customer]}
- {$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
- {/section}
- {/section}
+ id: {$custid[customer]}<br />
+ name: {$name[customer]}<br />
+ address: {$address[customer]}<br />
+ {section name=contact loop=$contact_type[customer]}
+ {$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
+ {/section}
+{/section}
]]>
</programlisting>
<para>
@@ -292,28 +292,28 @@
<screen>
<![CDATA[
<hr>
- id: 1000<br />
- name: John Smith<br />
- address: 253 N 45th<br />
- home phone: 555-555-5555<br />
+ id: 1000<br />
+ name: John Smith<br />
+ address: 253 N 45th<br />
+ home phone: 555-555-5555<br />
cell phone: 666-555-5555<br />
- e-mail: [email protected]<br />
+ e-mail: [email protected]<br />
<hr>
- id: 1001<br />
- name: Jack Jones<br />
- address: 417 Mulberry ln<br />
+ id: 1001<br />
+ name: Jack Jones<br />
+ address: 417 Mulberry ln<br />
home phone: 123-456-4<br />
web: www.example.com<br />
<hr>
- id: 1002<br />
- name: Jane Munson<br />
- address: 5605 apple st<br />
+ id: 1002<br />
+ name: Jane Munson<br />
+ address: 5605 apple st<br />
cell phone: 0457878<br />
]]>
</screen>
</example>
-
+
<example>
<title>sections and associative arrays</title>
<programlisting role="php">
@@ -340,14 +340,14 @@
This is an example of printing an associative array
of data within a section
*}
- {section name=customer loop=$contacts}
+{section name=customer loop=$contacts}
<p>
- name: {$contacts[customer].name}<br />
- home: {$contacts[customer].home}<br />
- cell: {$contacts[customer].cell}<br />
+ name: {$contacts[customer].name}<br />
+ home: {$contacts[customer].home}<br />
+ cell: {$contacts[customer].cell}<br />
e-mail: {$contacts[customer].email}
</p>
- {/section}
+{/section}
]]>
</programlisting>
<para>
@@ -356,19 +356,19 @@
<screen>
<![CDATA[
<p>
- name: John Smith<br />
- home: 555-555-5555<br />
+ name: John Smith<br />
+ home: 555-555-5555<br />
cell: 666-555-5555<br />
e-mail: [email protected]
</p>
<p>
- name: Jack Jones<br />
+ name: Jack Jones<br />
home phone: 777-555-5555<br />
cell phone: 888-555-5555<br />
e-mail: [email protected]
</p>
<p>
- name: Jane Munson<br />
+ name: Jane Munson<br />
home phone: 000-555-5555<br />
cell phone: 123456<br />
e-mail: [email protected]
@@ -397,7 +397,7 @@
<tr><th> </th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
{section name=co loop=$contacts}
<tr>
- <td><a href="view.php?id={$contacts[customer].id}">view<a></td>
+ <td><a href="view.php?id={$contacts[co].id}">view<a></td>
<td>{$contacts[co].name}</td>
<td>{$contacts[co].home}</td>
<td>{$contacts[co].cell}</td>
@@ -413,12 +413,12 @@
<title>{sectionelse}</title>
<programlisting>
<![CDATA[
- {* sectionelse will execute if there are no $custid values *}
- {section name=customer loop=$custid}
- id: {$custid[customer]}<br />
- {sectionelse}
- there are no values in $custid.
- {/section}
+{* sectionelse will execute if there are no $custid values *}
+{section name=customer loop=$custid}
+ id: {$custid[customer]}<br />
+{sectionelse}
+ there are no values in $custid.
+{/section}
]]>
</programlisting>
</example>
@@ -446,7 +446,7 @@
<title>Technical Note</title>
<para>
If the step and start section properties are not
- modified, then this works the same as the <link
+ modified, then this works the same as the <link
linkend="section.property.iteration">iteration</link> section
property, except it starts at 0 instead of 1.
</para>
@@ -457,9 +457,9 @@
<![CDATA[
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
- {section name=customer loop=$custid}
- {$smarty.section.customer.index} id: {$custid[customer]}<br />
- {/section}
+{section name=customer loop=$custid}
+ {$smarty.section.customer.index} id: {$custid[customer]}<br />
+{/section}
]]>
</programlisting>
<para>
@@ -467,9 +467,9 @@
</para>
<screen>
<![CDATA[
- 0 id: 1000<br />
- 1 id: 1001<br />
- 2 id: 1002<br />
+0 id: 1000<br />
+1 id: 1001<br />
+2 id: 1002<br />
]]>
</screen>
</example>
@@ -511,8 +511,8 @@
<table>
<tr>
<th>index</th><th>id</th>
- <th>index_prev</th><th>prev id</th>
- <th>index_next</th><th>next id</th>
+ <th>index_prev</th><th>prev_id</th>
+ <th>index_next</th><th>next_id</th>
</tr>
{section name=cus loop=$custid}
<tr>
@@ -520,7 +520,7 @@
<td>{$smarty.section.cus.index_prev}</td><td>{$custid[cus.index_prev]}</td>
<td>{$smarty.section.cus.index_next}</td><td>{$custid[cus.index_next]}</td>
</tr>
- {/section}
+{/section}
</table>
]]>
</programlisting>
@@ -529,11 +529,11 @@
</para>
<screen>
<![CDATA[
-index id index_prev previd index_next nextid
-0 1001 -1 1 1002
-1 1002 0 1001 2 1003
-2 1003 1 1002 3 1004
-3 1004 2 1003 4 1005
+index id index_prev prev_id index_next next_id
+0 1001 -1 1 1002
+1 1002 0 1001 2 1003
+2 1003 1 1002 3 1004
+3 1004 2 1003 4 1005
4 1005 3 1004 5
]]>
</screen>
@@ -574,7 +574,7 @@
iteration={$smarty.section.cu.iteration}
index={$smarty.section.cu.index}
id={$custid[cu]}<br />
- {/section}
+{/section}
]]>
</programlisting>
<para>
@@ -602,7 +602,7 @@
{section name=co loop=$contacts}
{if $smarty.section.co.iteration % 5 == 1}
<tr><th> </th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
- {/if}
+ {/if}
<tr>
<td><a href="view.php?id={$contacts[co].id}">view<a></td>
<td>{$contacts[co].name}</td>
@@ -610,7 +610,7 @@
<td>{$contacts[co].cell}</td>
<td>{$contacts[co].email}</td>
<tr>
- {/section}
+{/section}
</table>
]]>
</programlisting>
@@ -646,21 +646,21 @@
<programlisting>
<![CDATA[
{section name=customer loop=$customers}
- {if $smarty.section.customer.first}
+ {if $smarty.section.customer.first}
<table>
<tr><th>id</th><th>customer</th></tr>
- {/if}
+ {/if}
<tr>
<td>{$customers[customer].id}}</td>
<td>{$customers[customer].name}</td>
</tr>
- {if $smarty.section.customer.last}
+ {if $smarty.section.customer.last}
<tr><td></td><td>{$smarty.section.customer.total} customers</td></tr>
</table>
- {/if}
- {/section}
+ {/if}
+{/section}
]]>
</programlisting>
</example>
@@ -686,9 +686,9 @@
<title>{section} property index</title>
<programlisting>
<![CDATA[
- {section name=customer loop=$custid}
- {$smarty.section.customer.index} id: {$custid[customer]}<br />
- {/section}
+{section name=customer loop=$custid}
+ {$smarty.section.customer.index} id: {$custid[customer]}<br />
+{/section}
There were {$smarty.section.customer.loop} customers shown above.
]]>
@@ -698,9 +698,9 @@
</para>
<screen>
<![CDATA[
- 0 id: 1000<br />
- 1 id: 1001<br />
- 2 id: 1002<br />
+0 id: 1000<br />
+1 id: 1001<br />
+2 id: 1002<br />
There were 3 customers shown above.
]]>
@@ -723,15 +723,15 @@
$show_customer_info (true/false) may have been passed from the PHP
application, to regulate whether or not this section shows
*}
- {section name=customer loop=$custid show=$show_customer_info}
- {$smarty.section.customer.rownum} id: {$custid[customer]}<br />
- {/section}
-
- {if $smarty.section.customer.show}
- the section was shown.
- {else}
- the section was not shown.
- {/if}
+{section name=customer loop=$custid show=$show_customer_info}
+ {$smarty.section.customer.rownum} id: {$custid[customer]}<br />
+{/section}
+
+{if $smarty.section.customer.show}
+ the section was shown.
+{else}
+ the section was not shown.
+{/if}
]]>
</programlisting>
<para>
@@ -739,11 +739,11 @@
</para>
<screen>
<![CDATA[
- 1 id: 1000<br />
- 2 id: 1001<br />
- 3 id: 1002<br />
+1 id: 1000<br />
+2 id: 1001<br />
+3 id: 1002<br />
- the section was shown.
+the section was shown.
]]>
</screen>
</example>
@@ -758,9 +758,9 @@
<title>{section} property total</title>
<programlisting>
<![CDATA[
- {section name=customer loop=$custid step=2}
- {$smarty.section.customer.index} id: {$custid[customer]}<br />
- {/section}
+{section name=customer loop=$custid step=2}
+ {$smarty.section.customer.index} id: {$custid[customer]}<br />
+{/section}
There were {$smarty.section.customer.total} customers shown above.
]]>
@@ -770,11 +770,11 @@
</para>
<screen>
<![CDATA[
- 0 id: 1000<br />
+0 id: 1000<br />
2 id: 1002<br />
4 id: 1004<br />
- There were 3 customers shown above.
+There were 3 customers shown above.
]]>
</screen>
</example>