fixed whitespaces by Peter

This commit is contained in:
messju
2005-05-26 13:47:49 +00:00
parent b84a9d2d46
commit 4fffc09895

View File

@@ -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}
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 @@ $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 />
id: {$custid[customer]}<br />
name: {$name[customer]}<br />
address: {$address[customer]}
</p>
{/section}
{/section}
]]>
</programlisting>
<para>
@@ -198,18 +198,18 @@ $smarty->assign('address',$addr);
<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 @@ $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,15 +275,15 @@ $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 />
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,23 +292,23 @@ $smarty->assign('contact_info', $info);
<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: john@myexample.com<br />
e-mail: john@myexample.com<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>
@@ -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 />
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 @@ $smarty->assign('contacts',$data);
<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: john@myexample.com
</p>
<p>
name: Jack Jones<br />
name: Jack Jones<br />
home phone: 777-555-5555<br />
cell phone: 888-555-5555<br />
e-mail: jack@myexample.com
</p>
<p>
name: Jane Munson<br />
name: Jane Munson<br />
home phone: 000-555-5555<br />
cell phone: 123456<br />
e-mail: jane@myexample.com
@@ -397,7 +397,7 @@ $smarty->assign('contacts',$db->getAll($sql) );
<tr><th>&nbsp;</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}
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>
@@ -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}
{$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 @@ $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,11 +529,11 @@ $smarty->assign('custid',$data);
</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 @@ $smarty->assign('custid',$id);
iteration={$smarty.section.cu.iteration}
index={$smarty.section.cu.index}
id={$custid[cu]}<br />
{/section}
{/section}
]]>
</programlisting>
<para>
@@ -602,7 +602,7 @@ iteration=6 index=15 id=3015<br />
{section name=co loop=$contacts}
{if $smarty.section.co.iteration % 5 == 1}
<tr><th>&nbsp;</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 @@ iteration=6 index=15 id=3015<br />
<td>{$contacts[co].cell}</td>
<td>{$contacts[co].email}</td>
<tr>
{/section}
{/section}
</table>
]]>
</programlisting>
@@ -646,21 +646,21 @@ iteration=6 index=15 id=3015<br />
<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 @@ iteration=6 index=15 id=3015<br />
<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 @@ 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}
{$smarty.section.customer.rownum} id: {$custid[customer]}<br />
{/section}
{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}
{if $smarty.section.customer.show}
the section was shown.
{else}
the section was not shown.
{/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}
{$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 @@ 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>