mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 13:21:36 +01:00
615 lines
15 KiB
XML
615 lines
15 KiB
XML
<?xml version="1.0" encoding="windows-1251"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 1.3 Maintainer: freespace Status: ready -->
|
|
<sect1 id="language.function.section">
|
|
<title>section,sectionelse</title>
|
|
<informaltable frame="all">
|
|
<tgroup cols="5">
|
|
<colspec colname="param" align="center" />
|
|
<colspec colname="type" align="center" />
|
|
<colspec colname="required" align="center" />
|
|
<colspec colname="default" align="center" />
|
|
<colspec colname="desc" />
|
|
<thead>
|
|
<row>
|
|
<entry>Èìÿ àòðèáóòà</entry>
|
|
<entry>Òèï</entry>
|
|
<entry>Îáÿçàòåëåí</entry>
|
|
<entry>Ïî óìîë÷àíèþ</entry>
|
|
<entry>Îïèñàíèå</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>name</entry>
|
|
<entry>ñòðîêà (string)</entry>
|
|
<entry>Äà</entry>
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
<entry>Íàçâàíèå ñåêöèè</entry>
|
|
</row>
|
|
<row>
|
|
<entry>loop</entry>
|
|
<entry>[$variable_name]</entry>
|
|
<entry>Äà</entry>
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
<entry>Èìÿ ïåðåìåííîé öèêëà, äëÿ îïðåäåëåíèÿ
|
|
êîëè÷åñòâà èòåðàöèé öèêëà.</entry>
|
|
</row>
|
|
<row>
|
|
<entry>start</entry>
|
|
<entry>öåëîå (integer)</entry>
|
|
<entry>Íåò</entry>
|
|
<entry><emphasis>0</emphasis></entry>
|
|
<entry>
|
|
Èíäåêñ ïîçèöèè, ñ êîòîðîé áóäåò íà÷èíàòüñÿ
|
|
öèêë. Åñëè çíà÷åíèå îòðèöàòåëüíîå, òî íà÷àëüíàÿ ïîçèöèÿ
|
|
âû÷èñëÿåòñÿ îò êîíöà ìàññèâà. Íàïðèìåð, åñëè â ïåðåìåííîé
|
|
öèêëà 7 ýëåìåíòîâ è çíà÷åíèå àòðèáóòà start ðàâíî -2, òî
|
|
íà÷àëüíûé èíäåêñ áóäåò 5. Íåâåðíûå çíà÷åíèÿ (çíà÷åíèÿ, âíå
|
|
ìàññèâà) àâòîìàòè÷åñêè îáðåçàþòñÿ äî áëèæàéøåãî âåðíîãî
|
|
çíà÷åíèÿ.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>step</entry>
|
|
<entry>öåëîå (integer)</entry>
|
|
<entry>Íåò</entry>
|
|
<entry><emphasis>1</emphasis></entry>
|
|
<entry>
|
|
Çíà÷åíèå øàãà, êîòîðîå èñïîëüçóåòñÿ äëÿ ïðîõîäà ïî
|
|
ìàññèâó. Íàïðèìåð, step=2 óêàçûâàåò îáõîä ìàññèâà
|
|
ïî ýëåìåíòàì 0,2,4... Åñëè øàã îòðèöàòåëåí, òî îáõîä
|
|
ìàññèâà áóäåò ïðîèçâîäèòñÿ â îáðàòíîì íàïðàâëåíèè.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>max</entry>
|
|
<entry>öåëîå (integer)</entry>
|
|
<entry>Íåò</entry>
|
|
<entry><emphasis>1</emphasis></entry>
|
|
<entry>Ìàêñèìàëüíîå êîëè÷åñòâî èòåðàöèé öèêëà.</entry>
|
|
</row>
|
|
<row>
|
|
<entry>show</entry>
|
|
<entry>ëîãè÷åñêèé (boolean)</entry>
|
|
<entry>Íåò</entry>
|
|
<entry><emphasis>true</emphasis></entry>
|
|
<entry>Óêàçûâàåò, ïîêàçûâàòü èëè íåò ýòó ñåêöèþ</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
Ñåêöèè èñïîëüçóþòñÿ äëÿ îáõîäà ìàññèâà äàííûõ. Âñå òýãè
|
|
<emphasis>section</emphasis> äîëæíû èìåòü â ïàðó òýã
|
|
<emphasis>/section</emphasis>. Îáÿçàòåëüíûå ïàðàìåòðû:
|
|
<emphasis>name</emphasis> è <emphasis>loop</emphasis>. Èìÿ
|
|
ñåêöèè ìîæåò áûòü êàêîé óãîäíî ïîñëåäîâàòåëüíîñòüþ áóêâ,
|
|
öèôð è çíàêîâ ïîä÷åðêèâàíèé. Ñåêöèè ìîãóò áûòü âëîæåííûìè.
|
|
Èìåíà âëîæåííûõ ñåêöèé äîëæíû îòëè÷àòüñÿ äðóã îò äðóãà.
|
|
Ïåðåìåííàÿ öèêëà (îáû÷íî ìàññèâ) îïðåäåëÿåò êîëè÷åñòâî èòåðèöèé
|
|
öèêëà. Êîãäà îòîáðàæàåì ïåðåìåííóþ öèêëà, èìÿ ñåêöèè äîëæíî
|
|
áûòü óêàçàíà ïîñëå èìåíè ïåðåìåííîé â êâàäðàòíûõ ñêîáêàõ [].
|
|
Òýã <emphasis>sectionelse</emphasis> âûïîëíÿåòñÿ, êîãäà
|
|
ïåðåìåííàÿ öèêëà ïóñòà.
|
|
</para>
|
|
<example>
|
|
<title>section</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* ýòîò ïðèìåð âûâåäåò âñå çíà÷åíèÿ ìàññèâà $custid *}
|
|
{section name=customer loop=$custid}
|
|
id: {$custid[customer]}<br>
|
|
{/section}
|
|
|
|
OUTPUT:
|
|
|
|
id: 1000<br>
|
|
id: 1001<br>
|
|
id: 1002<br>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
<example>
|
|
<title>section loop variable</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* Ïåðåìåííàÿ öèêëà îïðåäåëÿåò òîëüêî êîëè÷åñòâî èòåðàöèé öèêëà.
|
|
Âû èìååòå äîñòóï ê ëþáîé ïåðåìåííîé øàáëîíà â ñåêöèè.
|
|
Ýòîò ïðèìåð ïîäðàçóìåâàåò, ÷òî êàæäûé èç ìàññèâîâ $custid, $name è $address
|
|
ñîäåðæàò îäèíàêîâîå êîëè÷åñòâî çíà÷åíèé *}
|
|
{section name=customer loop=$custid}
|
|
id: {$custid[customer]}<br>
|
|
name: {$name[customer]}<br>
|
|
address: {$address[customer]}<br>
|
|
<p>
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
id: 1000<br>
|
|
name: John Smith<br>
|
|
address: 253 N 45th<br>
|
|
<p>
|
|
id: 1001<br>
|
|
name: Jack Jones<br>
|
|
address: 417 Mulberry ln<br>
|
|
<p>
|
|
id: 1002<br>
|
|
name: Jane Munson<br>
|
|
address: 5605 apple st<br>
|
|
<p>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
<example>
|
|
<title>èìåíà ñåêöèé</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* èìÿ ñåêöèè ìîæåò áûòü ëþáûì è èñïîëüçóåòñÿ äëÿ óêàçàíèÿ
|
|
äàííûõ â ñåêöèè *}
|
|
{section name=mydata loop=$custid}
|
|
id: {$custid[mydata]}<br>
|
|
name: {$name[mydata]}<br>
|
|
address: {$address[mydata]}<br>
|
|
<p>
|
|
{/section}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
<example>
|
|
<title>âëîæåííûå ñåêöèè</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* ñåêöèè ìîãóò áûòü íåîãðàíè÷åíî âëîæåííûìèas. Ñ ïîìîùüþ âëîæåííûõ ñåêöèé
|
|
âû ìîæåòå îðãàíèçîâàòü äîñòóï ê êîìïëåêñíûì ñòðêòóðàì èíôîðìàöèè, òàêèì
|
|
êàê ìíîãîìåðíûå ìàññèâû. Â äàííîì ïðèìåðå $contact_type[customer] ÿâëÿåòñÿ
|
|
ìàññèâîì, ãäå ñîäåðæàòñÿ òèïà êîíòàêòîâ äàííîãî êëèåíò. *}
|
|
{section name=customer loop=$custid}
|
|
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}
|
|
<p>
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
id: 1000<br>
|
|
name: John Smith<br>
|
|
address: 253 N 45th<br>
|
|
home phone: 555-555-5555<br>
|
|
cell phone: 555-555-5555<br>
|
|
e-mail: john@mydomain.com<br>
|
|
<p>
|
|
id: 1001<br>
|
|
name: Jack Jones<br>
|
|
address: 417 Mulberry ln<br>
|
|
home phone: 555-555-5555<br>
|
|
cell phone: 555-555-5555<br>
|
|
e-mail: jack@mydomain.com<br>
|
|
<p>
|
|
id: 1002<br>
|
|
name: Jane Munson<br>
|
|
address: 5605 apple st<br>
|
|
home phone: 555-555-5555<br>
|
|
cell phone: 555-555-5555<br>
|
|
e-mail: jane@mydomain.com<br>
|
|
<p>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
<example>
|
|
<title>ñåêöèè è àññîöèàòèâíûå ìàññèâû</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* Ïðèìåð âûâîäà àññîöèàòèâíîãî ìàññèâà. *}
|
|
{section name=customer loop=$contacts}
|
|
name: {$contacts[customer].name}<br>
|
|
home: {$contacts[customer].home}<br>
|
|
cell: {$contacts[customer].cell}<br>
|
|
e-mail: {$contacts[customer].email}<p>
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
name: John Smith<br>
|
|
home: 555-555-5555<br>
|
|
cell: 555-555-5555<br>
|
|
e-mail: john@mydomain.com<p>
|
|
name: Jack Jones<br>
|
|
home phone: 555-555-5555<br>
|
|
cell phone: 555-555-5555<br>
|
|
e-mail: jack@mydomain.com<p>
|
|
name: Jane Munson<br>
|
|
home phone: 555-555-5555<br>
|
|
cell phone: 555-555-5555<br>
|
|
e-mail: jane@mydomain.com<p>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
<example>
|
|
<title>sectionelse</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* sectionelse îáðàáîòàåòñÿ, êîãäà $custid íå ñîäåðæèò çíà÷åíèé *}
|
|
{section name=customer loop=$custid}
|
|
id: {$custid[customer]}<br>
|
|
{sectionelse}
|
|
there are no values in $custid.
|
|
{/section}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
Ñåêöèè òàêæå èìåþò ñâîè ñîáñòâåííûå àòðèáóòû, êîòîðûå îïðåäåëÿþò
|
|
îïðåäåëåííûå íàñòðîéêè ñåêöèè. Îíè óêàçûâàþòñÿ ïðèìåðíî òàê:
|
|
{$smarty.section.sectionname.varname}
|
|
</para>
|
|
<para>
|
|
ÇÀÌÅ×ÀÍÈÅ: Íà÷èíàÿ ñî Smarty âåðñèè 1.5.0, ñèíòàêñèñ àòðèáóòîâ ñåêöèé
|
|
èçìåíèëñÿ ñ {%sectionname.varname%} íà {$smarty.section.sectionname.varname}.
|
|
Ñòàðûé ñèíòàêñèñ ïîêà ïîääåðæèâàåòñÿ, íî âû âñòðåòèòå òîëüêî íîâûé ñòèëü â
|
|
ïðèìåðàõ äàííîãî ðóêîâîäñòâà.
|
|
</para>
|
|
|
|
<sect2 id="section.property.index">
|
|
<title>index</title>
|
|
<para>
|
|
index õðàíèò òåêóùèé èíäåêñ öèêëà, íà÷èíàÿ ñ 0 (èëè çíà÷åíèÿ àòðèáóòà
|
|
start), è óâåëè÷èâàåòñÿ íà åäèíèöó (èëè íà çíà÷åíèå àòðèáóòà step).
|
|
</para>
|
|
<note>
|
|
<title>Òåõíè÷åñêîå Çàìå÷àíèå</title>
|
|
<para>
|
|
Åñëè àòðèáóòû step è start íå óêàçàíû, òî index
|
|
àíàëîãè÷åí àòðèáóòó ñåêöèè iteration, êðîìå òîãî,
|
|
÷òî íà÷èíàåòñÿ ñ 0, à íå ñ 1.
|
|
</para>
|
|
</note>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè index</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
0 id: 1000<br>
|
|
1 id: 1001<br>
|
|
2 id: 1002<br>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.index.prev">
|
|
<title>index_prev</title>
|
|
<para>
|
|
index_prev õðàíèò ïðåäûäóùèé èíäåêñ öèêëà.
|
|
Íà ïåðâîé èòåðàöèè óñòàíàâëèâàåòñÿ â -1.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè index_prev</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
|
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
|
{if $custid[customer.index_prev] ne $custid[customer.index]}
|
|
The customer id changed<br>
|
|
{/if}
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
0 id: 1000<br>
|
|
The customer id changed<br>
|
|
1 id: 1001<br>
|
|
The customer id changed<br>
|
|
2 id: 1002<br>
|
|
The customer id changed<br>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.index.next">
|
|
<title>index_next</title>
|
|
<para>
|
|
index_next õðàíèò ñëåäóþùèé èíäåêñ öèêëà. Íà ïîñëåäíåé èòåðàöèè öèêëà
|
|
áóäåò èìåòü çíà÷åíèå íà åäèíèöó áîëüøå òåêóùåãî èíäåêñà (èëè íà äðóãîå
|
|
çíà÷åíèå, åñëè óêàçàí àòðèáóò step).
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè index_next</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
|
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
|
{if $custid[customer.index_next] ne $custid[customer.index]}
|
|
The customer id will change<br>
|
|
{/if}
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
0 id: 1000<br>
|
|
The customer id will change<br>
|
|
1 id: 1001<br>
|
|
The customer id will change<br>
|
|
2 id: 1002<br>
|
|
The customer id will change<br>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.iteration">
|
|
<title>iteration</title>
|
|
<para>
|
|
iteration õðàíèò òåêóùóþ èòåðàöèþ öèêëà.
|
|
</para>
|
|
<para>
|
|
ÇÀÌÅ×ÀÍÈÅ: Çíà÷åíèå íå çàâèñèò îò àòðèáóòîâ start, step è max, â îòëè÷èè
|
|
àòðèáóòà index. Èòåðàöèè òàêæå íà÷èíàþòñÿ ñ 1, à íå ñ 0, êàê index.
|
|
rownum ÿâëÿåòñÿ ñèíîíèìîì äëÿ iteration.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè iteration</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid start=5 step=2}
|
|
current loop iteration: {$smarty.section.customer.iteration}<br>
|
|
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
|
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
|
{if $custid[customer.index_next] ne $custid[customer.index]}
|
|
The customer id will change<br>
|
|
{/if}
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
current loop iteration: 1
|
|
5 id: 1000<br>
|
|
The customer id will change<br>
|
|
current loop iteration: 2
|
|
7 id: 1001<br>
|
|
The customer id will change<br>
|
|
current loop iteration: 3
|
|
9 id: 1002<br>
|
|
The customer id will change<br>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.first">
|
|
<title>first</title>
|
|
<para>
|
|
first èìååò çíà÷åíèå èñòèíà, åñëè òåêóùàÿ èòåðàöèÿ öèêëà - ïåðâàÿ.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè first</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{if $smarty.section.customer.first}
|
|
<table>
|
|
{/if}
|
|
|
|
<tr><td>{$smarty.section.customer.index} id:
|
|
{$custid[customer]}</td></tr>
|
|
|
|
{if $smarty.section.customer.last}
|
|
</table>
|
|
{/if}
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
<table>
|
|
<tr><td>0 id: 1000</td></tr>
|
|
<tr><td>1 id: 1001</td></tr>
|
|
<tr><td>2 id: 1002</td></tr>
|
|
</table>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.last">
|
|
<title>last</title>
|
|
<para>
|
|
last èìååò çíà÷åíèå èñòèíà, åñëè òåêóùàÿ èòåðàöèÿ öèêëà - ïîñëåäíÿÿ.
|
|
one.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè last</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{if $smarty.section.customer.first}
|
|
<table>
|
|
{/if}
|
|
|
|
<tr><td>{$smarty.section.customer.index} id:
|
|
{$custid[customer]}</td></tr>
|
|
|
|
{if $smarty.section.customer.last}
|
|
</table>
|
|
{/if}
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
<table>
|
|
<tr><td>0 id: 1000</td></tr>
|
|
<tr><td>1 id: 1001</td></tr>
|
|
<tr><td>2 id: 1002</td></tr>
|
|
</table>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.rownum">
|
|
<title>rownum</title>
|
|
<para>
|
|
rownum õðàíèò òåêóùóþ èòåðàöèþ öèêëà, íà÷èíàÿ ñ 1.
|
|
rownum - ñèíîíèì äëÿ iteration.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè rownum</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
|
|
{/section}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
1 id: 1000<br>
|
|
2 id: 1001<br>
|
|
3 id: 1002<br>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.loop">
|
|
<title>loop</title>
|
|
<para>
|
|
loop õðàíèò ïîñëåäíèé îòðàáîòàííûé èíäåêñ öèêëà. Ìîæåò áûòü èñïîëüçîâàí
|
|
êàê âíóòðè ñåêöèè, òàê è ïîñëå íåå.
|
|
</para>
|
|
<example>
|
|
<title>àòòðáóò ñåêöèè index</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{section name=customer loop=$custid}
|
|
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
|
{/section}
|
|
|
|
There were {$smarty.section.customer.loop} customers shown above.
|
|
|
|
OUTPUT:
|
|
|
|
0 id: 1000<br>
|
|
1 id: 1001<br>
|
|
2 id: 1002<br>
|
|
|
|
There were 3 customers shown above.
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.show">
|
|
<title>show</title>
|
|
<para>
|
|
Àòðèáóò <emphasis>show</emphasis> ìîæåò ïðèíèìàòü ëîãè÷åñêèå
|
|
çíà÷åíèÿ (èñòèíà èëè ëîæü). Åñëè ëîæü, òî öèêë section íå áóäåò
|
|
îòîáðàæàòüñÿ. Åñëè ïðèñóòñòâóåò òýã sectionelse, òî îí áóäåò
|
|
îòîáðàæåí.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè show</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* $show_customer_info ìîæåò áûòü ïåðåäàíà èç PHP ïðîãðàììû
|
|
óêàûçâàÿ, ïîêàçûâàòü èëè íåò ýòó ñåêöèþ *}
|
|
{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}
|
|
|
|
|
|
OUTPUT:
|
|
|
|
1 id: 1000<br>
|
|
2 id: 1001<br>
|
|
3 id: 1002<br>
|
|
|
|
the section was shown.
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
<sect2 id="section.property.total">
|
|
<title>total</title>
|
|
<para>
|
|
total õðàíèò êîëè÷åñòâî âñåõ èòåðàöèé öèêëà. Ìîæåò áûòü èñïîëüçâîâàí
|
|
êàê â ñåêöèè, òàê è ïîñëå íåå.
|
|
</para>
|
|
<example>
|
|
<title>àòðèáóò ñåêöèè total</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{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.
|
|
|
|
OUTPUT:
|
|
|
|
0 id: 1000<br>
|
|
2 id: 1001<br>
|
|
4 id: 1002<br>
|
|
|
|
There were 3 customers shown above.
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect2>
|
|
|
|
</sect1>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|