mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
let's split the pt_br dir
This commit is contained in:
@@ -1,404 +0,0 @@
|
|||||||
<part id="appendixes"><!-- En Version: 1.12 -->
|
|
||||||
<title>Ap<41>ndices</title>
|
|
||||||
<chapter id="troubleshooting">
|
|
||||||
<title>Localiza<7A><61>o de Erros</title>
|
|
||||||
<para></para>
|
|
||||||
<sect1 id="smarty.php.errors">
|
|
||||||
<title>erros de Smarty/PHP </title>
|
|
||||||
<para>
|
|
||||||
O Smarty pode obter muitos erros tais como, atributos de tags perdidos ou nomes de vari<72>veis
|
|
||||||
mal formadas. Se isto acontece, voc<6F> ver<65>
|
|
||||||
um erro como segue:
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<example>
|
|
||||||
<title>Erros do Smarty</title>
|
|
||||||
<programlisting>
|
|
||||||
Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah'
|
|
||||||
in /path/to/smarty/Smarty.class.php on line 1041
|
|
||||||
|
|
||||||
Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
|
|
||||||
in /path/to/smarty/Smarty.class.php on line 1041</programlisting>
|
|
||||||
</example>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
O Smarty te mostra o nome do template, o n<>mero da linha e o erro.
|
|
||||||
Depois disso, o erro consiste do n<>mero da linha da classe Smarty em que o erro
|
|
||||||
ocorreu.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
H<> certos erros que o smarty n<>o pode entender, tais como um um fechamento de tags errado.
|
|
||||||
Estes tipos de erros normalmente
|
|
||||||
termina na interpreta<74><61>o de erros do tempo de compila<6C><61>o do PHP.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<example>
|
|
||||||
<title>Erros de an<61>lise do PHP</title>
|
|
||||||
<programlisting>
|
|
||||||
Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75</programlisting>
|
|
||||||
</example>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
Quando voc<6F> encontra um erro de an<61>lise de PHP, o n<>mero da linha do erro corresponder<65> ao
|
|
||||||
script PHP compilado, n<>o o template em si. Normalmente voc<6F> pode no template localizar o
|
|
||||||
erro de sintaxe. Aqui algumas coisas para voc<6F> procurar:
|
|
||||||
falta de fechamento de tags para {if}{/if} ou
|
|
||||||
{section}{/section}, ou sintaxe da l<>gica dentro de uma tag {if}.
|
|
||||||
Se voc<6F> n<>o encontra o erro, voc<6F> pode ter
|
|
||||||
que abrir o arquivo PHP compilado e ir at<61> o numero da linha exibido, no local onde o erro correspondente
|
|
||||||
est<73> no template.
|
|
||||||
</para>
|
|
||||||
</sect1>
|
|
||||||
</chapter>
|
|
||||||
<chapter id="tips">
|
|
||||||
<title>Dicas & Truques</title>
|
|
||||||
<para>
|
|
||||||
</para>
|
|
||||||
<sect1 id="tips.blank.var.handling">
|
|
||||||
<title>Manipula<6C><61>o de Vari<72>vel Vazia</title>
|
|
||||||
<para>
|
|
||||||
Quando voc<6F> quer algumas vezes imprimir um valor que voc<6F> definir para uma vari<72>vel vazia
|
|
||||||
ao inv<6E>s de imprimir nada, tal como imprimindo "&nbsp;" a fim de que plano de fundo de tabelas
|
|
||||||
funcionem corretamente. Muitos usariam uma instru<72><75>o {if} para manipular isto, mas h<> um
|
|
||||||
macete com o Smarty, usando o modificador de vari<72>vel
|
|
||||||
<emphasis>default</emphasis>.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Imprimindo &nbsp; quando uma vari<72>vel est<73> vazia</title>
|
|
||||||
<programlisting>
|
|
||||||
|
|
||||||
{* A forma mais longa *}
|
|
||||||
|
|
||||||
{if $title eq ""}
|
|
||||||
&nbsp;
|
|
||||||
{else}
|
|
||||||
{$title}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
{* A forma mais simples *}
|
|
||||||
|
|
||||||
{$title|default:"&nbsp;"}</programlisting>
|
|
||||||
</example>
|
|
||||||
</sect1>
|
|
||||||
|
|
||||||
<sect1 id="tips.default.var.handling">
|
|
||||||
<title>Manipula<6C><61>o do valor padr<64>o de Vari<72>vel</title>
|
|
||||||
<para>
|
|
||||||
Se uma vari<72>vel <20> usada freq<65>entemente em seus templates, aplicando o modificador
|
|
||||||
default toda vez que ela <20> mencionado pode evitar um bit desagrad<61>vel. Voc<6F> pode remediar isto
|
|
||||||
pela atribui<75><69>o de um valor padr<64>o para a vari<72>vel com a fun<75><6E>o
|
|
||||||
<link linkend="language.function.assign">assign</link>.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Atribuindo o valor padr<64>o para uma vari<72>vel de template</title>
|
|
||||||
<programlisting>
|
|
||||||
{* fa<66>a isto em algum lugar no topo de seu template *}
|
|
||||||
{assign var="titulo" value=$titulo|default:"sem t<>tulo"}
|
|
||||||
|
|
||||||
{* Se o $titulo estava vazio, ele agora cont<6E>m o valor "sem titulo" quando voc<6F> exib<69>-lo *}
|
|
||||||
{$title}</programlisting>
|
|
||||||
</example>
|
|
||||||
</sect1>
|
|
||||||
<sect1 id="tips.passing.vars">
|
|
||||||
<title>Passando a vari<72>vel titulo para o template de cabe<62>alho</title>
|
|
||||||
<para>
|
|
||||||
Quando a maioria de seus templates usam os mesmos cabe<62>alhos e mesmos rodap<61>s, <20>
|
|
||||||
comum dividi-los um em cada template e ent<6E>o inclu<6C>-los. Mas o que fazer se o
|
|
||||||
cabe<62>alho precisa ter um titulo diferente, dependendo de que p<>gina ele est<73> vindo?
|
|
||||||
Voc<6F> pode passar o titulo para o
|
|
||||||
cabe<62>alho quando ele <20> inclu<6C>do.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Passando a vari<72>vel titulo para o template de cabe<62>alho</title>
|
|
||||||
<programlisting>
|
|
||||||
|
|
||||||
mainpage.tpl
|
|
||||||
------------
|
|
||||||
|
|
||||||
{include file="header.tpl" titulo="P<>gina Principal"}
|
|
||||||
{* O corpo do template vem aqui *}
|
|
||||||
{include file="footer.tpl"}
|
|
||||||
|
|
||||||
|
|
||||||
archives.tpl
|
|
||||||
------------
|
|
||||||
|
|
||||||
{config_load file="archive_page.conf"}
|
|
||||||
{include file="header.tpl" titulo=#archivePageTitle#}
|
|
||||||
{* O corpo do template vem aqui *}
|
|
||||||
{include file="footer.tpl"}
|
|
||||||
|
|
||||||
|
|
||||||
header.tpl
|
|
||||||
----------
|
|
||||||
<HTML>
|
|
||||||
<HEAD>
|
|
||||||
<TITLE>{$titulo|default:"BC News"}</TITLE>
|
|
||||||
</HEAD>
|
|
||||||
<BODY>
|
|
||||||
|
|
||||||
|
|
||||||
footer.tpl
|
|
||||||
----------
|
|
||||||
</BODY>
|
|
||||||
</HTML></programlisting>
|
|
||||||
</example>
|
|
||||||
<para>
|
|
||||||
Quando a p<>gina principal <20> atra<72>da, o t<>tulo da "P<>gina Principal" <20> passado para o template
|
|
||||||
header.tpl, e ser<65> subseq<65>encialmente usado com o t<>tulo. Quando a p<>gina de arquivamento <20> atra<72>da,
|
|
||||||
o t<>tulo ser<65> "Archives". Note no exemplo de archive, n<>s estamos usando uma vari<72>vel do arquivo
|
|
||||||
archives_page.conf ao inv<6E>s de uma vari<72>vel codificada r<>gida.
|
|
||||||
Tamb<6D>m note que "BC news" <20> exibida se
|
|
||||||
a vari<72>vel $titulo n<>o est<73> definida,
|
|
||||||
usando o modificador de vari<72>vel <emphasis>default</emphasis>.
|
|
||||||
</para>
|
|
||||||
</sect1>
|
|
||||||
<sect1 id="tips.dates">
|
|
||||||
<title>Datas</title>
|
|
||||||
<para>
|
|
||||||
Como uma regra b<>sica, sempre passe datas para o smarty como timestamps. Isto permite ao
|
|
||||||
desenhista de template utilizar <link linkend="language.modifier.date.format">date_format</link>
|
|
||||||
para controle completo sobre a formata<74><61>o de data,
|
|
||||||
e tamb<6D>m facilita a compara<72><61>o de datas se
|
|
||||||
necess<73>rio.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
NOTA: No Smarty 1.4.0, voc<6F> pode passar datas para o Smarty como timestamps unix,
|
|
||||||
mysql, ou qualquer outra data interpret<65>vel por strtotime().
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Usando date_format</title>
|
|
||||||
<programlisting>
|
|
||||||
{$startDate|date_format}
|
|
||||||
|
|
||||||
SA<EFBFBD>DA:
|
|
||||||
|
|
||||||
Jan 4, 2001
|
|
||||||
|
|
||||||
|
|
||||||
{$startDate|date_format:"%Y/%m/%d"}
|
|
||||||
|
|
||||||
SA<EFBFBD>DA:
|
|
||||||
|
|
||||||
2001/01/04
|
|
||||||
|
|
||||||
|
|
||||||
{if $date1 < $date2}
|
|
||||||
...
|
|
||||||
{/if}</programlisting>
|
|
||||||
</example>
|
|
||||||
<para>
|
|
||||||
Quando usando {html_select_date} em um template, o programador normalmente vai querer converter
|
|
||||||
a sa<73>da de um formul<75>rio de volta para o formato de timestamp. Aqui est<73> uma fun<75><6E>o para ajudar
|
|
||||||
com isso.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Convertendo elementos em forma de data de volta para um timestamp</title>
|
|
||||||
<programlisting>
|
|
||||||
// isto assume que a forma de seus elementos s<>o nomeadas como
|
|
||||||
// startDate_Day, startDate_Month, startDate_Year
|
|
||||||
|
|
||||||
$startDate = makeTimeStamp($startDate_Year,$startDate_Month,$startDate_Day);
|
|
||||||
|
|
||||||
function makeTimeStamp($year="",$month="",$day="")
|
|
||||||
{
|
|
||||||
if(empty($year))
|
|
||||||
$year = strftime("%Y");
|
|
||||||
if(empty($month))
|
|
||||||
$month = strftime("%m");
|
|
||||||
if(empty($day))
|
|
||||||
$day = strftime("%d");
|
|
||||||
|
|
||||||
return mktime(0,0,0,$month,$day,$year);
|
|
||||||
}</programlisting>
|
|
||||||
</example>
|
|
||||||
</sect1>
|
|
||||||
<sect1 id="tips.wap">
|
|
||||||
<title>WAP/WML</title>
|
|
||||||
<para>
|
|
||||||
Os templates WAP/WML requerem um cabe<62>alho de Content-Type de PHP para ser passado junto com
|
|
||||||
template. A forma mais f<>cil de fazer isto seria escrever uma fun<75><6E>o customizada que imprime
|
|
||||||
o cabe<62>alho. Se voc<6F> est<73> usando sistema de caching, esse n<>o funcionar<61>, ent<6E>o n<>s faremos isso
|
|
||||||
usando a tag de insert (lembre que tags de insert n<>o s<>o "cached!") Certifique-se que n<>o h<> sa<73>da
|
|
||||||
para o navegador antes do template,
|
|
||||||
sen<65>o o cabe<62>alho ir<69> falhar.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Usando insert para escrever um cabe<62>alho WML Content-Type</title>
|
|
||||||
<programlisting>
|
|
||||||
// esteja certo que o apache est<73> configurado para as extens<6E>es .wml !
|
|
||||||
// ponha esta fun<75><6E>o em algum lugar de sua aplica<63><61>o, ou em Smarty.addons.php
|
|
||||||
function insert_header() {
|
|
||||||
// esta fun<75><6E>o espera o argumento $content
|
|
||||||
extract(func_get_arg(0));
|
|
||||||
if(empty($content))
|
|
||||||
return;
|
|
||||||
header($content);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// seu template Smarty _deve_ come<6D>ar com a insert tag, olha o exemplo:
|
|
||||||
|
|
||||||
{insert name=header content="Content-Type: text/vnd.wap.wml"}
|
|
||||||
|
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
|
|
||||||
|
|
||||||
<!-- begin new wml deck -->
|
|
||||||
<wml>
|
|
||||||
<!-- begin first card -->
|
|
||||||
<card>
|
|
||||||
<do type="accept">
|
|
||||||
<go href="#two"/>
|
|
||||||
</do>
|
|
||||||
<p>
|
|
||||||
Bem-vindo ao WAP com Smarty!
|
|
||||||
Pressione OK para continuar...
|
|
||||||
</p>
|
|
||||||
</card>
|
|
||||||
<!-- begin second card -->
|
|
||||||
<card id="two">
|
|
||||||
<p>
|
|
||||||
Bem f<>cil isso, n<>o <20>?
|
|
||||||
</p>
|
|
||||||
</card>
|
|
||||||
</wml></programlisting>
|
|
||||||
</example>
|
|
||||||
</sect1>
|
|
||||||
<sect1 id="tips.componentized.templates">
|
|
||||||
<title>Templates componentizados</title>
|
|
||||||
<para>
|
|
||||||
Esta dica <20> um pouco de hack, mas ainda <20> uma id<69>ia limpa.
|
|
||||||
Use-a por seu pr<70>prio risco. ;-)
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Tradicionalmente, programar templates em suas aplica<63><61>es segue esta forma:
|
|
||||||
Primeiro, voc<6F> acumula suas vari<72>veis dentro de sua aplica<63><61>o PHP, (talvez com requisi<73><69>es
|
|
||||||
de banco de dados.) Ent<6E>o, voc<6F> instancia seu objeto Smarty, atribui valores <20>s vari<72>veis
|
|
||||||
e exibe o template. Por exemplo n<>s temos um registrador de estoque em nosso template.
|
|
||||||
N<>s coletar<61>amos os dados estocagem em nossa aplica<63><61>o, ent<6E>o damos valor a estas vari<72>veis
|
|
||||||
no template e o exibimos. Agora isso seria legal
|
|
||||||
se voc<6F> adicionasse este registrador de
|
|
||||||
armazenamento (stock ticker) para qualquer aplica<63><61>o simplesmente incluindo o template, e sem
|
|
||||||
se preocupar com a busca de dados mais a frente?
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Voc<6F> pode embutir o PHP dentro de seus templates com as tags {php}{/php}.
|
|
||||||
Com isto, voc<6F> pode configurar templates independentes, tendo a sua pr<70>pria
|
|
||||||
estrutura de dados para dar valor <20>s suas pr<70>prias vari<72>veis. Com a l<>gica embutida
|
|
||||||
dessa forma, voc<6F> pode manter a l<>gica do template & junto. Desta maneira n<>o <20>
|
|
||||||
importante de onde o fonte do
|
|
||||||
template est<73> vindo, ele est<73> sempre junto como um componente.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Template componentizado</title>
|
|
||||||
<programlisting>
|
|
||||||
{* Smarty *}
|
|
||||||
|
|
||||||
{php}
|
|
||||||
|
|
||||||
// configurar nossa fun<75><6E>o para buscar dados armazenados
|
|
||||||
function fetch_ticker($symbol,&$ticker_name,&$ticker_price) {
|
|
||||||
// ponha a l<>gica aqui que procura $ticker_name
|
|
||||||
// e $ticker_price de algum recurso
|
|
||||||
}
|
|
||||||
|
|
||||||
// chama a fun<75><6E>o
|
|
||||||
fetch_ticker("YHOO",$ticker_name,$ticker_price);
|
|
||||||
|
|
||||||
// passando valores <20>s vari<72>veis de template
|
|
||||||
$this->assign("ticker_name",$ticker_name);
|
|
||||||
$this->assign("ticker_price",$ticker_price);
|
|
||||||
|
|
||||||
{/php}
|
|
||||||
|
|
||||||
Nome do Estoque: {$ticker_name} Pre<72>o do Estoque: {$ticker_price}</programlisting>
|
|
||||||
</example>
|
|
||||||
<para>
|
|
||||||
No Smarty 1.5.0, h<> at<61> uma forma mais limpa. Voc<6F> pode incluir o php em seus templates com
|
|
||||||
a tag {include_php ...}.
|
|
||||||
Desta forma voc<6F> pode manter a l<>gica do PHP separada da l<>gica do
|
|
||||||
template. Veja a fun<75><6E>o <link linkend="language.function.include.php">include_php</link> para
|
|
||||||
mais informa<6D><61>o.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Template componentizado com include_php</title>
|
|
||||||
<programlisting>
|
|
||||||
load_ticker.php
|
|
||||||
---------------
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// configura nossa fun<75><6E>o para buscar os dados armazenados
|
|
||||||
function fetch_ticker($symbol,&$ticker_name,&$ticker_price) {
|
|
||||||
// ponha aqui a l<>gica que procura $ticker_name
|
|
||||||
// e $ticker_price de algum recurso
|
|
||||||
}
|
|
||||||
|
|
||||||
// chama a fun<75><6E>o
|
|
||||||
fetch_ticker("YHOO",$ticker_name,$ticker_price);
|
|
||||||
|
|
||||||
// passar valores para as vari<72>veis de template
|
|
||||||
$this->assign("ticker_name",$ticker_name);
|
|
||||||
$this->assign("ticker_price",$ticker_price);
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
index.tpl
|
|
||||||
---------
|
|
||||||
|
|
||||||
{* Smarty *}
|
|
||||||
|
|
||||||
{include_php file="load_ticker.php"}
|
|
||||||
|
|
||||||
Nome do Estoque: {$ticker_name} Pre<72>o do Estoque: {$ticker_price}</programlisting>
|
|
||||||
</example>
|
|
||||||
</sect1>
|
|
||||||
<sect1 id="tips.obfuscating.email">
|
|
||||||
<title>Ofuscando endere<72>os de E-mail</title>
|
|
||||||
<para>
|
|
||||||
Voc<6F> deseja saber como seu endere<72>o de E-mail consegue entrar em tantas listas de email de spam?
|
|
||||||
A <20>nica forma de spammers coletar endere<72>os de E-mail <20> de p<>ginas da web. Para ajudar a combater
|
|
||||||
este problema, voc<6F> pode fazer o seu endere<72>o de E-mail aparecer em javascript misturado no
|
|
||||||
c<>digo HTML, mesmo assim ele aparecer<65> e funcionar<61> corretamente no navegador. Isto <20> feito com
|
|
||||||
o plugin mailto.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Exemplo de ofuscamento de um Endere<72>o de E-mail</title>
|
|
||||||
<programlisting>
|
|
||||||
|
|
||||||
index.tpl
|
|
||||||
---------
|
|
||||||
|
|
||||||
envia inquisi<73><69>o para
|
|
||||||
{mailto address=$EmailAddress encode="javascript" subject="Ol<4F>"}
|
|
||||||
|
|
||||||
</programlisting>
|
|
||||||
</example>
|
|
||||||
<note>
|
|
||||||
<title>Nota t<>cnica</title>
|
|
||||||
<para>
|
|
||||||
Este m<>todo n<>o <20> 100% a prova de falha. Um spammer poderia criar um programa
|
|
||||||
para coletar o e-mail e para decodificar estes valores, mas n<>o <20> muito comum.
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
</sect1>
|
|
||||||
</chapter>
|
|
||||||
<chapter id="resources">
|
|
||||||
<title>Recursos</title>
|
|
||||||
<para>
|
|
||||||
A homepage do Smarty est<73> localizada em http://smarty.php.net/.
|
|
||||||
Voc<6F> pode entrar na lista de email enviando um e-mail para
|
|
||||||
smarty-general-subscribe@lists.php.net. Um arquivo da lista de e-mail pode ser
|
|
||||||
visto em http://marc.theaimsgroup.com/?l=smarty&r=1&w=2
|
|
||||||
</para>
|
|
||||||
</chapter>
|
|
||||||
<chapter id="bugs">
|
|
||||||
<title>BUGS</title>
|
|
||||||
<para>
|
|
||||||
Verifique o arquivo de BUGS que v<>m com a <20>ltima distribui<75><69>o do Smarty, ou
|
|
||||||
verifique o website.
|
|
||||||
</para>
|
|
||||||
</chapter>
|
|
||||||
</part>
|
|
39
docs/pt_BR/bookinfo.xml
Executable file
39
docs/pt_BR/bookinfo.xml
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- $Revision$ -->
|
||||||
|
<bookinfo id="bookinfo">
|
||||||
|
<title>Smarty - the compiling PHP template engine</title>
|
||||||
|
<authorgroup id="authors">
|
||||||
|
<author>
|
||||||
|
<firstname>Monte</firstname><surname>Ohrt <monte@ispi.net></surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Andrei</firstname><surname>Zmievski <andrei@php.net></surname>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
<pubdate>&build-date;</pubdate>
|
||||||
|
<copyright>
|
||||||
|
<year>2001-2004</year>
|
||||||
|
<holder>ispi of Lincoln, Inc.</holder>
|
||||||
|
</copyright>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<!-- 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
|
||||||
|
-->
|
File diff suppressed because it is too large
Load Diff
@@ -1,382 +0,0 @@
|
|||||||
;; -*- Scheme -*-
|
|
||||||
;;
|
|
||||||
;; $Id$
|
|
||||||
;;
|
|
||||||
|
|
||||||
;; Returns the depth of the auto-generated TOC (table of contents) that
|
|
||||||
;; should be made at the nd-level
|
|
||||||
(define (toc-depth nd)
|
|
||||||
(if (string=? (gi nd) (normalize "book"))
|
|
||||||
3 ; the depth of the top-level TOC
|
|
||||||
1 ; the depth of all other TOCs
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(element (funcdef function)
|
|
||||||
($bold-seq$
|
|
||||||
(make sequence
|
|
||||||
(process-children)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
(define (is-true-optional nl)
|
|
||||||
(and (equal? (gi (parent nl)) (normalize "parameter"))
|
|
||||||
(equal? 0 (string-length (strip (data (preced nl)))))
|
|
||||||
(equal? 0 (string-length (strip (data (follow nl)))))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
(define (has-true-optional nl)
|
|
||||||
(is-true-optional
|
|
||||||
(node-list-first-element
|
|
||||||
(select-elements
|
|
||||||
(descendants nl)
|
|
||||||
(normalize "optional"))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
(define (count-true-optionals nl)
|
|
||||||
(let loop
|
|
||||||
((result 0)
|
|
||||||
(nl (select-elements (descendants nl) (normalize "optional")))
|
|
||||||
)
|
|
||||||
(if(node-list-empty? nl)
|
|
||||||
result
|
|
||||||
(if(is-true-optional(node-list-first nl))
|
|
||||||
(loop (+ result 1) (node-list-rest nl))
|
|
||||||
(loop result (node-list-rest nl))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
;; there are two different kinds of optionals
|
|
||||||
;; optional parameters and optional parameter parts
|
|
||||||
;; an optional parameter is identified by an optional tag
|
|
||||||
;; with a parameter tag as its parent
|
|
||||||
;; and only whitespace between them
|
|
||||||
(element optional
|
|
||||||
;;check for true optional parameter
|
|
||||||
(if (is-true-optional (current-node))
|
|
||||||
;; yes - handle '[...]' in paramdef
|
|
||||||
(process-children-trim)
|
|
||||||
;; no - do '[...]' output
|
|
||||||
(make sequence
|
|
||||||
(literal %arg-choice-opt-open-str%)
|
|
||||||
(process-children-trim)
|
|
||||||
(literal %arg-choice-opt-close-str%)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; now this is going to be tricky
|
|
||||||
(element paramdef
|
|
||||||
(make sequence
|
|
||||||
;; special treatment for first parameter in funcsynopsis
|
|
||||||
(if (equal? (child-number (current-node)) 1)
|
|
||||||
;; is first ?
|
|
||||||
(make sequence
|
|
||||||
;; start parameter list
|
|
||||||
(literal "(")
|
|
||||||
;; is optional ?
|
|
||||||
( if (has-true-optional (current-node))
|
|
||||||
(literal %arg-choice-opt-open-str%)
|
|
||||||
(empty-sosofo)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
;; not first
|
|
||||||
(empty-sosofo)
|
|
||||||
)
|
|
||||||
|
|
||||||
;;
|
|
||||||
(process-children-trim)
|
|
||||||
|
|
||||||
;; special treatment for last parameter
|
|
||||||
(if (equal? (gi (ifollow (current-node))) (normalize "paramdef"))
|
|
||||||
;; more parameters will follow
|
|
||||||
(make sequence
|
|
||||||
;; next is optional ?
|
|
||||||
( if (has-true-optional (ifollow (current-node)))
|
|
||||||
;; optional
|
|
||||||
(make sequence
|
|
||||||
(literal " ")
|
|
||||||
(literal %arg-choice-opt-open-str%)
|
|
||||||
)
|
|
||||||
;; not optional
|
|
||||||
(empty-sosofo)
|
|
||||||
)
|
|
||||||
(literal ", " )
|
|
||||||
)
|
|
||||||
;; last parameter
|
|
||||||
(make sequence
|
|
||||||
(literal
|
|
||||||
(let loop ((result "")(count (count-true-optionals (parent (current-node)))))
|
|
||||||
(if (<= count 0)
|
|
||||||
result
|
|
||||||
(loop (string-append result %arg-choice-opt-close-str%)(- count 1))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
( literal ")" )
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
(element function
|
|
||||||
(let* ((function-name (data (current-node)))
|
|
||||||
(linkend
|
|
||||||
(string-append
|
|
||||||
"function."
|
|
||||||
(string-replace
|
|
||||||
(string-replace function-name "_" "-")
|
|
||||||
"::" ".")))
|
|
||||||
(target (element-with-id linkend))
|
|
||||||
(parent-gi (gi (parent))))
|
|
||||||
(cond
|
|
||||||
;; function names should be plain in FUNCDEF
|
|
||||||
((equal? parent-gi "funcdef")
|
|
||||||
(process-children))
|
|
||||||
|
|
||||||
;; if a valid ID for the target function is not found, or if the
|
|
||||||
;; FUNCTION tag is within the definition of the same function,
|
|
||||||
;; make it bold, add (), but don't make a link
|
|
||||||
((or (node-list-empty? target)
|
|
||||||
(equal? (case-fold-down
|
|
||||||
(data (node-list-first
|
|
||||||
(select-elements
|
|
||||||
(node-list-first
|
|
||||||
(children
|
|
||||||
(select-elements
|
|
||||||
(children
|
|
||||||
(ancestor-member (parent) (list "refentry")))
|
|
||||||
"refnamediv")))
|
|
||||||
"refname"))))
|
|
||||||
function-name))
|
|
||||||
($bold-seq$
|
|
||||||
(make sequence
|
|
||||||
(process-children)
|
|
||||||
(literal "()"))))
|
|
||||||
|
|
||||||
;; else make a link to the function and add ()
|
|
||||||
(else
|
|
||||||
(make element gi: "A"
|
|
||||||
attributes: (list
|
|
||||||
(list "HREF" (href-to target)))
|
|
||||||
($bold-seq$
|
|
||||||
(make sequence
|
|
||||||
(process-children)
|
|
||||||
(literal
|
|
||||||
)
|
|
||||||
(literal "()"))))))))
|
|
||||||
|
|
||||||
(element command
|
|
||||||
(let* ((command-name (data (current-node)))
|
|
||||||
(linkend
|
|
||||||
(string-append
|
|
||||||
"language.function."
|
|
||||||
(string-replace
|
|
||||||
(string-replace command-name "_" ".")
|
|
||||||
"::" ".")))
|
|
||||||
(target (element-with-id linkend))
|
|
||||||
(parent-gi (gi (parent))))
|
|
||||||
(cond
|
|
||||||
;; function names should be plain in FUNCDEF
|
|
||||||
((equal? parent-gi "funcdef")
|
|
||||||
(process-children))
|
|
||||||
|
|
||||||
;; if a valid ID for the target function is not found, or if the
|
|
||||||
;; FUNCTION tag is within the definition of the same function,
|
|
||||||
;; make it bold, add (), but don't make a link
|
|
||||||
((or (node-list-empty? target)
|
|
||||||
(equal? (case-fold-down
|
|
||||||
(data (node-list-first
|
|
||||||
(select-elements
|
|
||||||
(node-list-first
|
|
||||||
(children
|
|
||||||
(select-elements
|
|
||||||
(children
|
|
||||||
(ancestor-member (parent) (list "refentry")))
|
|
||||||
"refnamediv")))
|
|
||||||
"refname"))))
|
|
||||||
command-name))
|
|
||||||
($bold-seq$
|
|
||||||
(make sequence
|
|
||||||
(literal "{")
|
|
||||||
(process-children)
|
|
||||||
(literal "}"))))
|
|
||||||
|
|
||||||
;; else make a link to the function and add ()
|
|
||||||
(else
|
|
||||||
(make element gi: "A"
|
|
||||||
attributes: (list
|
|
||||||
(list "HREF" (href-to target)))
|
|
||||||
($bold-seq$
|
|
||||||
(make sequence
|
|
||||||
(literal "{")
|
|
||||||
(process-children)
|
|
||||||
(literal "}"))))))))
|
|
||||||
|
|
||||||
(element classname
|
|
||||||
(let* ((class-name (data (current-node)))
|
|
||||||
(linkend
|
|
||||||
(string-append
|
|
||||||
"class."
|
|
||||||
(string-replace
|
|
||||||
(case-fold-down class-name) "_" "-")))
|
|
||||||
(target (element-with-id linkend))
|
|
||||||
(parent-gi (gi (parent))))
|
|
||||||
(cond
|
|
||||||
;; function names should be plain in SYNOPSIS
|
|
||||||
((equal? parent-gi "synopsis")
|
|
||||||
(process-children))
|
|
||||||
|
|
||||||
;; if a valid ID for the target class is not found, or if the
|
|
||||||
;; CLASSNAME tag is within the definition of the same class,
|
|
||||||
;; make it bold, but don't make a link
|
|
||||||
((or (node-list-empty? target)
|
|
||||||
(equal? (case-fold-down
|
|
||||||
(data (node-list-first
|
|
||||||
(select-elements
|
|
||||||
(node-list-first
|
|
||||||
(children
|
|
||||||
(select-elements
|
|
||||||
(children
|
|
||||||
(ancestor-member (parent) (list "refentry")))
|
|
||||||
"refnamediv")))
|
|
||||||
"refname"))))
|
|
||||||
class-name))
|
|
||||||
($bold-seq$
|
|
||||||
(process-children)))
|
|
||||||
|
|
||||||
;; else make a link to the function and add ()
|
|
||||||
(else
|
|
||||||
(make element gi: "A"
|
|
||||||
attributes: (list
|
|
||||||
(list "HREF" (href-to target)))
|
|
||||||
($bold-seq$
|
|
||||||
(process-children)))))))
|
|
||||||
|
|
||||||
|
|
||||||
(element constant
|
|
||||||
(let* ((constant-name (data (current-node)))
|
|
||||||
(linkend
|
|
||||||
(string-append "constant."
|
|
||||||
(case-fold-down
|
|
||||||
(string-replace constant-name "_" "-"))))
|
|
||||||
(target (element-with-id linkend))
|
|
||||||
(parent-gi (gi (parent))))
|
|
||||||
(cond
|
|
||||||
; ;; constant names should be plain in FUNCDEF
|
|
||||||
; ((equal? parent-gi "funcdef")
|
|
||||||
; (process-children))
|
|
||||||
|
|
||||||
;; if a valid ID for the target constant is not found, or if the
|
|
||||||
;; CONSTANT tag is within the definition of the same constant,
|
|
||||||
;; make it bold, add (), but don't make a link
|
|
||||||
((or (node-list-empty? target)
|
|
||||||
(equal? (case-fold-down
|
|
||||||
(data (node-list-first
|
|
||||||
(select-elements
|
|
||||||
(node-list-first
|
|
||||||
(children
|
|
||||||
(select-elements
|
|
||||||
(children
|
|
||||||
(ancestor-member (parent) (list "refentry")))
|
|
||||||
"refnamediv")))
|
|
||||||
"refname"))))
|
|
||||||
constant-name))
|
|
||||||
($bold-mono-seq$
|
|
||||||
(process-children)))
|
|
||||||
|
|
||||||
;; else make a link to the function and add ()
|
|
||||||
(else
|
|
||||||
(make element gi: "A"
|
|
||||||
attributes: (list
|
|
||||||
(list "HREF" (href-to target)))
|
|
||||||
($bold-mono-seq$
|
|
||||||
(process-children)))))))
|
|
||||||
|
|
||||||
|
|
||||||
(element example
|
|
||||||
(make sequence
|
|
||||||
(make element gi: "TABLE"
|
|
||||||
attributes: (list
|
|
||||||
(list "WIDTH" "100%")
|
|
||||||
(list "BORDER" "0")
|
|
||||||
(list "CELLPADDING" "0")
|
|
||||||
(list "CELLSPACING" "0")
|
|
||||||
(list "CLASS" "EXAMPLE"))
|
|
||||||
(make element gi: "TR"
|
|
||||||
(make element gi: "TD"
|
|
||||||
($formal-object$))))))
|
|
||||||
|
|
||||||
|
|
||||||
(element (paramdef parameter)
|
|
||||||
(make sequence
|
|
||||||
font-posture: 'italic
|
|
||||||
(process-children-trim)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(mode book-titlepage-recto-mode
|
|
||||||
(element authorgroup
|
|
||||||
(process-children))
|
|
||||||
|
|
||||||
(element author
|
|
||||||
(let ((author-name (author-string))
|
|
||||||
(author-affil (select-elements (children (current-node))
|
|
||||||
(normalize "affiliation"))))
|
|
||||||
(make sequence
|
|
||||||
(make element gi: "DIV"
|
|
||||||
attributes: (list (list "CLASS" (gi)))
|
|
||||||
(literal author-name))
|
|
||||||
(process-node-list author-affil))))
|
|
||||||
)
|
|
||||||
|
|
||||||
(define (chunk-element-list)
|
|
||||||
(list (normalize "preface")
|
|
||||||
(normalize "chapter")
|
|
||||||
(normalize "appendix")
|
|
||||||
(normalize "article")
|
|
||||||
(normalize "glossary")
|
|
||||||
(normalize "bibliography")
|
|
||||||
(normalize "index")
|
|
||||||
(normalize "colophon")
|
|
||||||
(normalize "setindex")
|
|
||||||
(normalize "reference")
|
|
||||||
(normalize "refentry")
|
|
||||||
(normalize "part")
|
|
||||||
(normalize "sect1")
|
|
||||||
(normalize "sect2")
|
|
||||||
(normalize "section")
|
|
||||||
(normalize "book") ;; just in case nothing else matches...
|
|
||||||
(normalize "set") ;; sets are definitely chunks...
|
|
||||||
))
|
|
||||||
|
|
||||||
(define ($section-body$)
|
|
||||||
(make element gi: "DIV"
|
|
||||||
attributes: (list (list "CLASS" (gi)))
|
|
||||||
($section-separator$)
|
|
||||||
($section-title$)
|
|
||||||
|
|
||||||
(if (or (not (node-list-empty? (select-elements (children (current-node))
|
|
||||||
(normalize "sect2"))))
|
|
||||||
(not (node-list-empty? (select-elements (children (current-node))
|
|
||||||
(normalize "sect3")))))
|
|
||||||
(build-toc (current-node) 1)
|
|
||||||
(empty-sosofo))
|
|
||||||
|
|
||||||
(process-children)))
|
|
||||||
|
|
6
docs/pt_BR/language-defs.ent
Normal file
6
docs/pt_BR/language-defs.ent
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<!-- $Revision$ -->
|
||||||
|
|
||||||
|
<!ENTITY SMARTYManual "Smarty - a ferramenta para compilar templates para PHP">
|
||||||
|
<!ENTITY SMARTYDesigners "Smarty para Designers de Template">
|
||||||
|
<!ENTITY SMARTYProgrammers "Smarty para Programadores">
|
||||||
|
<!ENTITY Appendixes "Ap<41>ndices">
|
45
docs/pt_BR/manual.xml
Normal file
45
docs/pt_BR/manual.xml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
|
||||||
|
<!ENTITY preface SYSTEM "preface.sgml">
|
||||||
|
<!ENTITY getting.started SYSTEM "getting-started.sgml">
|
||||||
|
<!ENTITY smarty.for.designers SYSTEM "designers.sgml">
|
||||||
|
<!ENTITY smarty.for.programmers SYSTEM "programmers.sgml">
|
||||||
|
<!ENTITY appendixes SYSTEM "appendixes.sgml">
|
||||||
|
]>
|
||||||
|
|
||||||
|
<book id="index">
|
||||||
|
<bookinfo id="bookinfo">
|
||||||
|
<title>Smarty - a ferramenta para compilar templates para PHP</title>
|
||||||
|
<authorgroup id="authors">
|
||||||
|
<author>
|
||||||
|
<firstname>Monte</firstname><surname>Ohrt <monte@ispi.net></surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Andrei</firstname><surname>Zmievski <andrei@php.net></surname>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
<authorgroup id="translators">
|
||||||
|
<author>
|
||||||
|
<firstname>Fernando</firstname><surname>Correa da Concei<65><69>o <fernandoc@php.net></surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Marcelo</firstname><surname>Perreira Fonseca da Silva <marcelo@php.net></surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Taniel</firstname><surname>Franklin <taniel@ig.com.br></surname>
|
||||||
|
</author>
|
||||||
|
<edition>Vers<EFBFBD>o 2.0</edition>
|
||||||
|
<copyright>
|
||||||
|
<year>2001</year>
|
||||||
|
<year>2002</year>
|
||||||
|
<year>2003</year>
|
||||||
|
<holder>ispi of Lincoln, Inc.</holder>
|
||||||
|
</copyright>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
&preface;
|
||||||
|
&getting.started;
|
||||||
|
&smarty.for.designers;
|
||||||
|
&smarty.for.programmers;
|
||||||
|
&appendixes;
|
||||||
|
|
||||||
|
</book>
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user