mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
review of text and changed all examples to CDATA support
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do Atributo</entry>
|
<entry>Nome do Atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
capture <20> usado para coletar toda a sa<73>da do template em uma vari<72>vel ao inv<6E>s
|
capture <20> usado para coletar toda a sa<73>da do template em uma vari<72>vel ao inv<6E>s
|
||||||
de mostra-lo. Qualquer conte<74>do entre {capture
|
de mostra-lo. Qualquer conte<74>do entre {capture
|
||||||
name="foo"} e {/capture} coletado na vari<72>vel especificada no atributo name.
|
name="foo"} e {/capture} coletado na vari<72>vel especificada no atributo name.
|
||||||
O conte<74>do capturado pode ser usado no template a apertir da vari<72>vel especial
|
O conte<74>do capturado pode ser usado no template a partir da vari<72>vel especial
|
||||||
$smarty.capture.foo aonde foo <20> o valor passado para o atributo name. Se voc<6F> n<>o
|
$smarty.capture.foo aonde foo <20> o valor passado para o atributo name. Se voc<6F> n<>o
|
||||||
passar um atributo name, ent<6E>o ser<65> usado "default". Todos os comandos
|
passar um atributo name, ent<6E>o ser<65> usado "default". Todos os comandos
|
||||||
{capture} devem ter o seu {/capture}. Voc<6F> pode aninhar(colocar um dentro de outro)
|
{capture} devem ter o seu {/capture}. Voc<6F> pode aninhar(colocar um dentro de outro)
|
||||||
@@ -66,17 +66,20 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>capturando conte<74>do do template</title>
|
<title>capturando conte<74>do do template</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* we don't want to print a table row unless content is displayed *}
|
<![CDATA[
|
||||||
|
{* n<>s n<>o queremos mostrar uma linha de tabela <20> n<>o ser que haja conte<74>do para ela *}
|
||||||
{capture name=banner}
|
{capture name=banner}
|
||||||
{include file="get_banner.tpl"}
|
{include file="pegar_banner.tpl"}
|
||||||
{/capture}
|
{/capture}
|
||||||
{if $smarty.capture.banner ne ""}
|
{if $smarty.capture.banner ne ""}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{$smarty.capture.banner}
|
{$smarty.capture.banner}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}</programlisting>
|
{/if}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do Atributo</entry>
|
<entry>Nome do Atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<entry>file</entry>
|
<entry>file</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>Sim</entry>
|
<entry>Sim</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome do arquivo de configura<72><61>o para incluir</entry>
|
<entry>O nome do arquivo de configura<72><61>o para incluir</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>section</entry>
|
<entry>section</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da se<73><65>o a carregar</entry>
|
<entry>O nome da se<73><65>o a carregar</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<entry>
|
<entry>
|
||||||
Quando ou n<>o as vari<72>veis s<>o visiveis para o template
|
Quando ou n<>o as vari<72>veis s<>o visiveis para o template
|
||||||
superior(aquele que chamou este), o mesmo que scope=parent.
|
superior(aquele que chamou este), o mesmo que scope=parent.
|
||||||
NOTA: este atributo esta obsoleto pelo atributo scope, mas
|
NOTA: este atributo esta obsoleto devido ao atributo scope, mas
|
||||||
ainda <20> suportado. Se scope for indicado, este valor <20> ignorado.
|
ainda <20> suportado. Se scope for indicado, este valor <20> ignorado.
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -65,31 +65,33 @@
|
|||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
Esta fun<75><6E>o <20> usada para carregar as vari<72>veis de um arquivo de configura<72><61>o
|
Esta fun<75><6E>o <20> usada para carregar as vari<72>veis de um arquivo de configura<72><61>o
|
||||||
dentro de um template. Veja <link linkend="config.files">Config Files</link>
|
dentro de um template. Veja <link linkend="config.files">Arquivos de Configura<72><61>o</link>
|
||||||
para maiores
|
para mais informa<6D><61>es.
|
||||||
informa<6D><61>es.
|
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Fun<EFBFBD><EFBFBD>o config_load</title>
|
<title>Fun<EFBFBD><EFBFBD>o config_load</title>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{config_load file="colors.conf"}
|
<![CDATA[
|
||||||
|
{config_load file="cores.conf"}
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<title>{#pageTitle#}</title>
|
<title>{#tituloPagina#}</title>
|
||||||
<body bgcolor="{#bodyBgColor#}">
|
<body bgcolor="{#cordeFundo}">
|
||||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
<table border="{#tamanhoBordaTabela}" bgcolor="{#cordeFundotabela#}">
|
||||||
<tr bgcolor="{#rowBgColor#}">
|
<tr bgcolor="{#cordeFundoLinha#}">
|
||||||
<td>First</td>
|
<td>First</td>
|
||||||
<td>Last</td>
|
<td>Last</td>
|
||||||
<td>Address</td>
|
<td>Address</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html></programlisting>
|
</html>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Arquivos de configura<72><61>o podem conter se<73><65>es tamb<6D>m. Voce pode carregar
|
Arquivos de configura<72><61>o podem conter se<73><65>es tamb<6D>m. Voc<EFBFBD> pode carregar
|
||||||
vari<72>veis de uma se<73><65>o adicionando o atributo
|
vari<72>veis de uma se<73><65>o adicionando o atributo
|
||||||
<emphasis>section</emphasis>.
|
<emphasis>section</emphasis>.
|
||||||
</para>
|
</para>
|
||||||
@@ -102,20 +104,23 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>Fun<EFBFBD><EFBFBD>o config_load com se<73><65>es</title>
|
<title>Fun<EFBFBD><EFBFBD>o config_load com se<73><65>es</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{config_load file="colors.conf" section="Customer"}
|
<![CDATA[
|
||||||
|
{config_load file="cores.conf" section="Consumidor"}
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<title>{#pageTitle#}</title>
|
<title>{#tituloPagina#}</title>
|
||||||
<body bgcolor="{#bodyBgColor#}">
|
<body bgcolor="{#cordeFundo}">
|
||||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
<table border="{#tamanhoBordaTabela}" bgcolor="{#cordeFundotabela#}">
|
||||||
<tr bgcolor="{#rowBgColor#}">
|
<tr bgcolor="{#cordeFundoLinha#}">
|
||||||
<td>First</td>
|
<td>First</td>
|
||||||
<td>Last</td>
|
<td>Last</td>
|
||||||
<td>Address</td>
|
<td>Address</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html></programlisting>
|
</html>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do Atributo</entry>
|
<entry>Nome do Atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<entry>from</entry>
|
<entry>from</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>Sim</entry>
|
<entry>Sim</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da matriz que voc<6F> estar<61> pegando os elementos</entry>
|
<entry>O nome da matriz que voc<6F> estar<61> pegando os elementos</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>item</entry>
|
<entry>item</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>Yes</entry>
|
<entry>Yes</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da vari<72>vel
|
<entry>O nome da vari<72>vel
|
||||||
que <20> o elemento atual</entry>
|
que <20> o elemento atual</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -38,14 +38,14 @@
|
|||||||
<entry>key</entry>
|
<entry>key</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da vari<72>vel que <20> a chave atual</entry>
|
<entry>O nome da vari<72>vel que <20> a chave atual</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>name</entry>
|
<entry>name</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome do loop foreach para acessar as
|
<entry>O nome do loop foreach para acessar as
|
||||||
propriedades foreach</entry>
|
propriedades foreach</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -73,49 +73,58 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>foreach</title>
|
<title>foreach</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* este exemplo ir<69> mostrar todos os valores da matriz $custid *}
|
{* este exemplo ir<69> mostrar todos os valores da matriz $custid *}
|
||||||
{foreach from=$custid item=curr_id}
|
{foreach from=$custid item=curr_id}
|
||||||
id: {$curr_id}<br>
|
id: {$curr_id}<br>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
]]>
|
||||||
MOSTRA:
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
id: 1000<br>
|
<programlisting>
|
||||||
id: 1001<br>
|
<![CDATA[
|
||||||
id: 1002<br></programlisting>
|
id: 1000<br>
|
||||||
|
id: 1001<br>
|
||||||
|
id: 1002<br>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>foreach key</title>
|
<title>foreach key</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* A key cont<6E>m a chave para cada valor do loop
|
{* A key cont<6E>m a chave para cada valor do loop
|
||||||
|
|
||||||
A defini<6E><69>o <EFBFBD> alo assim:
|
A defini<6E><69>o se parece com isso:
|
||||||
|
|
||||||
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
||||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
||||||
|
|
||||||
*}
|
*}
|
||||||
|
|
||||||
{foreach name=outer item=contact from=$contacts}
|
{foreach name=outer item=contact from=$contacts}
|
||||||
{foreach key=key item=item from=$contact}
|
{foreach key=key item=item from=$contact}
|
||||||
{$key}: {$item}<br>
|
{$key}: {$item}<br>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
]]>
|
||||||
MOSTRA:
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
phone: 1<br>
|
<programlisting>
|
||||||
fax: 2<br>
|
<![CDATA[
|
||||||
cell: 3<br>
|
phone: 1<br>
|
||||||
phone: 555-4444<br>
|
fax: 2<br>
|
||||||
fax: 555-3333<br>
|
cell: 3<br>
|
||||||
cell: 760-1234<br></programlisting>
|
phone: 555-4444<br>
|
||||||
|
fax: 555-3333<br>
|
||||||
|
cell: 760-1234<br>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Loop foreach tamb<6D>m tem as suas pr<70>prias vari<72>veis para manipilar a as propriedades
|
Loop foreach tamb<6D>m tem as suas pr<70>prias vari<72>veis para manipilar as propriedades
|
||||||
foreach. Estas s<>o indicadas assim: {$smarty.foreach.foreachname.varname} com
|
foreach. Estas s<>o indicadas assim: {$smarty.foreach.foreachname.varname} com
|
||||||
foreachname sendo o nome especificado no atributo
|
foreachname sendo o nome especificado no atributo
|
||||||
<emphasis>name</emphasis> do foreach.
|
<emphasis>name</emphasis> do foreach.
|
||||||
|
@@ -3,20 +3,134 @@
|
|||||||
<sect1 id="language.function.if">
|
<sect1 id="language.function.if">
|
||||||
<title>if,elseif,else</title>
|
<title>if,elseif,else</title>
|
||||||
<para>
|
<para>
|
||||||
Comandos if no Smarty tem muito da mesma flexibilidade do php,
|
Comandos {if} no Smarty tem muito da mesma flexibilidade do php,
|
||||||
com algumas adi<EFBFBD><EFBFBD>es para a ferramenta de template.
|
com algumas caracter<EFBFBD>sticas <20> mais para o sistema de template.
|
||||||
Todo <emphasis>if</emphasis> deve ter o seu
|
Todo <emphasis>if</emphasis> deve ter o seu
|
||||||
<emphasis>/if</emphasis>. <emphasis>else</emphasis> e
|
<emphasis>/if</emphasis>. <emphasis>else</emphasis> e
|
||||||
<emphasis>elseif</emphasis> tamb<6D>m s<>o permitidos. "eq", "ne","neq",
|
<emphasis>elseif</emphasis> tamb<6D>m s<>o permitidos. Todos os
|
||||||
"gt", "lt", "lte", "le", "gte" "ge","is even","is odd", "is not
|
condicionais do PHP s<>o reconhecidos, tais como ||, or, &&, and, etc.
|
||||||
even","is not odd","not","mod","div by","even by","odd
|
|
||||||
by","==","!=",">", "<","<=",">=" s<>o todos os qualificadores
|
|
||||||
de condi<64><69>o v<>lidos, e ddevem estar separados
|
|
||||||
dos elementos em roda por espa<70>o.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
A seguir est<73> uma lsita dos qualificadores, que devem estar separados dos elementos
|
||||||
|
por espa<70>o. Note que itens listado entre [conchetes] s<>o opcionais. Os equivalentes
|
||||||
|
em PHP s<>o mostrados quando aplic<69>veis.
|
||||||
|
</para>
|
||||||
|
<informaltable frame="all">
|
||||||
|
<tgroup cols="4">
|
||||||
|
<colspec colname="qualifier" align="center" />
|
||||||
|
<colspec colname="alternates" align="center" />
|
||||||
|
<colspec colname="example" />
|
||||||
|
<colspec colname="meaning" />
|
||||||
|
<colspec colname="php" />
|
||||||
|
<thead>
|
||||||
|
<row>
|
||||||
|
<entry>Qualificador</entry>
|
||||||
|
<entry>Alternativas</entry>
|
||||||
|
<entry>Exemplo de sintaxe</entry>
|
||||||
|
<entry>Significado</entry>
|
||||||
|
<entry>Equivalente no PHP</entry>
|
||||||
|
</row>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<row>
|
||||||
|
<entry>==</entry>
|
||||||
|
<entry>eq</entry>
|
||||||
|
<entry>$a eq $b</entry>
|
||||||
|
<entry>iguais</entry>
|
||||||
|
<entry>==</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>!=</entry>
|
||||||
|
<entry>ne, neq</entry>
|
||||||
|
<entry>$a neq $b</entry>
|
||||||
|
<entry>n<EFBFBD>o iguais</entry>
|
||||||
|
<entry>!=</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>></entry>
|
||||||
|
<entry>gt</entry>
|
||||||
|
<entry>$a gt $b</entry>
|
||||||
|
<entry>maior que</entry>
|
||||||
|
<entry>></entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><</entry>
|
||||||
|
<entry>lt</entry>
|
||||||
|
<entry>$a lt $b</entry>
|
||||||
|
<entry>menor que</entry>
|
||||||
|
<entry><</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>>=</entry>
|
||||||
|
<entry>gte, ge</entry>
|
||||||
|
<entry>$a ge $b</entry>
|
||||||
|
<entry>maior ou igual <20></entry>
|
||||||
|
<entry>>=</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><=</entry>
|
||||||
|
<entry>lte, le</entry>
|
||||||
|
<entry>$a le $b</entry>
|
||||||
|
<entry>menor ou igual <20></entry>
|
||||||
|
<entry><=</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>!</entry>
|
||||||
|
<entry>not</entry>
|
||||||
|
<entry>not $a</entry>
|
||||||
|
<entry>nega<EFBFBD><EFBFBD>o (unary)</entry>
|
||||||
|
<entry>!</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>%</entry>
|
||||||
|
<entry>mod</entry>
|
||||||
|
<entry>$a mod $b</entry>
|
||||||
|
<entry>m<EFBFBD>dulo</entry>
|
||||||
|
<entry>%</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>is [not] div by</entry>
|
||||||
|
<entry></entry>
|
||||||
|
<entry>$a is not div by 4</entry>
|
||||||
|
<entry>divis<EFBFBD>vel por</entry>
|
||||||
|
<entry>$a % $b == 0</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>is [not] even</entry>
|
||||||
|
<entry></entry>
|
||||||
|
<entry>$a is not even</entry>
|
||||||
|
<entry>[not] an even number (unary)</entry>
|
||||||
|
<entry>$a % 2 == 0</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>is [not] even by</entry>
|
||||||
|
<entry></entry>
|
||||||
|
<entry>$a is not even by $b</entry>
|
||||||
|
<entry>grouping level [not] even</entry>
|
||||||
|
<entry>($a / $b) % 2 == 0</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>is [not] odd</entry>
|
||||||
|
<entry></entry>
|
||||||
|
<entry>$a is not odd</entry>
|
||||||
|
<entry>[not] an odd number (unary)</entry>
|
||||||
|
<entry>$a % 2 != 0</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>is [not] odd by</entry>
|
||||||
|
<entry></entry>
|
||||||
|
<entry>$a is not odd by $b</entry>
|
||||||
|
<entry>[not] an odd grouping</entry>
|
||||||
|
<entry>($a / $b) % 2 != 0</entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
||||||
|
</tgroup>
|
||||||
|
</informaltable>
|
||||||
<example>
|
<example>
|
||||||
<title>comandos if</title>
|
<title>comandos if</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{if $name eq "Fred"}
|
{if $name eq "Fred"}
|
||||||
Welcome Sir.
|
Welcome Sir.
|
||||||
{elseif $name eq "Wilma"}
|
{elseif $name eq "Wilma"}
|
||||||
@@ -43,7 +157,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{* parenteses s<>o permitidos *}
|
{* parenteses s<>o permitidos *}
|
||||||
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
|
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -63,7 +177,7 @@
|
|||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{* test if var is divisible by 4 *}
|
{* verifica se a vari<72>vel <20> divis<69>vel por 4 *}
|
||||||
{if $var is div by 4}
|
{if $var is div by 4}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
@@ -77,7 +191,9 @@
|
|||||||
{* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *}
|
{* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *}
|
||||||
{if $var is even by 3}
|
{if $var is even by 3}
|
||||||
...
|
...
|
||||||
{/if}</programlisting>
|
{/if}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do Atributo</entry>
|
<entry>Nome do Atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -45,18 +45,29 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
|
<note>
|
||||||
|
<title>Nota T<>cnica</title>
|
||||||
|
<para>
|
||||||
|
include_php est<73> quase sendo retirado do Smarty, voc<6F> pode obter a mesma funcionalidade
|
||||||
|
usando uma fun<75><6E>o customizada em um template. A <20>nica raz<61>o para usar o include_php <20>
|
||||||
|
se voc<6F> realmente precisar deixar fun<75><6E>o php fora do diret<65>rio de plugin ou c<>digo da
|
||||||
|
sua aplica<63><61>o. Veja a se<73><65>o
|
||||||
|
<link linkend="tips.componentized.templates">templates componentizados</link>
|
||||||
|
para mais detalhes.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
<para>
|
<para>
|
||||||
Tags include_php s<>o usadas para incluir um script php no seu template.
|
Tags include_php s<>o usadas para incluir um script php no seu template.
|
||||||
Se a seguran<61>a estiver ativada, ent<6E>o o script php deve estar localizado
|
Se a seguran<61>a estiver ativada, ent<6E>o o script php deve estar localizado
|
||||||
no caminho $trusted_dir. A tag include_php deve ter o atributo
|
no diret<EFBFBD>rio especificado na vari<72>vel $trusted_dir. A tag include_php
|
||||||
"file", o qual cont<6E>m o caminho para o arquivo php a ser inclu<6C>do,
|
deve ter o atributo "file", o qual cont<6E>m o caminho para o arquivo php
|
||||||
ou relativo a $trusted_dir, ou um caminho absoluto.
|
inclu<EFBFBD>do, pode ser um camiho tanto absoluto ou relativo a $trusted_dir.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
include_php <20> um bom meio de manipular templates com componentes,
|
include_php <20> um bom meio de manipular templates componentizados,
|
||||||
e mante o c<>digo PHP separado dos arquivos de template. Vamos dizer
|
e manter o c<>digo PHP separado dos arquivos de template. Digamos
|
||||||
que voc<6F> tenha um template que mostre a navega<67><61>o do seu site, o qual
|
que voc<6F> tenha um template que mostre a navega<67><61>o do seu site, o qual
|
||||||
<09> prenchido automaticamente a partir de um banco de dados. Voc<6F> pode
|
<09> preenchido automaticamente a partir de um banco de dados. Voc<6F> pode
|
||||||
manter a sua l<>gica PHP que obt<62>m os dados em um diret<65>rio separado,
|
manter a sua l<>gica PHP que obt<62>m os dados em um diret<65>rio separado,
|
||||||
e inclui-la no topo do template. Agora voc<6F> pode incluir este template
|
e inclui-la no topo do template. Agora voc<6F> pode incluir este template
|
||||||
em qualquer lugar sem se preocupar se a informa<6D><61>o do banco de dados foi
|
em qualquer lugar sem se preocupar se a informa<6D><61>o do banco de dados foi
|
||||||
@@ -82,29 +93,32 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>Fun<EFBFBD><EFBFBD>o include_php</title>
|
<title>Fun<EFBFBD><EFBFBD>o include_php</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
load_nav.php
|
load_nav.php
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// carrega vari<72>veis de um banco de dados mysql e define ela para o template
|
// carrega vari<72>veis de um banco de dados mysql e define elas para o template
|
||||||
require_once("MySQL.class.php");
|
require_once("MySQL.class.php");
|
||||||
$sql = new MySQL;
|
$sql = new MySQL;
|
||||||
$sql->query("select * from site_nav_sections order by name",SQL_ALL);
|
$sql->query("select * from site_nav_sections order by name",SQL_ALL);
|
||||||
$this->assign('sections',$sql->record);
|
$this->assign('sections',$sql->record);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
index.tpl
|
index.tpl
|
||||||
---------
|
---------
|
||||||
|
|
||||||
{* caminho absoluto ou relativo a $trusted_dir *}
|
{* caminho absoluto ou relativo a $trusted_dir *}
|
||||||
{include_php file="/path/to/load_nav.php"}
|
{include_php file="/caminho/para/load_nav.php"}
|
||||||
|
|
||||||
{foreach item="curr_section" from=$sections}
|
{foreach item="curr_section" from=$sections}
|
||||||
<a href="{$curr_section.url}">{$curr_section.name}</a><br>
|
<a href="{$curr_section.url}">{$curr_section.name}</a><br>
|
||||||
{/foreach}</programlisting>
|
{/foreach}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do Atributo</entry>
|
<entry>Nome do Atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<entry>file</entry>
|
<entry>file</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>Sim</entry>
|
<entry>Sim</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome do arquivo de template a incluir</entry>
|
<entry>O nome do arquivo de template a incluir</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>assign</entry>
|
<entry>assign</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome de uma vari<72>vel que ir<69>
|
<entry>O nome de uma vari<72>vel que ir<69>
|
||||||
conter toda a sa<73>da do template</entry>
|
conter toda a sa<73>da do template</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -38,32 +38,35 @@
|
|||||||
<entry>[var ...]</entry>
|
<entry>[var ...]</entry>
|
||||||
<entry>[var type]</entry>
|
<entry>[var type]</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>Vari<EFBFBD>vel para passar localmente para o template</entry>
|
<entry>Vari<EFBFBD>vel para passar localmente para o template</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
Tags include s<>o usados para incluir outros templates no template
|
Tags include s<>o usadas para incluir outros templates no template
|
||||||
atual. Quaisquer vari<72>veis dispon<6F>veis no template atual tamb<6D>m esta
|
atual. Quaisquer vari<72>veis dispon<6F>veis no template atual tamb<6D>m estar<EFBFBD>o
|
||||||
dispon<6F>vel dentro do template incluido. A tag include deve ter o atributo
|
dispon<6F>veis junto com template inclu<EFBFBD>do. A tag include deve ter o atributo
|
||||||
"file", o qual cont<6E>m o caminho do arquivo a incluir.
|
"file", o qual cont<6E>m o caminho do arquivo a incluir.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Voc<6F> pode opcionalmente passar o atributo <emphasis>assign</emphasis>,
|
Voc<6F> pode opcionalmente passar o atributo <emphasis>assign</emphasis>,
|
||||||
o qual ir<69> especificar o nome de uma vari<72>vel de template para a qual
|
o qual ir<69> especificar o nome de uma vari<72>vel de template para a qual
|
||||||
conter<65> toda a sa<EFBFBD>da de <emphasis>include</emphasis> ao
|
conter<65> todo o conte<EFBFBD>do do <emphasis>include</emphasis> ao
|
||||||
inv<6E>s de mostra-la.
|
inv<6E>s de mostr<EFBFBD>-lo.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function include</title>
|
<title>function include</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{include file="header.tpl"}
|
<![CDATA[
|
||||||
|
{include file="cabecalho.tpl"}
|
||||||
|
|
||||||
{* O corpo do template vai aqui *}
|
{* O conte<EFBFBD>do do template vem aqui *}
|
||||||
|
|
||||||
{include file="footer.tpl"}</programlisting>
|
{include file="rodape.tpl"}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Voc<6F> pode tamb<6D>m passar vari<72>veis para o template inclu<6C>do como atributos.
|
Voc<6F> pode tamb<6D>m passar vari<72>veis para o template inclu<6C>do como atributos.
|
||||||
@@ -75,31 +78,37 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>Fun<EFBFBD><EFBFBD>o include passando vari<72>veis</title>
|
<title>Fun<EFBFBD><EFBFBD>o include passando vari<72>veis</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
<![CDATA[
|
||||||
|
{include file="cabecalho.tpl" title="Menu Principal" table_bgcolor="#c0c0c0"}
|
||||||
|
|
||||||
{* O corpo de template vai aqui *}
|
{* O conte<EFBFBD>do de template vem aqui *}
|
||||||
|
|
||||||
{include file="footer.tpl" logo="http://my.domain.com/logo.gif"}</programlisting>
|
{include file="rodape.tpl" logo="http://meu.dominio.com/logo.gif"}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Use a sintaxe para <link
|
Use a sintaxe de <link
|
||||||
linkend="template.resources">template resources</link> para
|
linkend="template.resources">template resources</link> para
|
||||||
incluir arquivos fora do diret<65>rio $template_dir.
|
incluir arquivos fora do diret<65>rio $template_dir.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Exemplos de recursos para a fun<75><6E>o include</title>
|
<title>Exemplos de recursos para a fun<75><6E>o include</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* caminho absoluto *}
|
{* caminho absoluto *}
|
||||||
{include file="/usr/local/include/templates/header.tpl"}
|
{include file="/usr/local/include/templates/cabecalho.tpl"}
|
||||||
|
|
||||||
{* caminho absoluto (mesma coisa) *}
|
{* caminho absoluto (idem) *}
|
||||||
{include file="file:/usr/local/include/templates/header.tpl"}
|
{include file="file:/usr/local/include/templates/cabecalho.tpl"}
|
||||||
|
|
||||||
{* caminho absoluto do windows (DEVE usar o prefixo "file:") *}
|
{* caminho absoluto do windows (DEVE usar o prefixo "file:") *}
|
||||||
{include file="file:C:/www/pub/templates/header.tpl"}
|
{include file="file:C:/www/pub/templates/cabecalho.tpl"}
|
||||||
|
|
||||||
{* incluir a partir do recurso de template chamado "db" *}
|
{* incluir a partir do recurso de template chamado "db" *}
|
||||||
{include file="db:header.tpl"}</programlisting>
|
{include file="db:header.tpl"}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do Atributo</entry>
|
<entry>Nome do Atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<entry>name</entry>
|
<entry>name</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>Sim</entry>
|
<entry>Sim</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da fun<75><6E>o insert (insert_name)</entry>
|
<entry>O nome da fun<75><6E>o insert (insert_name)</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>assign</entry>
|
<entry>assign</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da vari<72>vel que
|
<entry>O nome da vari<72>vel que
|
||||||
ir<69> receber a sa<73>da</entry>
|
ir<69> receber a sa<73>da</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<entry>script</entry>
|
<entry>script</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome de um script php que ser<65> incluido
|
<entry>O nome de um script php que ser<65> incluido
|
||||||
antes que a fun<75><6E>o insert seja chamada</entry>
|
antes que a fun<75><6E>o insert seja chamada</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<entry>[var ...]</entry>
|
<entry>[var ...]</entry>
|
||||||
<entry>[var type]</entry>
|
<entry>[var type]</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>Vari<EFBFBD>vel para passar para a fun<75><6E>o insert</entry>
|
<entry>Vari<EFBFBD>vel para passar para a fun<75><6E>o insert</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -59,18 +59,18 @@
|
|||||||
executada a cada invoca<63><61>o do template.
|
executada a cada invoca<63><61>o do template.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Vamos dizer que voc<6F> tenha um template com um banner em cima. O
|
Digamos que voc<6F> tenha um template com um banner no topo da p<>gina. O
|
||||||
banner pode conter qualquer mistura de html, imagens, flash, etc.
|
banner pode conter uma mistura de html, imagens, flash, etc.
|
||||||
Assin n<>s n<>o podemos usar uma liga<EFBFBD><EFBFBD>o estatica aqui, e n<>s n<>o
|
Assim n<>s n<>o podemos usar um link estatico aqui, e n<>s n<>o
|
||||||
queremos que este conte<74>do fique no cache com a p<>gina. Aqui vem a tag
|
queremos que este conte<74>do fique no cache junto com a p<>gina. E a<> que entra a tag
|
||||||
insert: o template conhece os valores #banner_location_id# e
|
insert: o template conhece os valores #banner_location_id# e
|
||||||
#site_id# (obtidos de um arquivo de configura<72><61>o), e precisa chamar
|
#site_id# (obtidos de um arquivo de configura<72><61>o), e precisa chamar
|
||||||
uma fun<75><6E>o para obter o conte<74>do do banner.
|
uma fun<75><6E>o para obter o conte<74>do do banner.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function insert</title>
|
<title>fun<EFBFBD><EFBFBD>o insert</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* example of fetching a banner *}
|
{* exemplo de como obter um banner *}
|
||||||
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting>
|
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
@@ -82,28 +82,34 @@
|
|||||||
aplica<63><61>o devem ser precedidas por "insert_" para prevenir poss<73>veis
|
aplica<63><61>o devem ser precedidas por "insert_" para prevenir poss<73>veis
|
||||||
problemas com nomes de fun<75><6E>es repetidos. Sua fun<75><6E>o insert_getBanner()
|
problemas com nomes de fun<75><6E>es repetidos. Sua fun<75><6E>o insert_getBanner()
|
||||||
deve fazer alguma coisa com os valores passados e retornar os resultados.
|
deve fazer alguma coisa com os valores passados e retornar os resultados.
|
||||||
Estes resultados s<>o mostrados no template em lugar da tag insert.
|
Estes resultados s<>o mostrados no template no lugar da tag insert.
|
||||||
Neste exemplo, o Smarty ir<69> chamar esta fun<75><6E>o:
|
Neste exemplo, o Smarty ir<69> chamar esta fun<75><6E>o:
|
||||||
insert_getBanner(array("lid" => "12345","sid" => "67890"));
|
insert_getBanner(array("lid" => "12345","sid" => "67890"));
|
||||||
e mostrar o resultado retornado no lugar da tag insert.
|
e mostrar o resultado retornado no lugar da tag insert.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Se voc<6F> der o atributo "assign", a sa<73>da da tag insert ser<65>
|
Se voc<6F> passar o atributo "assign", a sa<73>da da tag insert ser<65>
|
||||||
dada para esta vari<72>vel ao inv<6E>s de ser mostrada
|
dada para esta vari<72>vel ao inv<6E>s de ser mostrada
|
||||||
no template. Nota: definir a sa<73>da para uma vari<72>vel n<>o <20>
|
no template.
|
||||||
<20>til quando o cache esta ativo.
|
</para>
|
||||||
</para>
|
<note>
|
||||||
|
<title>Nota</title>
|
||||||
|
<para>
|
||||||
|
definir a sa<73>da para uma vari<72>vel n<>o <20>
|
||||||
|
<20>til quando o cache esta ativo.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
<para>
|
<para>
|
||||||
Se voc<6F> der o atributo "script", este script php ser<65> incluido
|
Se voc<6F> passar o atributo "script", este script php ser<65> incluido
|
||||||
(apenas uma vez) antes da execu<63><75>o da fun<75><6E>o insert. Este
|
(apenas uma vez) antes da execu<63><75>o da fun<75><6E>o insert. Este
|
||||||
<20> o caso onde a fun<75><6E>o insert n<>o existe ainda, e um script
|
<20> o caso onde a fun<75><6E>o insert n<>o existe ainda, e um script
|
||||||
php deve ser inclu<6C>do antes para faze-la funcionar. O caminho pode
|
php deve ser inclu<6C>do antes para faze-la funcionar. O caminho pode
|
||||||
ser absoluto ou relativo a $trusted_dir. Quando a seguran<61>a esta
|
ser absoluto ou relativo <EFBFBD> vari<72>vel $trusted_dir. Quando a seguran<61>a esta
|
||||||
ativada, o script deve estar em $trusted_dir.
|
ativada, o script deve estar no local definido na vari<72>vel $trusted_dir.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
O objeto Smarty <20> passado como segundo argumento. Desde modo
|
O objeto Smarty <20> passado como segundo argumento. Deste modo
|
||||||
poc<EFBFBD> pode refenciar o objeto Smarty
|
voc<EFBFBD> pode refenciar o objeto Smarty
|
||||||
de dentro da fun<75><6E>o.
|
de dentro da fun<75><6E>o.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
@@ -114,7 +120,7 @@
|
|||||||
ativado, tags insert n<>o estar<61>o no cache. Ela ser<65> executada
|
ativado, tags insert n<>o estar<61>o no cache. Ela ser<65> executada
|
||||||
dinamicamente a cada vez que a p<>gina seja criada, mesmo com
|
dinamicamente a cada vez que a p<>gina seja criada, mesmo com
|
||||||
p<>ginas em cache. Isto funciona bem para coisas como banners, pesquisa,
|
p<>ginas em cache. Isto funciona bem para coisas como banners, pesquisa,
|
||||||
clima, resultados de pesquisa, areas de opni<6E>o do usu<73>rio, etc.
|
previs<EFBFBD>es do tempo, resultados de pesquisa, <EFBFBD>reas de opni<6E>o do usu<73>rio, etc.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -3,21 +3,25 @@
|
|||||||
<sect1 id="language.function.ldelim">
|
<sect1 id="language.function.ldelim">
|
||||||
<title>ldelim,rdelim</title>
|
<title>ldelim,rdelim</title>
|
||||||
<para>
|
<para>
|
||||||
ldelim e rdelim s<>o usados para mostrar os delimitadores literalmente,
|
ldelim e rdelim s<>o usados para mostrar os delimitadores de templates literalmente,
|
||||||
no nosso caso "{" ou "}". A ferramente de template sempre
|
no nosso caso "{" ou "}". Ou voc<6F> pode usar {literal}{/literal} para
|
||||||
tenta interpretar os delimitadores, ent<6E>o este <20> o meio de contornar isso.
|
interpretar blocos de texto literalmente. Veja tamb<6D>m {$smarty.ldelim} e {$smarty.rdelim}
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>ldelim, rdelim</title>
|
<title>ldelim, rdelim</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* isto ir<69> mostrar os delimitadore no template *}
|
<![CDATA[
|
||||||
|
{* isto far<61> com que os delimitadores de template sejam tratados literalmente *}
|
||||||
|
|
||||||
{ldelim}funcname{rdelim} is how functions look in Smarty!
|
{ldelim}funcname{rdelim} <EFBFBD> como a fun<75><6E>o aparecer no Smarty!
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>O exemplo acima exibir<69>:</para>
|
||||||
|
<programlisting>
|
||||||
{funcname} is how functions look in Smarty!</programlisting>
|
<![CDATA[
|
||||||
|
{funcname} <20> como a fun<75><6E>o aparecer no Smarty
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -3,20 +3,21 @@
|
|||||||
<sect1 id="language.function.literal">
|
<sect1 id="language.function.literal">
|
||||||
<title>literal</title>
|
<title>literal</title>
|
||||||
<para>
|
<para>
|
||||||
Tags literal permitem que um bloco de dados seja tomado literalmente,
|
Tags literal permitem que um bloco de dados seja tratado literalmente, ou seja,
|
||||||
n<>o sendo interpretado pelo smarty. Isto <20> <EFBFBD>til
|
n<>o <EFBFBD> interpretado pelo Smarty. Isto <20> tipicamente usado com blocos de c<>digo
|
||||||
para coisas como se<73><65>es javascript, aonde podem haver
|
javascript ou folhas de estilo (stylesheet), que <20>s vezes cont<6E>m chaves
|
||||||
chaves("{}") e coisas assim que possam confundir
|
que podem entrar em conflito com o delimitador de sintaxe. Qualquer coisa entre
|
||||||
o interpretador do template.
|
{literal}{/literal} n<>o <20> interpretado, mas <20> mostrado. Se voc<6F> precisa que
|
||||||
Qualquer coisa dentro das {literal}{/literal} n<>o ser<65> interpretado, mas mostrado como estiver.
|
tags de templates sejam embutidas em um bloco literal, use {ldelim}{rdelim}.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Tags literal</title>
|
<title>Tags literal</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{literal}
|
{literal}
|
||||||
<script language=javascript>
|
<script language=javascript>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
function isblank(field) {
|
function isblank(field) {
|
||||||
if (field.value == '')
|
if (field.value == '')
|
||||||
{ return false; }
|
{ return false; }
|
||||||
@@ -26,10 +27,12 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{/literal}</programlisting>
|
{/literal}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -3,19 +3,22 @@
|
|||||||
<sect1 id="language.function.php">
|
<sect1 id="language.function.php">
|
||||||
<title>php</title>
|
<title>php</title>
|
||||||
<para>
|
<para>
|
||||||
Tags php permitem que voc<EFBFBD> adicione c<EFBFBD>digo php diretamente no template.
|
Tags php permitem que c<>digos php sejam embutidos diretamente nos templates.
|
||||||
N<EFBFBD>o ser<65> escapado, n<>o importando a defini<6E><69>o de <link
|
Eles n<EFBFBD>o ser<65>o interpretados, n<>o importando a defini<6E><69>o de
|
||||||
linkend="variable.php.handling">$php_handling</link>. Isto
|
<link linkend="variable.php.handling">$php_handling</link>. Esta op<6F><70>o <20>
|
||||||
<EFBFBD> apenas para usu<73>rios avan<61>ados e normalmente n<>o <20> necess<73>rio.
|
somente para usu<73>rios avan<61>ados e normalmente n<>o <20> necess<73>ria.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Tags php</title>
|
<title>Tags php</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{php}
|
{php}
|
||||||
// incluindo um script php
|
// incluindo um script php
|
||||||
// diretamente no template.
|
// diretamente no template.
|
||||||
include("/path/to/display_weather.php");
|
include("/caminho/para/condicoes_do_tempo.php");
|
||||||
{/php}</programlisting>
|
{/php}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<entry>Nome do atributo</entry>
|
<entry>Nome do atributo</entry>
|
||||||
<entry>Tipo</entry>
|
<entry>Tipo</entry>
|
||||||
<entry>Requerido</entry>
|
<entry>Obrigat<EFBFBD>rio</entry>
|
||||||
<entry>Padr<EFBFBD>o</entry>
|
<entry>Padr<EFBFBD>o</entry>
|
||||||
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<entry>name</entry>
|
<entry>name</entry>
|
||||||
<entry>string</entry>
|
<entry>string</entry>
|
||||||
<entry>Sim</entry>
|
<entry>Sim</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da se<73><65>o</entry>
|
<entry>O nome da se<73><65>o</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>loop</entry>
|
<entry>loop</entry>
|
||||||
<entry>[$variable_name]</entry>
|
<entry>[$variable_name]</entry>
|
||||||
<entry>Sim</entry>
|
<entry>Sim</entry>
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
<entry><emphasis>n/d</emphasis></entry>
|
||||||
<entry>O nome da vari<72>vel para determinar o
|
<entry>O nome da vari<72>vel para determinar o
|
||||||
n<>mero de intera<72><61>es</entry>
|
n<>mero de intera<72><61>es</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -41,10 +41,10 @@
|
|||||||
<entry><emphasis>0</emphasis></entry> <entry>A posi<73><69>o
|
<entry><emphasis>0</emphasis></entry> <entry>A posi<73><69>o
|
||||||
do <20>ndice que a se<73><65>o vai come<6D>ar. Se o valor
|
do <20>ndice que a se<73><65>o vai come<6D>ar. Se o valor
|
||||||
<09> negativo, a posi<73><69>o de inicio <20> calculada a partir
|
<09> negativo, a posi<73><69>o de inicio <20> calculada a partir
|
||||||
do final da matriz. For exemplo, se houverem
|
do final da matriz. Por exemplo, se houverem
|
||||||
sete valores na matriz e start for -2, o
|
sete valores na matriz e 'start' for -2, o
|
||||||
<09>ndice inicial <20> 5. Valores inv<6E>lidos (valores fora do
|
<09>ndice inicial <20> 5. Valores inv<6E>lidos (valores fora do
|
||||||
tamanho da matriz) s<>o automaticamente truncados
|
tamanho da matriz) s<>o automaticamente corrigidos
|
||||||
para o valor v<>lido mais pr<70>ximo.</entry>
|
para o valor v<>lido mais pr<70>ximo.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -52,8 +52,8 @@
|
|||||||
<entry>integer</entry>
|
<entry>integer</entry>
|
||||||
<entry>N<EFBFBD>o</entry>
|
<entry>N<EFBFBD>o</entry>
|
||||||
<entry><emphasis>1</emphasis></entry>
|
<entry><emphasis>1</emphasis></entry>
|
||||||
<entry>O valor do passo que ser<65> usado para o loop
|
<entry>O valor do passo que ser<65> usado para percorrer
|
||||||
na matriz. Por exemplo, step=2 ir<69> realizar o loop com
|
a matriz. Por exemplo, step=2 ir<69> percorrer
|
||||||
os <20>ndices 0,2,4, etc. Se step for negativo, ele ir<69> caminhar
|
os <20>ndices 0,2,4, etc. Se step for negativo, ele ir<69> caminhar
|
||||||
pela matriz de tr<74>s para frente.</entry>
|
pela matriz de tr<74>s para frente.</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -76,149 +76,170 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
sections de template s<>o usada para realizar um loop por uma matriz. Todas as tags
|
Os 'sections' de template s<>o usados para percorrer os dados de uma matriz.
|
||||||
<emphasis>section</emphasis> devem ter as suas
|
Todas as tags <emphasis>section</emphasis> devem ser finalizadas com <emphasis>/section</emphasis>.
|
||||||
<emphasis>/section</emphasis>. Par<61>metros requeridos s<>o
|
Os par<61>metros obrigat<61>rios s<>o <emphasis>name</emphasis> e <emphasis>loop</emphasis>.
|
||||||
<emphasis>name</emphasis> e <emphasis>loop</emphasis>. O nome
|
O nome da 'section' pode ser o que voc<6F> quiser, contendo letras, n<>meros e sublinhados.
|
||||||
de section pode ser o que voc<6F> quiser, feito de letras,
|
As 'sections' podem ser aninhadas, e os nomes das sections devem ser <20>nicos. A vari<72>vel
|
||||||
n<>meros e sublinhados. Sections podem ser aninhadas, e os nomes das section
|
'loop' (normalmente uma matriz de valores) determina o n<>mero de vezes que a section
|
||||||
aninhadas devem ser diferentes um dos outros. A vari<72>vel do loop
|
ser<65> percorrida. Quando estiver exibindo uma vari<72>vel dentro de uma section,
|
||||||
(normalmente uma matriz de valores) determina o n<>mero de vezes do
|
o nome da section deve estar ao lado da vari<72>vel dentro de conchetes [].
|
||||||
loop da section. Quando estiver mostrando uma vari<72>vel dentro de uma section,
|
<emphasis>sectionelse</emphasis> <20> executado quando n<>o houver valores na
|
||||||
o nome da section deve estar ao lado da vari<72>vel dentro de conchetes
|
vari<72>vel 'loop'.
|
||||||
[]. <emphasis>sectionelse</emphasis> <20>
|
|
||||||
executado quando n<>o houverem valores para a vari<72>vel de loop.
|
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section</title>
|
<title>section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* este exemplo ir<69> mostrar todos os valores de $custid array *}
|
{* este exemplo ir<69> mostrar todos os valores da matriz $custid *}
|
||||||
{section name=customer loop=$custid}
|
{section name=consumidor loop=$custid}
|
||||||
id: {$custid[customer]}<br>
|
id: {$custid[consumidor]}<br>
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
MOSTRA:
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
id: 1000<br>
|
<programlisting>
|
||||||
id: 1001<br>
|
<![CDATA[
|
||||||
id: 1002<br></programlisting>
|
id: 1000<br>
|
||||||
|
id: 1001<br>
|
||||||
|
id: 1002<br>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>loop de vari<72>vel section</title>
|
<title>loop de vari<72>vel section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* a vari<72>vel de loo<6F>p determina o n<>mero de vezes do loop.
|
<![CDATA[
|
||||||
Voc<6F> pode acessar qualquer vari<72>vel do template dentro da section.
|
{* a vari<72>vel 'loop' somente determina o n<>mero de vezes que ir<69> percorrer a matriz.
|
||||||
Este exemplo assume que $custid, $name e $address s<>o todas
|
Voc<EFBFBD> pode acessar qualquer vari<72>vel do template dentro da section.
|
||||||
|
Este exemplo assume que $custid, $nome e $endereco s<>o todas
|
||||||
matrizes contendo o mesmo n<>mero de valores *}
|
matrizes contendo o mesmo n<>mero de valores *}
|
||||||
{section name=customer loop=$custid}
|
|
||||||
id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid}
|
||||||
name: {$name[customer]}<br>
|
id: {$custid[consumidor]}<br>
|
||||||
address: {$address[customer]}<br>
|
nome: {$nome[consumidor]}<br>
|
||||||
<p>
|
endere<72>o: {$endereco[customer]}<br>
|
||||||
|
<p>
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
id: 1000<br>
|
<![CDATA[
|
||||||
name: John Smith<br>
|
id: 1000<br>
|
||||||
address: 253 N 45th<br>
|
nome: John Smith<br>
|
||||||
<p>
|
endere<EFBFBD>o: 253 N 45th<br>
|
||||||
id: 1001<br>
|
<p>
|
||||||
name: Jack Jones<br>
|
id: 1001<br>
|
||||||
address: 417 Mulberry ln<br>
|
nome: Jack Jones<br>
|
||||||
<p>
|
endere<EFBFBD>o: 417 Mulberry ln<br>
|
||||||
id: 1002<br>
|
<p>
|
||||||
name: Jane Munson<br>
|
id: 1002<br>
|
||||||
address: 5605 apple st<br>
|
nome: Jane Munson<br>
|
||||||
<p></programlisting>
|
endere<EFBFBD>o: 5605 apple st<br>
|
||||||
|
<p>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Nomes de section</title>
|
<title>Nomes de section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* o nome de section pode ser o que voc<6F> quiser,
|
<![CDATA[
|
||||||
e <20> usado para referenciar os dados dentro da section *}
|
{* o nome da se<73><65>o pode ser o que voc<6F> qusier,
|
||||||
{section name=mydata loop=$custid}
|
e <20> usado para referenciar os dados contido na se<73><65>o *}
|
||||||
id: {$custid[mydata]}<br>
|
|
||||||
name: {$name[mydata]}<br>
|
{section name=meusdados loop=$custid}
|
||||||
address: {$address[mydata]}<br>
|
id: {$custid[meusdados]}<br>
|
||||||
<p>
|
nome: {$nome[meusdados]}<br>
|
||||||
{/section}</programlisting>
|
endere<72>o: {$endereco[meusdados]}<br>
|
||||||
|
<p>
|
||||||
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>sections aninhadas</title>
|
<title>sections aninhadas</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* sections podem ser aninhadas t<>o profundamente quanto voc<6F> quiser. Com sections aninhadas,
|
<![CDATA[
|
||||||
voc<6F> pode acessar estruturas de dados complexas, como matriz multi-dimensionais.
|
{* sections podem ser aninhadas at<EFBFBD> o n<>vel que voc<6F> quiser. Com sections aninhadas,
|
||||||
Neste exemplo, $contact_type[customer] <20> uma matriz de
|
voc<EFBFBD> pode acessar complexas estruturas de dados, tais como matrizes multi-dimensionais.
|
||||||
tipos de contato para o custumer atual. *}
|
Neste exemplo, $contact_type[customer] <20> uma matriz contendo os tipos de contatos
|
||||||
|
do consumidor atualmente selecionado. *}
|
||||||
|
|
||||||
{section name=customer loop=$custid}
|
{section name=customer loop=$custid}
|
||||||
id: {$custid[customer]}<br>
|
id: {$custid[customer]}<br>
|
||||||
name: {$name[customer]}<br>
|
name: {$name[customer]}<br>
|
||||||
address: {$address[customer]}<br>
|
address: {$address[customer]}<br>
|
||||||
{section name=contact loop=$contact_type[customer]}
|
{section name=contact loop=$contact_type[customer]}
|
||||||
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br>
|
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br>
|
||||||
{/section}
|
{/section}
|
||||||
<p>
|
<p>
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
id: 1000<br>
|
<![CDATA[
|
||||||
name: John Smith<br>
|
id: 1000<br>
|
||||||
address: 253 N 45th<br>
|
name: John Smith<br>
|
||||||
home phone: 555-555-5555<br>
|
address: 253 N 45th<br>
|
||||||
cell phone: 555-555-5555<br>
|
home phone: 555-555-5555<br>
|
||||||
e-mail: john@mydomain.com<br>
|
cell phone: 555-555-5555<br>
|
||||||
<p>
|
e-mail: john@mydomain.com<br>
|
||||||
id: 1001<br>
|
<p>
|
||||||
name: Jack Jones<br>
|
id: 1001<br>
|
||||||
address: 417 Mulberry ln<br>
|
name: Jack Jones<br>
|
||||||
home phone: 555-555-5555<br>
|
address: 417 Mulberry ln<br>
|
||||||
cell phone: 555-555-5555<br>
|
home phone: 555-555-5555<br>
|
||||||
e-mail: jack@mydomain.com<br>
|
cell phone: 555-555-5555<br>
|
||||||
<p>
|
e-mail: jack@mydomain.com<br>
|
||||||
id: 1002<br>
|
<p>
|
||||||
name: Jane Munson<br>
|
id: 1002<br>
|
||||||
address: 5605 apple st<br>
|
name: Jane Munson<br>
|
||||||
home phone: 555-555-5555<br>
|
address: 5605 apple st<br>
|
||||||
cell phone: 555-555-5555<br>
|
home phone: 555-555-5555<br>
|
||||||
e-mail: jane@mydomain.com<br>
|
cell phone: 555-555-5555<br>
|
||||||
<p></programlisting>
|
e-mail: jane@mydomain.com<br>
|
||||||
|
<p>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>sections e matrizes associativas</title>
|
<title>sections e matrizes associativas</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* Este <20> um exemplo de mostrar os dados de matriz associativa
|
<![CDATA[
|
||||||
dentro da section *}
|
{* Este <20> um exemplo de exibi<62><69>o de uma matriz associativa
|
||||||
{section name=customer loop=$contacts}
|
dentro de uma se<73><65>o *}
|
||||||
name: {$contacts[customer].name}<br>
|
|
||||||
home: {$contacts[customer].home}<br>
|
{section name=consumidor loop=$contatos}
|
||||||
cell: {$contacts[customer].cell}<br>
|
nome: {$contatos[consumidor].nome}<br>
|
||||||
e-mail: {$contacts[customer].email}<p>
|
telefone: {$contatos[consumidor].telefone}<br>
|
||||||
|
celular: {$contatos[consumidor].celular}<br>
|
||||||
|
e-mail: {$contatos[consumidor].email}<p>
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
name: John Smith<br>
|
<![CDATA[
|
||||||
home: 555-555-5555<br>
|
name: John Smith<br>
|
||||||
cell: 555-555-5555<br>
|
home: 555-555-5555<br>
|
||||||
e-mail: john@mydomain.com<p>
|
cell: 555-555-5555<br>
|
||||||
name: Jack Jones<br>
|
e-mail: john@mydomain.com<p>
|
||||||
home phone: 555-555-5555<br>
|
name: Jack Jones<br>
|
||||||
cell phone: 555-555-5555<br>
|
home phone: 555-555-5555<br>
|
||||||
e-mail: jack@mydomain.com<p>
|
cell phone: 555-555-5555<br>
|
||||||
name: Jane Munson<br>
|
e-mail: jack@mydomain.com<p>
|
||||||
home phone: 555-555-5555<br>
|
name: Jane Munson<br>
|
||||||
cell phone: 555-555-5555<br>
|
home phone: 555-555-5555<br>
|
||||||
e-mail: jane@mydomain.com<p></programlisting>
|
cell phone: 555-555-5555<br>
|
||||||
|
e-mail: jane@mydomain.com<p>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
|
||||||
@@ -226,52 +247,61 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
<example>
|
<example>
|
||||||
<title>sectionelse</title>
|
<title>sectionelse</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* sectionelse ir<69> executar se n<>o houverem mais valores $custid *}
|
<![CDATA[
|
||||||
{section name=customer loop=$custid}
|
{* sectionelse ir<69> executar se n<>o houverem mais valores em $custid *}
|
||||||
id: {$custid[customer]}<br>
|
|
||||||
|
{section name=consumidor loop=$custid}
|
||||||
|
id: {$custid[consumidor]}<br>
|
||||||
{sectionelse}
|
{sectionelse}
|
||||||
there are no values in $custid.
|
n<>o h<> valores em $custid.
|
||||||
{/section}</programlisting>
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Sections tamb<6D>m tem as suas pr<70>prias vari<72>veis que manipulam as propriedaes section.
|
Sections tamb<6D>m tem as suas pr<70>prias vari<72>veis que manipulam as propriedades da section.
|
||||||
Estas s<>o indicadas assim: {$smarty.section.sectionname.varname}
|
Estas s<>o indicadas assim: {$smarty.section.nomesection.nomevariavel}
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
NOTA: a partir do Smarty 1.5.0, a sintaxe para as vari<72>veis de propriedades de section
|
|
||||||
mudou de {%sectionname.varname%} para
|
|
||||||
{$smarty.section.sectionname.varname}. A sintaxe antiga ainda <20> suportada,
|
|
||||||
mas voc<6F> ir<69> ver referencias apenas a nova sintaxe nos
|
|
||||||
exemplos do manual.
|
|
||||||
</para>
|
</para>
|
||||||
|
<note>
|
||||||
|
<title>Nota</title>
|
||||||
|
<para>
|
||||||
|
A partir do Smarty 1.5.0, a sintaxe para as vari<72>veis de propriedades da section
|
||||||
|
mudou de {%nomesecao.nomevariavel%} para {$smarty.section.nomesection.nomevariavel}. A
|
||||||
|
sintaxe antiga ainda <20> suportada, mas voc<6F> ver<65> refer<65>ncias somente <20> nova sintaxe no
|
||||||
|
manual.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
<sect2 id="section.property.index">
|
<sect2 id="section.property.index">
|
||||||
<title>index</title>
|
<title>index</title>
|
||||||
<para>
|
<para>
|
||||||
index <20> usado para mostrar o <20>ndice atual do loop, come<6D>ando em zero
|
index <20> usado para mostrar o <20>ndice atual do loop, come<6D>ando em zero
|
||||||
(ou pelo atributo start se dado), e incrementando por um (ou pelo
|
(ou pelo atributo start caso tenha sido definido), e incrementado por um
|
||||||
atributo step se dado).
|
(ou pelo atributo step caso tenha sido definido).
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Nota T<>cnica</title>
|
<title>Nota T<>cnica:</title>
|
||||||
<para>
|
<para>
|
||||||
Se as propriedades section n<>o for modificada,
|
Se as propriedades 'start' e 'step' da section n<>o foram modificadas,
|
||||||
ent<EFBFBD>o isto funciona igual a propriedade iteration da section,
|
elas ir<69>o funcionar da mesma maneira que a propriedade 'interation' da
|
||||||
exceto que come<6D>a em 0 ao inv<6E>s de 1.
|
section funcionam, exceto que ela come<EFBFBD>a do 0 ao inv<6E>s de 1.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>section property index</title>
|
<title>propriedade index da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid}
|
||||||
{/section}
|
{$smarty.section.consumidor.index} id: {$custid[consumidor]}<br>
|
||||||
|
{/section}
|
||||||
|
]]>
|
||||||
MOSTRA:
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
0 id: 1000<br>
|
<programlisting>
|
||||||
1 id: 1001<br>
|
<![CDATA[
|
||||||
2 id: 1002<br>
|
0 id: 1000<br>
|
||||||
|
1 id: 1001<br>
|
||||||
|
2 id: 1002<br>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
@@ -279,28 +309,31 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
<title>index_prev</title>
|
<title>index_prev</title>
|
||||||
<para>
|
<para>
|
||||||
index_prev <20> usado para mostrar o <20>ndice anterior do loop.
|
index_prev <20> usado para mostrar o <20>ndice anterior do loop.
|
||||||
No primeiro loop, isto <20> definido como -1.
|
No primeiro loop, o valor dele <20> -1.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property index_prev</title>
|
<title>propriedade index_prev da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid}
|
||||||
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
{$smarty.section.consumidor.index} id: {$custid[consumidor]}<br>
|
||||||
{if $custid[customer.index_prev] ne $custid[customer.index]}
|
{* Para sua informa<6D><61>o, $custid[consumidor.index] e $custid[consumidor] tem o mesmo significado *}
|
||||||
The customer id changed<br>
|
{if $custid[consumidor.index_prev] ne $custid[consumidor.index]}
|
||||||
|
O id do consumidor ir<69> mudar<br>
|
||||||
{/if}
|
{/if}
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
0 id: 1000<br>
|
<![CDATA[
|
||||||
The customer id changed<br>
|
0 id: 1000<br>
|
||||||
1 id: 1001<br>
|
O id do consumidor ir<69> mudar<br>
|
||||||
The customer id changed<br>
|
1 id: 1001<br>
|
||||||
2 id: 1002<br>
|
O id do consumidor ir<69> mudar<br>
|
||||||
The customer id changed<br>
|
2 id: 1002<br>
|
||||||
|
O id do consumidor ir<69> mudar<br>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
@@ -309,28 +342,31 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
<para>
|
<para>
|
||||||
index_next <20> usado para mostrar o pr<70>ximo indice do loop. No <20>ltimo loop,
|
index_next <20> usado para mostrar o pr<70>ximo indice do loop. No <20>ltimo loop,
|
||||||
isto ainda <20> um mais o <20>ndice atual( respeitando a defini<6E><69>o
|
isto ainda <20> um mais o <20>ndice atual( respeitando a defini<6E><69>o
|
||||||
do atributo step, se dado.)
|
do atributo step, caso tenha sido definido.)
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property index_next</title>
|
<title>propriedade index_next section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid}
|
||||||
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
{$smarty.section.consumidor.index} id: {$custid[consumidor]}<br>
|
||||||
{if $custid[customer.index_next] ne $custid[customer.index]}
|
{* Para sua informa<6D><61>o, $custid[consumidor.index] e $custid[consumidor] tem o mesmo significado *}
|
||||||
The customer id will change<br>
|
{if $custid[consumidor.index_next] ne $custid[consumidor.index]}
|
||||||
|
O id do consumidor ir<69> mudar<br>
|
||||||
{/if}
|
{/if}
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
0 id: 1000<br>
|
<![CDATA[
|
||||||
The customer id will change<br>
|
0 id: 1000<br>
|
||||||
1 id: 1001<br>
|
O id do consumidor ir<69> mudar<br>
|
||||||
The customer id will change<br>
|
1 id: 1001<br>
|
||||||
2 id: 1002<br>
|
O id do consumidor ir<69> mudar<br>
|
||||||
The customer id will change<br>
|
2 id: 1002<br>
|
||||||
|
O id do consumidor ir<69> mudar<br>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
@@ -339,36 +375,42 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
<para>
|
<para>
|
||||||
iteration <20> usado para mostrar a intera<72><61>o atual do loop.
|
iteration <20> usado para mostrar a intera<72><61>o atual do loop.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<note>
|
||||||
NOTA: isto n<>o <20> afetado pelas propriedades start, step e
|
<title>Nota:</title>
|
||||||
max, diferentemente das propriedade index. Iteration tamb<6D>m come<6D>a com 1
|
<para>
|
||||||
ao inv<6E>s de 0 como index. rownum <20> um apelido para iteration,
|
'interation' n<>o <20> afetado pelas propriedades start, step e max da section,
|
||||||
elas funcionam de modo identico.
|
diferentemente da propriedade index. Interation diferente de 'index' come<6D>a
|
||||||
</para>
|
com 1 ao inv<6E>s de 0. 'rownum' <20> um sin<69>nimo de 'interation', eles exercem a
|
||||||
|
mesma fun<75><6E>o.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>section property iteration</title>
|
<title>propriedade interation da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid start=5 step=2}
|
<![CDATA[
|
||||||
current loop iteration: {$smarty.section.customer.iteration}<br>
|
{section name=consumidor loop=$custid start=5 step=2}
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
intera<72><61>o atual do loop: {$smarty.section.consumidor.iteration}<br>
|
||||||
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
{$smarty.section.consumidor.index} id: {$custid[consumidor]}<br>
|
||||||
{if $custid[customer.index_next] ne $custid[customer.index]}
|
{* Para sua informa<6D><61>o, $custid[consumidor.index] e $custid[consumidor] tem o mesmo significado *}
|
||||||
The customer id will change<br>
|
{if $custid[consumidor.index_next] ne $custid[consumidor.index]}
|
||||||
|
O id do consumidor ir<69> mudar<br>
|
||||||
{/if}
|
{/if}
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
current loop iteration: 1
|
<![CDATA[
|
||||||
5 id: 1000<br>
|
intera<EFBFBD><EFBFBD>o atual do loop: 1
|
||||||
The customer id will change<br>
|
5 id: 1000<br>
|
||||||
current loop iteration: 2
|
O id do consumidor ir<69> mudar<br>
|
||||||
7 id: 1001<br>
|
intera<EFBFBD><EFBFBD>o atual do loop: 2
|
||||||
The customer id will change<br>
|
7 id: 1001<br>
|
||||||
current loop iteration: 3
|
O id do consumidor ir<69> mudar<br>
|
||||||
9 id: 1002<br>
|
intera<EFBFBD><EFBFBD>o atual do loop: 3
|
||||||
The customer id will change<br>
|
9 id: 1002<br>
|
||||||
|
O id do consumidor ir<69> mudar<br>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
@@ -379,62 +421,66 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
<20> a primeira.
|
<20> a primeira.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property first</title>
|
<title>propriedade first da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{if $smarty.section.customer.first}
|
{section name=consumidor loop=$custid}
|
||||||
<table>
|
{if $smarty.section.consumidor.first}
|
||||||
|
<table>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<tr><td>{$smarty.section.customer.index} id:
|
<tr><td>{$smarty.section.consumidor.index} id: {$custid[consumidor]}</td></tr>
|
||||||
{$custid[customer]}</td></tr>
|
|
||||||
|
|
||||||
{if $smarty.section.customer.last}
|
{if $smarty.section.consumidor.last}
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
<table>
|
<![CDATA[
|
||||||
<tr><td>0 id: 1000</td></tr>
|
<table>
|
||||||
<tr><td>1 id: 1001</td></tr>
|
<tr><td>0 id: 1000</td></tr>
|
||||||
<tr><td>2 id: 1002</td></tr>
|
<tr><td>1 id: 1001</td></tr>
|
||||||
</table>
|
<tr><td>2 id: 1002</td></tr>
|
||||||
|
</table>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="section.property.last">
|
<sect2 id="section.property.last">
|
||||||
<title>last</title>
|
<title>last</title>
|
||||||
<para>
|
<para>
|
||||||
last <20> definido como true de a intera<72><61>o atual da
|
last <20> definido como true se a intera<72><61>o atual da
|
||||||
section <20> a <20>ltima.
|
section <20> a <20>ltima.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property last</title>
|
<title>propriedade last da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{if $smarty.section.customer.first}
|
{section name=consumidor loop=$custid}
|
||||||
<table>
|
{if $smarty.section.consumidor.first}
|
||||||
|
<table>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<tr><td>{$smarty.section.customer.index} id:
|
<tr><td>{$smarty.section.consumidor.index} id: {$custid[consumidor]}</td></tr>
|
||||||
{$custid[customer]}</td></tr>
|
|
||||||
|
|
||||||
{if $smarty.section.customer.last}
|
{if $smarty.section.consumidor.last}
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
{/section}
|
{/section}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
<table>
|
<![CDATA[
|
||||||
<tr><td>0 id: 1000</td></tr>
|
<table>
|
||||||
<tr><td>1 id: 1001</td></tr>
|
<tr><td>0 id: 1000</td></tr>
|
||||||
<tr><td>2 id: 1002</td></tr>
|
<tr><td>1 id: 1001</td></tr>
|
||||||
</table>
|
<tr><td>2 id: 1002</td></tr>
|
||||||
|
</table>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
@@ -442,106 +488,120 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
<title>rownum</title>
|
<title>rownum</title>
|
||||||
<para>
|
<para>
|
||||||
rownum <20> usado para mostrar a intera<72><61>o atual do loop,
|
rownum <20> usado para mostrar a intera<72><61>o atual do loop,
|
||||||
come<6D>ando em um. <20> um apelido para iteration,
|
come<6D>ando em um. <20> um sin<EFBFBD>nimo de iteration,
|
||||||
elas funcionam de modo identico.
|
eles exercem a mesma fun<75><6E>o.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property rownum</title>
|
<title>propriedade rownum da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid}
|
||||||
{/section}
|
{$smarty.section.consumidor.rownum} id: {$custid[consumidor]}<br>
|
||||||
|
{/section}
|
||||||
|
]]>
|
||||||
MOSTRA:
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
1 id: 1000<br>
|
<programlisting>
|
||||||
2 id: 1001<br>
|
<![CDATA[
|
||||||
3 id: 1002<br>
|
1 id: 1000<br>
|
||||||
|
2 id: 1001<br>
|
||||||
|
3 id: 1002<br>
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="section.property.loop">
|
<sect2 id="section.property.loop">
|
||||||
<title>loop</title>
|
<title>loop</title>
|
||||||
<para>
|
<para>
|
||||||
loop <20> usado para mostrar o <20>ltimo n<>mero do <20>ndice do loop desta
|
loop <20> usado para exibir o n<>mero do <20>ltimo <20>ndice que a section percorreu.
|
||||||
section. Isto pode ser usado dentro ou depois de section.
|
Ele pode ser usado dentro ou ap<EFBFBD>s o t<>rmino da section.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property index</title>
|
<title>propridade index da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid}
|
<![CDATA[
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid}
|
||||||
{/section}
|
{$smarty.section.consumidor.index} id: {$custid[consumidor]}<br>
|
||||||
|
{/section}
|
||||||
|
|
||||||
There were {$smarty.section.customer.loop} customers shown above.
|
Foram mostrados {$smarty.section.customer.loop} consumidores acima.
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
0 id: 1000<br>
|
||||||
|
1 id: 1001<br>
|
||||||
|
2 id: 1002<br>
|
||||||
|
|
||||||
MOSTRA:
|
Foram mostrados 3 consumidores acima.
|
||||||
|
]]>
|
||||||
0 id: 1000<br>
|
|
||||||
1 id: 1001<br>
|
|
||||||
2 id: 1002<br>
|
|
||||||
|
|
||||||
There were 3 customers shown above.
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="section.property.show">
|
<sect2 id="section.property.show">
|
||||||
<title>show</title>
|
<title>show</title>
|
||||||
<para>
|
<para>
|
||||||
<emphasis>show</emphasis> <20> usado como par<61>metro para section.
|
<emphasis>show</emphasis> <20> usado como um par<EFBFBD>metro da section. <emphasis>show</emphasis>
|
||||||
<emphasis>show</emphasis> <20> um valor booleano, true ou false. Se
|
<09> um valor booleano, verdadeiro ou falso. Caso seja falso, a section n<>o ser<65> mostrada.
|
||||||
false, a section n<>o ser<65> mostrada. Se existir um sectionelse
|
Se existir uma sectionelse presente, ela ser<65> exibida.
|
||||||
presente, esta ser<65> alternativamente mostrado.
|
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section attribute show</title>
|
<title>atributo show da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* $show_customer_info deve ser passada da aplica<63><61>o PHP,
|
<![CDATA[
|
||||||
para regular quando mostrar ou n<>o mostrar esta section *}
|
{* $mostrar_info_consumidor talvez tenha que ser enviada pela
|
||||||
{section name=customer loop=$custid show=$show_customer_info}
|
aplica<63><61>o PHP, para decidir quando mostrar ou n<>o mostrar esta section *}
|
||||||
{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
|
|
||||||
{/section}
|
|
||||||
|
|
||||||
{if $smarty.section.customer.show}
|
{section name=consumidor loop=$custid show=$mostrar_info_consumidor}
|
||||||
the section was shown.
|
{$smarty.section.consumidor.rownum} id: {$custid[consumidor]}<br>
|
||||||
{else}
|
{/section}
|
||||||
the section was not shown.
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
{if $smarty.section.consumidor.show}
|
||||||
|
a section foi mostrada.
|
||||||
|
{else}
|
||||||
|
a section n<>o foi mostrada.
|
||||||
|
{/if}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
1 id: 1000<br>
|
||||||
|
2 id: 1001<br>
|
||||||
|
3 id: 1002<br>
|
||||||
|
|
||||||
MOSTRA:
|
a section foi mostrada.
|
||||||
|
]]>
|
||||||
1 id: 1000<br>
|
|
||||||
2 id: 1001<br>
|
|
||||||
3 id: 1002<br>
|
|
||||||
|
|
||||||
the section was shown.
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="section.property.total">
|
<sect2 id="section.property.total">
|
||||||
<title>total</title>
|
<title>total</title>
|
||||||
<para>
|
<para>
|
||||||
total <20> usado para mostrar o n<>mero de intera<72><61>es que esta section ter<EFBFBD>.
|
total <20> usado para exibir o n<>mero de intera<72><61>es que esta section ir<EFBFBD> percorrer.
|
||||||
Isto pode ser usado dentro ou depois da section.
|
Ela pode ser usada dentro ou ap<EFBFBD>s a section.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property total</title>
|
<title>propriedade total da section</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{section name=customer loop=$custid step=2}
|
<![CDATA[
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
{section name=consumidor loop=$custid step=2}
|
||||||
{/section}
|
{$smarty.section.consumidor.index} id: {$custid[consumidor]}<br>
|
||||||
|
{/section}
|
||||||
|
|
||||||
There were {$smarty.section.customer.total} customers shown above.
|
Foram mostrados {$smarty.section.customer.loop} consumidores acima.
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>MOSTRA:</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
0 id: 1000<br>
|
||||||
|
2 id: 1001<br>
|
||||||
|
4 id: 1002<br>
|
||||||
|
|
||||||
MOSTRA:
|
Foram mostrados 3 consumidores acima.
|
||||||
|
]]>
|
||||||
0 id: 1000<br>
|
|
||||||
2 id: 1001<br>
|
|
||||||
4 id: 1002<br>
|
|
||||||
|
|
||||||
There were 3 customers shown above.
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
@@ -3,53 +3,57 @@
|
|||||||
<sect1 id="language.function.strip">
|
<sect1 id="language.function.strip">
|
||||||
<title>strip</title>
|
<title>strip</title>
|
||||||
<para>
|
<para>
|
||||||
V<>rias vezes web designers tem problemas com espa<70>os em branco e
|
Muitas vezes web designers tem problemas com espa<70>os em branco e
|
||||||
carriage returns afetam a sa<EFBFBD>da do HTML (browser
|
caracteres especiais (carriage returns) afetam a exibi<EFBFBD><EFBFBD>o do HTML
|
||||||
"features"), assim voc<6F> tem que colocar todas as suas tags juntas para ter
|
("caracter<65>sticas" do navegador), assim voc<6F> <EFBFBD> obrigado <20> colocar todas
|
||||||
os resultados desejados. Isto normalmente termina em um
|
as suas tags juntas para obter os resultados esperados. Isso geralmente
|
||||||
template ileg<65>vel ou que n<>o se consegue ler.
|
acaba tornando o template ileg<65>vel ou n<EFBFBD>o manipul<75>vel.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Tudo dentro de {strip}{/strip} no Smarty tem retirados os espa<70>os em branco
|
Tudo entre as tags {strip}{/strip} no Smarty tem seus espa<70>os extras
|
||||||
e carriage returns no inicio e final das linhas
|
ou caracteres especiais (carriage returns) removidos no in<EFBFBD>cio e fim das
|
||||||
antes que sejam mostrados. Deste modo voc<6F> pode manter seu template
|
linhas antes de elas serem exibidas. Deste modo voc<6F> pode manter seu
|
||||||
leg<65>vel, e n<>o se preocupar com o espa<EFBFBD>o estra causando
|
template leg<EFBFBD>vel, e n<>o se preocupar com espa<70>os extras causando
|
||||||
problemas.
|
problemas.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Nota T<>cnica</title>
|
<title>Nota T<>cnica</title>
|
||||||
<para>
|
<para>
|
||||||
{strip}{/strip} n<>o afeta o conte<74>do das vari<72>veis de template.
|
{strip}{/strip} n<>o afeta o conte<74>do das vari<72>veis de template.
|
||||||
Veja <link linkend="language.modifier.strip">strip modifier
|
Veja <link linkend="language.modifier.strip">modificador strip</link>.
|
||||||
function</link>.
|
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>strip tags</title>
|
<title>strip tags</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
{* o seguinte estar<61> tudo junto em uma linha na sa<73>da *}
|
<![CDATA[
|
||||||
|
{* o c<>digo abaixo ser<65> convertido em uma linha na hora da exibi<62><69>o *}
|
||||||
{strip}
|
{strip}
|
||||||
<table border=0>
|
<table border=0>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<A HREF="{$url}">
|
<A HREF="{$url}">
|
||||||
<font color="red">This is a test</font>
|
<font color="red">Isto <20> um teste</font>
|
||||||
</A>
|
</A>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{/strip}
|
{/strip}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
MOSTRA:
|
<para>MOSTRAR<EFBFBD>:</para>
|
||||||
|
<programlisting>
|
||||||
<table border=0><tr><td><A HREF="http://my.domain.com"><font color="red">This is a test</font></A></td></tr></table></programlisting>
|
<![CDATA[
|
||||||
|
<table border=0><tr><td><A HREF="http://meu.dominio.com"><font color="red">Isto <20> um teste</font></A></td></tr></table>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Note que no exemplo acima, todas as linhas come<6D>am e terminam
|
Observe que no exemplo acima, todas as linhas come<6D>am e terminam com tags HTML.
|
||||||
com tags HTML. Tenha cuidado que todas as linhas ficam juntas.
|
Esteja ciente para que todas as linhas fiquem juntas.
|
||||||
Se voc<6F> tiver texto simples no inicio ou no final de uma linha,
|
Se voc<6F> tiver texto simples no in<EFBFBD>cio ou final de uma linha,
|
||||||
ele estar<EFBFBD> junto, e pode n<>o ser o resultado desejado.
|
ele ser<EFBFBD> juntado na hora da convers<72>o e pode causar resultados
|
||||||
|
n<>o desejados.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
Reference in New Issue
Block a user