mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
fixed whitespaces by Peter
This commit is contained in:
@@ -105,10 +105,10 @@ $smarty->assign('custid',$data);
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* this example will print out all the values of the $custid array *}
|
||||
{section name=customer loop=$custid}
|
||||
{* this example will print out all the values of the $custid array *}
|
||||
{section name=customer loop=$custid}
|
||||
id: {$custid[customer]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
<hr />
|
||||
{* print out all the values of the $custid array reversed *}
|
||||
{section name=foo loop=$custid step=-1}
|
||||
@@ -121,9 +121,9 @@ $smarty->assign('custid',$data);
|
||||
</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 @@ $smarty->assign('address',$addr);
|
||||
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 />
|
||||
address: {$address[customer]}
|
||||
</p>
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -202,12 +202,12 @@ $smarty->assign('address',$addr);
|
||||
name: John Smith<br />
|
||||
address: 253 N 45th
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
id: 1001<br />
|
||||
name: Jack Jones<br />
|
||||
address: 417 Mulberry ln
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
id: 1002<br />
|
||||
name: Jane Munson<br />
|
||||
address: 5605 apple st
|
||||
@@ -225,12 +225,12 @@ $smarty->assign('address',$addr);
|
||||
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,7 +275,7 @@ $smarty->assign('contact_info', $info);
|
||||
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 />
|
||||
@@ -283,7 +283,7 @@ $smarty->assign('contact_info', $info);
|
||||
{section name=contact loop=$contact_type[customer]}
|
||||
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -340,14 +340,14 @@ $smarty->assign('contacts',$data);
|
||||
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 />
|
||||
e-mail: {$contacts[customer].email}
|
||||
</p>
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -397,7 +397,7 @@ $smarty->assign('contacts',$db->getAll($sql) );
|
||||
<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 @@ $smarty->assign('contacts',$db->getAll($sql) );
|
||||
<title>{sectionelse}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* sectionelse will execute if there are no $custid values *}
|
||||
{section name=customer loop=$custid}
|
||||
{* sectionelse will execute if there are no $custid values *}
|
||||
{section name=customer loop=$custid}
|
||||
id: {$custid[customer]}<br />
|
||||
{sectionelse}
|
||||
{sectionelse}
|
||||
there are no values in $custid.
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
@@ -457,9 +457,9 @@ $smarty->assign('contacts',$db->getAll($sql) );
|
||||
<![CDATA[
|
||||
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
||||
|
||||
{section name=customer loop=$custid}
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -467,9 +467,9 @@ $smarty->assign('contacts',$db->getAll($sql) );
|
||||
</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 @@ $smarty->assign('custid',$data);
|
||||
<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 @@ $smarty->assign('custid',$data);
|
||||
<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,7 +529,7 @@ $smarty->assign('custid',$data);
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
index id index_prev previd index_next nextid
|
||||
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
|
||||
@@ -574,7 +574,7 @@ $smarty->assign('custid',$id);
|
||||
iteration={$smarty.section.cu.iteration}
|
||||
index={$smarty.section.cu.index}
|
||||
id={$custid[cu]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -610,7 +610,7 @@ iteration=6 index=15 id=3015<br />
|
||||
<td>{$contacts[co].cell}</td>
|
||||
<td>{$contacts[co].email}</td>
|
||||
<tr>
|
||||
{/section}
|
||||
{/section}
|
||||
</table>
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -660,7 +660,7 @@ iteration=6 index=15 id=3015<br />
|
||||
<tr><td></td><td>{$smarty.section.customer.total} customers</td></tr>
|
||||
</table>
|
||||
{/if}
|
||||
{/section}
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
@@ -686,9 +686,9 @@ iteration=6 index=15 id=3015<br />
|
||||
<title>{section} property index</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{section name=customer loop=$custid}
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
|
||||
There were {$smarty.section.customer.loop} customers shown above.
|
||||
]]>
|
||||
@@ -698,9 +698,9 @@ iteration=6 index=15 id=3015<br />
|
||||
</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 @@ iteration=6 index=15 id=3015<br />
|
||||
$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}
|
||||
{section name=customer loop=$custid show=$show_customer_info}
|
||||
{$smarty.section.customer.rownum} id: {$custid[customer]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
|
||||
{if $smarty.section.customer.show}
|
||||
{if $smarty.section.customer.show}
|
||||
the section was shown.
|
||||
{else}
|
||||
{else}
|
||||
the section was not shown.
|
||||
{/if}
|
||||
{/if}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -739,11 +739,11 @@ iteration=6 index=15 id=3015<br />
|
||||
</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 @@ iteration=6 index=15 id=3015<br />
|
||||
<title>{section} property total</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{section name=customer loop=$custid step=2}
|
||||
{section name=customer loop=$custid step=2}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
||||
{/section}
|
||||
{/section}
|
||||
|
||||
There were {$smarty.section.customer.total} customers shown above.
|
||||
]]>
|
||||
@@ -770,11 +770,11 @@ iteration=6 index=15 id=3015<br />
|
||||
</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>
|
||||
|
Reference in New Issue
Block a user