mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
added italian docs. thanks to Gianluca Gillini
This commit is contained in:
30
docs/it/appendixes/bugs.xml
Normal file
30
docs/it/appendixes/bugs.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="bugs">
|
||||
<title>BUGS</title>
|
||||
<para>
|
||||
Verificate il file <filename>BUGS</filename> compreso nella
|
||||
distribuzione pi<70> recente di Smarty, oppure controllate
|
||||
direttamente sul sito web.
|
||||
</para>
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
32
docs/it/appendixes/resources.xml
Normal file
32
docs/it/appendixes/resources.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="resources">
|
||||
<title>Risorse</title>
|
||||
<para>
|
||||
La homepage di Smarty <20> <ulink
|
||||
url="&url.smarty;">&url.smarty;</ulink>.
|
||||
Potete sottoscrivere la mailing list inviando una e-mail
|
||||
a &ml.general.sub;. L'archivio della mailing list <20>
|
||||
disponibile a <ulink url="&url.ml.archive;">&url.ml.archive;</ulink>.
|
||||
</para>
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
378
docs/it/appendixes/tips.xml
Normal file
378
docs/it/appendixes/tips.xml
Normal file
@@ -0,0 +1,378 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="tips">
|
||||
<title>Tips & Tricks (trucchi e consigli)</title>
|
||||
<para>
|
||||
</para>
|
||||
<sect1 id="tips.blank.var.handling">
|
||||
<title>Gestione delle variabili vuote</title>
|
||||
<para>
|
||||
Certe volte potreste voler stampare un valore di default per una
|
||||
variabile vuota invece di stampare niente, ad esempio "&nbsp;"
|
||||
in modo che gli sfondi delle tabelle funzionino regolarmente. Molti
|
||||
userebbero una {if} per gestire questo caso, ma c'<27> un modo pi<70> veloce
|
||||
con Smarty, che <20> l'uso del modificatore <emphasis>default</emphasis>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Stampare &nbsp; quando una variabile <20> vuota</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* il modo lungo *}
|
||||
|
||||
{if $title eq ""}
|
||||
|
||||
{else}
|
||||
{$title}
|
||||
{/if}
|
||||
|
||||
|
||||
{* il modo breve *}
|
||||
|
||||
{$title|default:" "}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="tips.default.var.handling">
|
||||
<title>Gestione dei default delle variabili</title>
|
||||
<para>
|
||||
Se una variabile viene usata pi<70> volte nel template, applicarle ogni
|
||||
volta il modificatore default pu<70> diventare pesante. E' possibile
|
||||
rimediare a ci<63> assegnando alla variabile il suo valore di default
|
||||
con la funzione <link
|
||||
linkend="language.function.assign">assign</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Assegnazione del valore di default a una variabile del template</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* mettete questo da qualche parte in cima al template *}
|
||||
{assign var="title" value=$title|default:"no title"}
|
||||
|
||||
{* se $title era vuota, ora contiene il valore "no title" quando la stampate *}
|
||||
{$title}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<sect1 id="tips.passing.vars">
|
||||
<title>Passare una variabile titolo ad un template di intestazione</title>
|
||||
<para>
|
||||
Quando la maggior parte dei template usa gli stessi intestazione e pi<70> di
|
||||
pagina, <20> abbastanza comune creare dei template a parte per questi ultimi
|
||||
e poi includerli negli altri. Ma cosa succede se l'intestazione ha bisogno
|
||||
di avere un titolo diverso a seconda della pagina in cui ci troviamo?
|
||||
Potete passare il titolo all'intestazione nel momento dell'inclusione.
|
||||
</para>
|
||||
<example>
|
||||
<title>Passare la variabile titolo al template dell'intestazione</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
mainpage.tpl
|
||||
------------
|
||||
|
||||
{include file="header.tpl" title="Main Page"}
|
||||
{* qui va il corpo del template *}
|
||||
{include file="footer.tpl"}
|
||||
|
||||
|
||||
archives.tpl
|
||||
------------
|
||||
|
||||
{config_load file="archive_page.conf"}
|
||||
{include file="header.tpl" title=#archivePageTitle#}
|
||||
{* template body goes here *}
|
||||
{include file="footer.tpl"}
|
||||
|
||||
|
||||
header.tpl
|
||||
----------
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>{$title|default:"BC News"}</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
|
||||
footer.tpl
|
||||
----------
|
||||
</BODY>
|
||||
</HTML>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Quando viene disegnata la pagina principale, il titolo "Main Page" viene
|
||||
passato a header.tpl, e quindi sar<61> usato come titolo. Quando viene
|
||||
disegnata la pagina degli archivi, il titolo sar<61> "Archives". Notate
|
||||
che nell'esempio degli archivi abbiamo usato una variabile del file
|
||||
archives_page.conf invece che una definita nel codice. Notate anche che
|
||||
se la variabile $title non <20> impostata viene stampato "BC News", attraverso
|
||||
il modificatore di variabile <emphasis>default</emphasis>.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="tips.dates">
|
||||
<title>Date</title>
|
||||
<para>
|
||||
Come regola generale, passate sempre le date a Smarty in forma di
|
||||
timestamp. Questo consente ai progettisti di usare <link
|
||||
linkend="language.modifier.date.format">date_format</link> per un
|
||||
pieno controllo sulla formattazione delle date, e rende semplice
|
||||
anche il confronto fra date quando necessario.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
A partire da Smarty 1.4.0, potete passare date a Smarty come
|
||||
timestamp unix, timestamp mysql, o qualsiasi altro formato
|
||||
leggibile da strtotime().
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>uso di date_format</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$startDate|date_format}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Jan 4, 2001
|
||||
]]>
|
||||
</screen>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$startDate|date_format:"%Y/%m/%d"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
2001/01/04
|
||||
]]>
|
||||
</screen>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{if $date1 < $date2}
|
||||
...
|
||||
{/if}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Quando usate {html_select_date} in un template, il programmatore
|
||||
probabilmente vorr<72> convertire l'output del modulo in un formato
|
||||
timestamp. Ecco una funzione che pu<70> aiutarvi in questo.
|
||||
</para>
|
||||
<example>
|
||||
<title>convertire le date provenienti da un modulo in timestamp</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// stabiliamo che gli elementi del modulo si chiamino
|
||||
// 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>
|
||||
I template WAP/WML richiedono header php di tipo Content-Type che deve
|
||||
essere passato insieme al template. Il modo pi<70> semplice per farlo sarebbe
|
||||
scrivere una funzione utente che stampi l'header. Tuttavia, se usate
|
||||
il caching, questo sistema non funziona, per cui lo faremo con il tag
|
||||
insert (ricordate che i tag insert non vanno in cache!). Assicuratevi
|
||||
che nulla sia inviato in output al browser prima del template, altrimenti
|
||||
l'header non potr<74> essere spedito.
|
||||
</para>
|
||||
<example>
|
||||
<title>usare insert per scrivere un header Content-Type WML</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// assicuratevi che apache sia configurato per le estensioni .wml!
|
||||
// mettete questa funzione da qualche parte nell'applicazione, oppure
|
||||
// in Smarty.addons.php
|
||||
function insert_header($params)
|
||||
{
|
||||
// la funzione si aspetta un parametro $content
|
||||
if (empty($params['content'])) {
|
||||
return;
|
||||
}
|
||||
header($params['content']);
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
il template <emphasis>deve</emphasis> iniziare con il tag insert:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{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>
|
||||
Welcome to WAP with Smarty!
|
||||
Press OK to continue...
|
||||
</p>
|
||||
</card>
|
||||
<!-- begin second card -->
|
||||
<card id="two">
|
||||
<p>
|
||||
Pretty easy isn't it?
|
||||
</p>
|
||||
</card>
|
||||
</wml>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<sect1 id="tips.componentized.templates">
|
||||
<title>Template a componenti</title>
|
||||
<para>
|
||||
Tradizionalmente, programmare le applicazioni a template funziona
|
||||
cos<6F>: per prima cosa si accumulano le variabili nell'applicazione
|
||||
PHP (magari con query al database). Poi, si istanzia l'oggetto
|
||||
Smarty, si assegnano le variabili e si visualizza il template.
|
||||
Allora supponiamo di avere, ad esempio, un riquadro che visualizza
|
||||
le quotazioni di Borsa (stock ticker) nel nostro template. In
|
||||
questo caso raccoglieremmo i dati sulle azioni nell'applicazione,
|
||||
poi assegneremmo le variabili al template e le visualizzeremmo. Ma
|
||||
non sarebbe bello poter aggiungere questo stock ticker a qualsiasi
|
||||
applicazione semplicemente includendo il template, senza preoccuparci
|
||||
della parte relativa al caricamento dei dati?
|
||||
</para>
|
||||
<para>
|
||||
E' possibile fare questo scrivendo un plugin personalizzato che
|
||||
recuperi il contenuto e lo assegni ad una variabile del template.
|
||||
</para>
|
||||
<example>
|
||||
<title>template a componenti</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// mettiamo il file "function.load_ticker.php" nella directory dei plugin
|
||||
|
||||
// scriviamo la funzione che carica i dati
|
||||
function fetch_ticker($symbol)
|
||||
{
|
||||
// qui metteremo la logica che carica $ticker_info da qualche parte
|
||||
return $ticker_info;
|
||||
}
|
||||
|
||||
function smarty_function_load_ticker($params, &$smarty)
|
||||
{
|
||||
// chiamiamo la funzione
|
||||
$ticker_info = fetch_ticker($params['symbol']);
|
||||
|
||||
// assegnamo la variabile del template
|
||||
$smarty->assign($params['assign'], $ticker_info);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
index.tpl
|
||||
---------
|
||||
|
||||
{* in index.tpl *}
|
||||
|
||||
{load_ticker symbol="YHOO" assign="ticker"}
|
||||
|
||||
Stock Name: {$ticker.name} Stock Price: {$ticker.price}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<sect1 id="tips.obfuscating.email">
|
||||
<title>Offuscare gli indirizzi E-mail</title>
|
||||
<para>
|
||||
Vi siete mai chiesti come fanno i vostri indirizzi E-mail a finire su
|
||||
cos<6F> tante mailing list di spam? Uno dei modi che hanno gli spammer
|
||||
per raccogliere indirizzi E-mail <20> dalle pagine web. Per combattere
|
||||
questo problema, potete fare in modo che gli indirizzi E-mail appaiano
|
||||
in maniera criptata da javascript nel sorgente HTML, anche se continueranno
|
||||
ad essere visti e a funzionare correttamente nel browser. E' possibile
|
||||
farlo con il plugin mailto.
|
||||
</para>
|
||||
<example>
|
||||
<title>Esempio di offuscamento di indirizzo E-mail</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* in index.tpl *}
|
||||
|
||||
Send inquiries to
|
||||
{mailto address=$EmailAddress encode="javascript" subject="Hello"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Questo metodo non <20> sicuro al 100%. Uno spammer, concettualmente, potrebbe
|
||||
programmare il suo raccoglitore di e-mail per decodificare questi valori,
|
||||
ma non <20> una cosa semplice.
|
||||
</para>
|
||||
</note>
|
||||
</sect1>
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
77
docs/it/appendixes/troubleshooting.xml
Normal file
77
docs/it/appendixes/troubleshooting.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="troubleshooting">
|
||||
<title>Troubleshooting</title>
|
||||
<para></para>
|
||||
<sect1 id="smarty.php.errors">
|
||||
<title>Errori Smarty/PHP</title>
|
||||
<para>
|
||||
Smarty <20> in grado di trovare molti errori, ad esempio attributi
|
||||
mancanti nei tag, o nomi di variabile non corretti. Quando questo
|
||||
succede, vedrete un errore simile al seguente:
|
||||
</para>
|
||||
<example>
|
||||
<title>Errori Smarty</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
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
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
Smarty vi mostra il nome del template, il numero di riga e l'errore.
|
||||
Dopodich<63>, vi viene mostrato anche il numero reale di riga nella classe
|
||||
Smarty alla quale si <20> verificato l'errore.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Ci sono alcuni errori che Smarty non riesce a trovare, ad esempio tag
|
||||
di chiusura mancanti. Questi tipi di errore di solito portano ad errori
|
||||
di parsing PHP al momento della compilazione.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Errori di parsing PHP</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Quando vi trovate davanti un errore di parsing PHP, il numero di riga
|
||||
indicato corrisponder<65> allo script PHP compilato, non al template sorgente.
|
||||
Normalmente dando un'occhiata al template si riesce a capire dov'<27>
|
||||
l'errore di sintassi. Ecco alcuni errori comuni da controllare: mancanza
|
||||
del tag di chiusura per blocchi {if}{/if} o {section}{/section}, oppure
|
||||
problemi di sintassi all'interno di un tag {if}. Se non riuscite a trovare
|
||||
l'errore, andata nel file compilato PHP e trovate il numero di riga indicato
|
||||
per capire dove si trova l'errore corrispondente nel template.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
41
docs/it/bookinfo.xml
Normal file
41
docs/it/bookinfo.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<bookinfo id="bookinfo">
|
||||
<title>Smarty - il motore di template PHP con compilatore</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
|
||||
-->
|
60
docs/it/designers/chapter-debugging-console.xml
Normal file
60
docs/it/designers/chapter-debugging-console.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="chapter.debugging.console">
|
||||
<title>Console di Debugging</title>
|
||||
<para>
|
||||
C'<27> una console di debugging inclusa in Smarty. La console vi informa di
|
||||
tutti i template che sono stati inclusi, le variabili assegnate e quelle
|
||||
dei file di configurazione per la chiamata attuale del template. Nella
|
||||
distribuzione di Smarty <20> incluso un template chiamato "debug.tpl" che
|
||||
controlla la formattazione della console. Impostate $debugging a true in
|
||||
Smarty, e se necessario impostate $debug_tpl con il percorso del file
|
||||
debug.tpl (di default si trova nella SMARTY_DIR). Quando caricate la pagina,
|
||||
dovrebbe apparire in pop up una console creata con javascript che vi informa di
|
||||
tutti i nomi dei template inclusi e delle variabili assegnate nella pagina
|
||||
attuale. Per vedere le variabili disponibili per un particolare template,
|
||||
consultate la funzione <link linkend="language.function.debug">{debug}</link>.
|
||||
Per disabilitare la console di debugging impostate $debugging a false.
|
||||
Potete anche attivare temporaneamente la console mettendo SMARTY_DEBUG
|
||||
nell'URL, se abilitate questa opzione con <link
|
||||
linkend="variable.debugging.ctrl">$debugging_ctrl</link>.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
La console di debugging non funziona quando usate la API fetch(), funziona
|
||||
solo con display(). E' un insieme di istruzioni javascript aggiunte in
|
||||
fondo al template generato. Se non vi piace l'uso di javascript, potete
|
||||
modificare il template debug.tpl per formattare l'output come preferite.
|
||||
I dati di debug non vengono messi in cache e i dati relativi a debug.tpl non
|
||||
sono inclusi nell'output della console di debug.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
I tempi di caricamento di ogni template e file di configurazione sono in
|
||||
secondi o frazioni di secondo.
|
||||
</para>
|
||||
</note>
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
96
docs/it/designers/config-files.xml
Normal file
96
docs/it/designers/config-files.xml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="config.files">
|
||||
<title>File di configurazione</title>
|
||||
<para>
|
||||
I file di configurazione sono utili ai progettisti per gestire le
|
||||
variabili globali del template in un unico file. Un esempio <20> quello
|
||||
dei colori. Normalmente, se volete cambiare lo schema dei colori di
|
||||
un'applicazione, dovreste andare in ogni template a cambiare i colori.
|
||||
Con un file di configurazione, i colori possono essere tenuti in un
|
||||
unico punto, e solo un file deve essere modificato.
|
||||
</para>
|
||||
<example>
|
||||
<title>Esempio di sintassi di file di configurazione</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
# variabili globali
|
||||
pageTitle = "Main Menu"
|
||||
bodyBgColor = #000000
|
||||
tableBgColor = #000000
|
||||
rowBgColor = #00ff00
|
||||
|
||||
[Customer]
|
||||
pageTitle = "Customer Info"
|
||||
|
||||
[Login]
|
||||
pageTitle = "Login"
|
||||
focus = "username"
|
||||
Intro = """Questo <20> un valore che occupa pi<70>
|
||||
di una riga. Dovete racchiuderlo
|
||||
fra triple virgolette."""
|
||||
|
||||
# sezione nascosta
|
||||
[.Database]
|
||||
host=my.example.com
|
||||
db=ADDRESSBOOK
|
||||
user=php-user
|
||||
pass=foobar
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
I valori delle variabili dei file di configurazione possono essere
|
||||
fra virgolette, ma non <20> necessario. Potete usare sia gli apici singoli
|
||||
('), sia le virgolette doppie ("). Se avete un valore che occupa pi<70>
|
||||
di una riga, racchiudete l'intero valore fra triple virgolette (""").
|
||||
Potete mettere commenti usando qualsiasi sintassi che non sia valida
|
||||
per il file di configurazione. Noi consigliamo l'uso di un cancelletto
|
||||
(<literal>#</literal>) all'inizio della riga.
|
||||
</para>
|
||||
<para>
|
||||
Questo esempio di file di configurazione ha due sezioni. I nomi di sezione
|
||||
sono racchiusi fra parentesi quadre []. I nomi di sezioni possono essere
|
||||
stringhe dal contenuto arbitrario, purch<63> non comprenda <literal>[</literal>
|
||||
o <literal>]</literal>. Le quattro variabili in alto sono variabili globali,
|
||||
non contenute in alcuna sezione. Queste variabili vengono sempre caricate
|
||||
dal file di configurazione. Se viene caricata una particolare sezione,
|
||||
allora saranno caricate le variabili globali e quelle di quella sezione.
|
||||
Se una variabile esiste sia come globale che in una sezione, verr<72> usata
|
||||
la variabile di sezione. Se date lo stesso nome a due variabili nella stessa
|
||||
sezione verr<72> usato l'ultimo valore.
|
||||
</para>
|
||||
<para>
|
||||
I file di configurazione vengono caricati nel template con la funzione
|
||||
<command>config_load</command>.
|
||||
</para>
|
||||
<para>
|
||||
Potete nascondere variabili o intere sezioni anteponendo un punto al nome
|
||||
della variabile o della sezione. Questo <20> utile se la vostra applicazione
|
||||
legge dai file di configurazione dati sensibili di cui il motore di
|
||||
template non ha bisogno. Se affidate a terzi la modifica del template,
|
||||
potete stare sicuri che non potranno leggere dati sensibili dal file di
|
||||
configurazione caricandolo nel template.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
45
docs/it/designers/language-basic-syntax.xml
Normal file
45
docs/it/designers/language-basic-syntax.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.basic.syntax">
|
||||
<title>Sintassi di base</title>
|
||||
<para>
|
||||
Tutti i tag dei template di Smarty sono racchiusi fra delimitatori.
|
||||
Per default i delimitatori sono <literal>{</literal> e
|
||||
<literal>}</literal>, ma possono essere cambiati.
|
||||
</para>
|
||||
<para>
|
||||
Per questi esempi supporremo di usare i delimitatori di default.
|
||||
In Smarty, tutto il contenuto al di fuori dei delimitatori viene
|
||||
mostrato come contenuto statico, senza modifiche. Quando Smarty
|
||||
incontra i tag dei template, cerca di interpretarli, e visualizza
|
||||
al loro posto l'output relativo.
|
||||
</para>
|
||||
|
||||
&designers.language-basic-syntax.language-syntax-comments;
|
||||
&designers.language-basic-syntax.language-syntax-functions;
|
||||
&designers.language-basic-syntax.language-syntax-attributes;
|
||||
&designers.language-basic-syntax.language-syntax-quotes;
|
||||
&designers.language-basic-syntax.language-math;
|
||||
&designers.language-basic-syntax.language-escaping;
|
||||
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.escaping">
|
||||
<title>Evitare il parsing di Smarty</title>
|
||||
<para>
|
||||
A volte <20> desiderabile o necessario che Smarty ignori sezioni che altrimenti
|
||||
verrebbero analizzate. Un esempio tipico <20> l'incorporazione di codice Javascript
|
||||
o CSS in un template. Il problema nasce dal fatto che questi linguaggi utilizzano
|
||||
i caratteri { e } che per Smarty sono i delimitatori di default.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
La cosa pi<70> semplice sarebbe evitare queste situazioni tenendo il codice Javascript
|
||||
e CSS separato in appositi file e usando i collegamenti standard dell'HTML per
|
||||
recuperarli.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
E' possibile includere contenuto letterale usando blocchi di questo tipo:
|
||||
<link linkend="language.function.literal">{literal} .. {/literal}</link>.
|
||||
Potete anche usare, in modo simile alle entit<69> HTML, <link
|
||||
linkend="language.function.ldelim">{ldelim}</link>,<link
|
||||
linkend="language.function.ldelim">{rdelim}</link> oppure <link
|
||||
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>,<link
|
||||
linkend="language.variables.smarty.rdelim">{$smarty.rdelim}</link>
|
||||
per visualizzare i delimitatori senza che Smarty ne analizzi il contenuto.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Spesso risulta semplicemente conveniente cambiare il <link
|
||||
linkend="variable.left.delimiter">$left_delimiter</link> ed il
|
||||
<link linkend="variable.right.delimiter">$right_delimiter</link> di Smarty.
|
||||
</para>
|
||||
<example>
|
||||
<title>esempio di cambio dei delimitatori</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->left_delimiter = '<!--{';
|
||||
$smarty->right_delimiter = '}-->';
|
||||
$smarty->assign('foo', 'bar');
|
||||
$smarty->display('example.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove example.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<script language="javascript">
|
||||
var foo = <!--{$foo}-->;
|
||||
function dosomething() {
|
||||
alert("foo is " + foo);
|
||||
}
|
||||
dosomething();
|
||||
</script>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
48
docs/it/designers/language-basic-syntax/language-math.xml
Normal file
48
docs/it/designers/language-basic-syntax/language-math.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.math">
|
||||
<title>Funzioni aritmetiche</title>
|
||||
<para>
|
||||
Le funzioni aritmetiche possono essere applicate direttamente ai valori delle variabili.
|
||||
</para>
|
||||
<example>
|
||||
<title>esempi di funzioni aritmetiche</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$foo+1}
|
||||
|
||||
{$foo*$bar}
|
||||
|
||||
{* alcuni esempi pi<70> complessi *}
|
||||
|
||||
{$foo->bar-$bar[1]*$baz->foo->bar()-3*7}
|
||||
|
||||
{if ($foo+$bar.test%$baz*134232+10+$b+10)}
|
||||
|
||||
{$foo|truncate:"`$fooTruncCount/$barTruncFactor-1`"}
|
||||
|
||||
{assign var="foo" value="`$foo+$bar`"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.syntax.attributes">
|
||||
<title>Attributi</title>
|
||||
<para>
|
||||
La maggior parte delle funzioni accetta attributi che specificano
|
||||
o modificano il loro comportamento. Gli attributi delle funzioni
|
||||
Smarty assomigliano agli attributi HTML. I valori statici non hanno
|
||||
bisogno di essere racchiusi fra virgolette, ma <20> raccomandato farlo
|
||||
per le stringhe. Possono essere usate anche variabili, che non devno
|
||||
essere fra virgolette.
|
||||
</para>
|
||||
<para>
|
||||
Alcuni attributi richiedono valori booleani (vero o falso). Per
|
||||
specificarli si possono usare i seguenti valori, senza virgolette:
|
||||
<literal>true</literal>, <literal>on</literal>, e <literal>yes</literal>,
|
||||
oppure <literal>false</literal>, <literal>off</literal>, e
|
||||
<literal>no</literal>.
|
||||
</para>
|
||||
<example>
|
||||
<title>sintassi per gli attributi delle funzioni</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{include file="header.tpl"}
|
||||
|
||||
{include file=$includeFile}
|
||||
|
||||
{include file=#includeFile#}
|
||||
|
||||
{html_select_date display_days=yes}
|
||||
|
||||
<select name="company">
|
||||
{html_options values=$vals selected=$selected output=$output}
|
||||
</select>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.syntax.comments">
|
||||
<title>Commenti</title>
|
||||
<para>
|
||||
I commenti nei template sono preceduti e seguiti da asterischi, i quali
|
||||
sono a loro volta compresi dai tag delimitatori: {* questo <20> un commento *}
|
||||
I commenti di Smarty non vengono visualizzati nell'output del template.
|
||||
Sono usati per note interne al template.
|
||||
</para>
|
||||
<example>
|
||||
<title>Commenti</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* Smarty *}
|
||||
|
||||
{* includiamo il file dell'header *}
|
||||
{include file="header.tpl"}
|
||||
|
||||
{include file=$includeFile}
|
||||
|
||||
{include file=#includeFile#}
|
||||
|
||||
{* visualizziamo una casella a discesa *}
|
||||
<select name="company">
|
||||
{html_options values=$vals selected=$selected output=$output}
|
||||
</select>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.syntax.functions">
|
||||
<title>Funzioni</title>
|
||||
<para>
|
||||
Ogni tag di Smarty pu<70> stampare una <link linkend="language.variables">variable</link>
|
||||
o chiamare una qualche funzione. Le funzioni vengono richiamate richiudendo
|
||||
la funzione e i suoi attributi fra i delimitatori, cos<6F>: {nomefunzione
|
||||
attr1="val" attr2="val"}.
|
||||
</para>
|
||||
<example>
|
||||
<title>sintassi delle funzioni</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="colors.conf"}
|
||||
|
||||
{include file="header.tpl"}
|
||||
|
||||
{if $highlight_name}
|
||||
Welcome, <font color="{#fontColor#}">{$name}!</font>
|
||||
{else}
|
||||
Welcome, {$name}!
|
||||
{/if}
|
||||
|
||||
{include file="footer.tpl"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Sia le funzioni incorporate che le funzioni utente hanno la stessa
|
||||
sintassi nel template. Le funzioni incorporate sono il cuore pulsante
|
||||
di Smarty, ad esempio <command>if</command>, <command>section</command> e
|
||||
<command>strip</command>. Non possono essere modificate. Le funzioni
|
||||
utente sono funzioni addizionali sviluppate attraverso i plugin. Potete
|
||||
modificarle a piacere, e potete crearne di nuove. <command>html_options</command>
|
||||
e <command>html_select_date</command> sono esempi di funzioni utente.
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.syntax.quotes">
|
||||
<title>Incorporare variabili fra virgolette</title>
|
||||
<para>
|
||||
Smarty riconosce le variabili incorporate nelle stringhe fra virgolette (")
|
||||
se contengono solo numeri, lettere, underscore (_) e parentesi quadre ([]).
|
||||
Se sono presenti altri caratteri (punti, riferimento a oggetti, ecc.) la
|
||||
variabile deve essere posta tra backticks (`). I backticks si possono ottenere
|
||||
digitando ALT+96 (sul tastierino numerico).
|
||||
</para>
|
||||
<example>
|
||||
<title>embedded quotes syntax</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
ESEMPI DI SINTASSI:
|
||||
{func var="test $foo test"} <-- riconosce $foo
|
||||
{func var="test $foo_bar test"} <-- riconosce $foo_bar
|
||||
{func var="test $foo[0] test"} <-- riconosce $foo[0]
|
||||
{func var="test $foo[bar] test"} <-- riconosce $foo[bar]
|
||||
{func var="test $foo.bar test"} <-- riconosce $foo (non $foo.bar)
|
||||
{func var="test `$foo.bar` test"} <-- riconosce $foo.bar
|
||||
|
||||
ESEMPI PRATICI:
|
||||
{include file="subdir/$tpl_name.tpl"} <-- sostituisce $tpl_name col valore relativo
|
||||
{cycle values="one,two,`$smarty.config.myval`"} <-- necessita di backticks
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
45
docs/it/designers/language-builtin-functions.xml
Normal file
45
docs/it/designers/language-builtin-functions.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.builtin.functions">
|
||||
<title>Funzioni incorporate</title>
|
||||
<para>
|
||||
Smarty <20> dotato di numerose funzioni incorporate. Queste funzioni
|
||||
sono integrate nel linguaggio del template: non <20> possibile creare funzioni
|
||||
utente con gli stessi nomi, e nemmeno modificare le funzioni
|
||||
incorporate.
|
||||
</para>
|
||||
|
||||
&designers.language-builtin-functions.language-function-capture;
|
||||
&designers.language-builtin-functions.language-function-config-load;
|
||||
&designers.language-builtin-functions.language-function-foreach;
|
||||
&designers.language-builtin-functions.language-function-include;
|
||||
&designers.language-builtin-functions.language-function-include-php;
|
||||
&designers.language-builtin-functions.language-function-insert;
|
||||
&designers.language-builtin-functions.language-function-if;
|
||||
&designers.language-builtin-functions.language-function-ldelim;
|
||||
&designers.language-builtin-functions.language-function-literal;
|
||||
&designers.language-builtin-functions.language-function-php;
|
||||
&designers.language-builtin-functions.language-function-section;
|
||||
&designers.language-builtin-functions.language-function-strip;
|
||||
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.capture">
|
||||
<title>capture</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>default</emphasis></entry>
|
||||
<entry>Nome del blocco catturato</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile cui assegnare l'output catturato</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
capture si usa per intercettare l'output del template assegnandolo
|
||||
ad una variabile invece di visualizzarlo. Qualsiasi contenuto compreso
|
||||
fra {capture name="foo"} e {/capture} viene aggiunto alla variabile
|
||||
specificata nell'attributo name. Il contenuto catturato pu<70> essere
|
||||
usato nel template utilizzando la variabile speciale $smarty.capture.foo
|
||||
dove foo <20> il nome passato nell'attributo name. Se non fornite un
|
||||
attributo name, verr<72> usato "default". Tutti i comandi {capture}
|
||||
devono essere chiusi con {/capture}. E' possibile nidificarli.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Le versioni da 1.4.0 a 1.4.4 di Smarty mettevano il contenuto catturato
|
||||
nella variabile $return. A partire dalla 1.4.5 si utilizza l'attributo
|
||||
name, quindi modificate i vostri template di conseguenza.
|
||||
</para>
|
||||
</note>
|
||||
<caution>
|
||||
<para>
|
||||
Fate attenzione se catturate l'output di <command>insert</command>.
|
||||
Se avete il caching attivato e usate comandi <command>insert</command>
|
||||
che vi aspettate vengano eseguiti nel contenuto in cache, non
|
||||
catturate questo contenuto.
|
||||
</para>
|
||||
</caution>
|
||||
<para>
|
||||
<example>
|
||||
<title>catturare il contenuto del template</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* vogliamo stampare la riga di tabella solo se c'<27> del contenuto *}
|
||||
{capture name=banner}
|
||||
{include file="get_banner.tpl"}
|
||||
{/capture}
|
||||
{if $smarty.capture.banner ne ""}
|
||||
<tr>
|
||||
<td>
|
||||
{$smarty.capture.banner}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.config.load">
|
||||
<title>config_load</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome del file di configurazione da importare</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>section</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della sezione da caricare</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>scope</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>local</emphasis></entry>
|
||||
<entry>
|
||||
Campo di applicazione delle variabili caricate,
|
||||
che pu<70> essere local, parent o global. local significa
|
||||
che le variabili vengono caricate nel contesto del
|
||||
template locale. parent significa che le variabili
|
||||
vengono caricate sia nel contesto locale che nel template
|
||||
genitore che lo ha chiamato. global significa che le
|
||||
variabili sono disponibili a tutti i template.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>global</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>
|
||||
Se le variabili sono visibili o meno al template
|
||||
genitore: equivale a scope=parent. NOTA: Questo attributo
|
||||
<20> deprecato per via dell'esistenza dell'attributo scope,
|
||||
ma <20> ancora supportato. Se <20> presente scope, questo valore
|
||||
<20> ignorato.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Questa funzione <20> usata per caricare variabili nel template da
|
||||
un file di configurazione.
|
||||
Vedere <link linkend="config.files">Config Files</link> per
|
||||
maggiori informazioni.
|
||||
</para>
|
||||
<example>
|
||||
<title>funzione config_load</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="colors.conf"}
|
||||
|
||||
<html>
|
||||
<title>{#pageTitle#}</title>
|
||||
<body bgcolor="{#bodyBgColor#}">
|
||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
||||
<tr bgcolor="{#rowBgColor#}">
|
||||
<td>First</td>
|
||||
<td>Last</td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
I file di configurazione possono contenere sezioni. Potete caricare
|
||||
variabili da una sezione con l'attributo aggiuntivo
|
||||
<emphasis>section</emphasis>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
<emphasis>Le sezioni dei file di configurazione</emphasis> e la funzione
|
||||
incorporata dei template chiamata <emphasis>section</emphasis> non hanno
|
||||
nulla a che fare fra di loro, hanno soltanto lo stesso nome.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>funzione config_load con section</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="colors.conf" section="Customer"}
|
||||
|
||||
<html>
|
||||
<title>{#pageTitle#}</title>
|
||||
<body bgcolor="{#bodyBgColor#}">
|
||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
||||
<tr bgcolor="{#rowBgColor#}">
|
||||
<td>First</td>
|
||||
<td>Last</td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.foreach">
|
||||
<title>foreach,foreachelse</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>from</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Array sul quale viene eseguito il ciclo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>item</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile che rappresenta
|
||||
l'elemento attuale</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>key</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile che rappresenta la chiave attuale</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome del ciclo foreach per l'accesso alle sue propriet<65></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
I cicli <emphasis>foreach</emphasis> sono un'alternativa ai cicli
|
||||
<emphasis>section</emphasis>. <emphasis>foreach</emphasis> si usa
|
||||
per ciclare su un singolo array associativo. La sintassi di
|
||||
<emphasis>foreach</emphasis> <20> molto pi<70> semplice di
|
||||
<emphasis>session</emphasis>, ma in compenso pu<70> essere usata solo
|
||||
per un array singolo. I tag <emphasis>foreach</emphasis> devono
|
||||
essere chiusi con <emphasis>/foreach</emphasis>. I parametri
|
||||
obbligatori sono <emphasis>from</emphasis> e <emphasis>item</emphasis>.
|
||||
Il nome del ciclo foreach pu<70> essere quello che preferite, composto
|
||||
di lettere, numeri e underscore. I cicli <emphasis>foreach</emphasis>
|
||||
possono essere nidificati, ma i nomi dei cicli nidificati devono
|
||||
essere diversi tra di loro. La variabile <emphasis>from</emphasis>
|
||||
(di solito un array di valori) determina quante volte verr<72> eseguito
|
||||
il ciclo <emphasis>foreach</emphasis>.
|
||||
<emphasis>foreachelse</emphasis> viene eseguito quando non ci sono
|
||||
valori nella variabile <emphasis>from</emphasis>.
|
||||
</para>
|
||||
<example>
|
||||
<title>foreach</title>
|
||||
<programlisting>
|
||||
|
||||
{* questo esempio stamper<65> tutti i valori dell'array $custid *}
|
||||
{foreach from=$custid item=curr_id}
|
||||
id: {$curr_id}<br>
|
||||
{/foreach}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
id: 1000<br>
|
||||
id: 1001<br>
|
||||
id: 1002<br></programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>foreach con key</title>
|
||||
<programlisting>
|
||||
{* key contiene la chiave per ogni valore del ciclo
|
||||
|
||||
l'assegnazione pu<70> essere qualcosa del genere:
|
||||
|
||||
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
||||
|
||||
*}
|
||||
|
||||
{foreach name=outer item=contact from=$contacts}
|
||||
{foreach key=key item=item from=$contact}
|
||||
{$key}: {$item}<br>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
phone: 1<br>
|
||||
fax: 2<br>
|
||||
cell: 3<br>
|
||||
phone: 555-4444<br>
|
||||
fax: 555-3333<br>
|
||||
cell: 760-1234<br></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
I cicli foreach hanno anche le proprie variabili che gestiscono le propriet<65>
|
||||
del foreach. Queste vengono indicate cos<6F>: {$smarty.foreach.foreachname.varname},
|
||||
dove foreachname <20> il nome indicato come attributo <emphasis>name</emphasis>
|
||||
del foreach
|
||||
</para>
|
||||
|
||||
|
||||
<sect2 id="foreach.property.iteration">
|
||||
<title>iteration</title>
|
||||
<para>
|
||||
iteration si usa per mostrare l'iterazione corrente del ciclo.
|
||||
</para>
|
||||
<para>
|
||||
iteration comincia sempre per 1 ed <20> incrementata di uno
|
||||
ad ogni iterazione.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="foreach.property.first">
|
||||
<title>first</title>
|
||||
<para>
|
||||
<emphasis>first</emphasis> vale true quando l'iterazione attuale <20> la prima del ciclo.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="foreach.property.last">
|
||||
<title>last</title>
|
||||
<para>
|
||||
<emphasis>last</emphasis> vale true quando l'iterazione attuale <20> l'ultima del ciclo.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="foreach.property.show">
|
||||
<title>show</title>
|
||||
<para>
|
||||
<emphasis>show</emphasis> si usa come parametro per il foreach.
|
||||
<emphasis>show</emphasis> <20> un valore booleano, true o false. Quando
|
||||
<09> false, il foreach non verr<72> visualizzato. Se <20> presente un
|
||||
foreachelse, verr<72> visualizzato al suo posto.
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
<sect2 id="foreach.property.total">
|
||||
<title>total</title>
|
||||
<para>
|
||||
<emphasis>total</emphasis> si usa per visualizzare il numero di iterazioni che il
|
||||
ciclo foreach effettuer<65>. Pu<50> essere usato all'interno o dopo il foreach.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,219 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.if">
|
||||
<title>if,elseif,else</title>
|
||||
<para>
|
||||
Le istruzioni <emphasis>{if}</emphasis> in Smarty hanno praticamente la
|
||||
stessa flessibilit<69> delle istruzioni if PHP, con qualche caratteristica
|
||||
aggiuntiva per il motore di template.
|
||||
Ogni <emphasis>{if}</emphasis> deve essere chiuso con un
|
||||
<emphasis>{/if}</emphasis>. Sono previsti anche <emphasis>{else}</emphasis>
|
||||
e <emphasis>{elseif}</emphasis>. Sono riconosciuti tutti gli operatori condizionali
|
||||
di PHP, come <emphasis>||</emphasis>, <emphasis>or</emphasis>,
|
||||
<emphasis>&&</emphasis>, <emphasis>and</emphasis>, ecc.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Quella che segue <20> una lista degli operatori riconosciuti, che devono
|
||||
essere separati con degli spazi dagli elementi circostanti. Notate che
|
||||
gli elementi mostrati fra [parentesi quadre] sono opzionali. Quando esistono
|
||||
sono mostrati gli equivalenti in PHP.
|
||||
</para>
|
||||
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="4">
|
||||
<colspec colname="qualifier" align="center" />
|
||||
<colspec colname="alternates" align="center" />
|
||||
<colspec colname="meaning" />
|
||||
<colspec colname="example" />
|
||||
<colspec colname="php" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Operatore</entry>
|
||||
<entry>Alternative</entry>
|
||||
<entry>Esempio di sintassi</entry>
|
||||
<entry>Significato</entry>
|
||||
<entry>Equivalente PHP</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>==</entry>
|
||||
<entry>eq</entry>
|
||||
<entry>$a eq $b</entry>
|
||||
<entry>uguale</entry>
|
||||
<entry>==</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>!=</entry>
|
||||
<entry>ne, neq</entry>
|
||||
<entry>$a neq $b</entry>
|
||||
<entry>diverso</entry>
|
||||
<entry>!=</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>></entry>
|
||||
<entry>gt</entry>
|
||||
<entry>$a gt $b</entry>
|
||||
<entry>maggiore di</entry>
|
||||
<entry>></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><</entry>
|
||||
<entry>lt</entry>
|
||||
<entry>$a lt $b</entry>
|
||||
<entry>minore di</entry>
|
||||
<entry><</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>>=</entry>
|
||||
<entry>gte, ge</entry>
|
||||
<entry>$a ge $b</entry>
|
||||
<entry>maggiore o uguale</entry>
|
||||
<entry>>=</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><=</entry>
|
||||
<entry>lte, le</entry>
|
||||
<entry>$a le $b</entry>
|
||||
<entry>minore o uguale</entry>
|
||||
<entry><=</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>!</entry>
|
||||
<entry>not</entry>
|
||||
<entry>not $a</entry>
|
||||
<entry>negazione (unario)</entry>
|
||||
<entry>!</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>%</entry>
|
||||
<entry>mod</entry>
|
||||
<entry>$a mod $b</entry>
|
||||
<entry>modulo (resto della divisione)</entry>
|
||||
<entry>%</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>is [not] div by</entry>
|
||||
<entry></entry>
|
||||
<entry>$a is not div by 4</entry>
|
||||
<entry>divisibile per</entry>
|
||||
<entry>$a % $b == 0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>is [not] even</entry>
|
||||
<entry></entry>
|
||||
<entry>$a is not even</entry>
|
||||
<entry>[non] <20> un numero pari (unario)</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>livello di raggruppamento [non] pari</entry>
|
||||
<entry>($a / $b) % 2 == 0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>is [not] odd</entry>
|
||||
<entry></entry>
|
||||
<entry>$a is not odd</entry>
|
||||
<entry>[non] <20> un numero dispari (unario)</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>livello di raggruppamento [non] dispari</entry>
|
||||
<entry>($a / $b) % 2 != 0</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<example>
|
||||
<title>Istruzioni if</title>
|
||||
<programlisting>
|
||||
{if $name eq "Fred"}
|
||||
Welcome Sir.
|
||||
{elseif $name eq "Wilma"}
|
||||
Welcome Ma'am.
|
||||
{else}
|
||||
Welcome, whatever you are.
|
||||
{/if}
|
||||
|
||||
{* un esempio con "or" logico *}
|
||||
{if $name eq "Fred" or $name eq "Wilma"}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* come sopra *}
|
||||
{if $name == "Fred" || $name == "Wilma"}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* questa sintassi NON funziona, gli operatori condizionali
|
||||
devono essere separati con spazi dagli elementi circostanti *}
|
||||
{if $name=="Fred" || $name=="Wilma"}
|
||||
...
|
||||
{/if}
|
||||
|
||||
|
||||
{* si possono usare le parentesi *}
|
||||
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* potete anche incorporare chiamate a funzioni php *}
|
||||
{if count($var) gt 0}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* test su valori pari o dispari *}
|
||||
{if $var is even}
|
||||
...
|
||||
{/if}
|
||||
{if $var is odd}
|
||||
...
|
||||
{/if}
|
||||
{if $var is not odd}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* test se var <20> divisibile per 4 *}
|
||||
{if $var is div by 4}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* test se var <20> pari, raggruppato per due. Ad es.:
|
||||
0=pari, 1=pari, 2=dispari, 3=dispari, 4=pari, 5=pari, etc. *}
|
||||
{if $var is even by 2}
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* 0=pari, 1=pari, 2=pari, 3=dispari, 4=dispari, 5=dispari, etc. *}
|
||||
{if $var is even by 3}
|
||||
...
|
||||
{/if}</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.include.php">
|
||||
<title>include_php</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome del file php da includere</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>once</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>Se includere o no il file php pi<70> di una volta nel
|
||||
caso venga richiesto pi<70> volte</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile cui sar<61> assegnato l'output
|
||||
di include_php</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<note>
|
||||
<title>Nota Tecnica</title>
|
||||
<para>
|
||||
include_php <20> deprecato da Smarty, in quanto potete ottenere la
|
||||
stessa funzionalit<69> attraverso una funzione utente.
|
||||
L'unica ragione per usare include_php <20> se avete una reale
|
||||
necessit<69> di tenere fuori la funzione php dalla directory dei plugin
|
||||
o dal vostro codice applicativo. Vedere l'<link
|
||||
linkend="tips.componentized.templates">esempio di template a
|
||||
componenti</link> per i dettagli.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
i tag include_php sono usati per includere uno script php nel
|
||||
template. Se la security <20> abilitata, lo script php si deve
|
||||
trovare nel percorso di $trusted_dir. Il tag include_php deve
|
||||
avere l'attributo "file", che contiene il percorso al file da
|
||||
includere, che pu<70> essere assoluto relativo alla directory $trusted_dir.
|
||||
</para>
|
||||
<para>
|
||||
include_php <20> un ottimo modo per gestire template a componenti, e
|
||||
tiene il codice PHP separato dai file dei template. Diciamo che abbiamo
|
||||
un template che mostra la navigazione del nostro sito, che viene
|
||||
prelevata dinamicamente da un database. Possiamo tenere la logica PHP
|
||||
che ottiene il contenuto del database in una directory separata, ed
|
||||
includerla in cima al template. Ora possiamo includere questo
|
||||
template ovunque senza preoccuparci che l'applicazione abbia
|
||||
preventivamente caricato i dati del database.
|
||||
</para>
|
||||
<para>
|
||||
Per default, i file php sono inclusi una sola volta, anche se richiesti
|
||||
pi<70> volte nel template. Potete specificare che devono essere inclusi
|
||||
ogni volta con l'attributo <emphasis>once</emphasis>. Se impostate
|
||||
once a false, lo script verr<72> incluso tutte le volte che viene
|
||||
richiesto nel template.
|
||||
</para>
|
||||
<para>
|
||||
Opzionalmente potete passare l'attributo <emphasis>assign</emphasis>,
|
||||
che specifica un nome di variabile cui sar<61> assegnato l'output di
|
||||
<emphasis>include_php</emphasis>, invece di essere visualizzato.
|
||||
</para>
|
||||
<para>
|
||||
L'oggetto smarty <20> disponibile come $this all'interno dello script
|
||||
PHP che viene incluso.
|
||||
</para>
|
||||
<example>
|
||||
<title>funzione include_php</title>
|
||||
<programlisting>
|
||||
load_nav.php
|
||||
-------------
|
||||
|
||||
<?php
|
||||
|
||||
// carichiamo le variabili da un db mysql e le assegnamo al template
|
||||
require_once("MySQL.class.php");
|
||||
$sql = new MySQL;
|
||||
$sql->query("select * from site_nav_sections order by name",SQL_ALL);
|
||||
$this->assign('sections',$sql->record);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
index.tpl
|
||||
---------
|
||||
|
||||
{* percorso assoluto, o relativo a $trusted_dir *}
|
||||
{include_php file="/path/to/load_nav.php"}
|
||||
|
||||
{foreach item="curr_section" from=$sections}
|
||||
<a href="{$curr_section.url}">{$curr_section.name}</a><br>
|
||||
{/foreach}</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.include">
|
||||
<title>include</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome del file di template da includere</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile cui sar<61> assegnato
|
||||
l'output dell'include</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>[variabile ...]</entry>
|
||||
<entry>[tipo variabile]</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Variabile da passare localmente al template</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
I tag include sono usati per includere altri template in quello attuale.
|
||||
Tutte le variabili del template corrente sono disponibili anche nel
|
||||
template incluso. Il tag include deve comprendere l'attributo "file",
|
||||
che contiene il percorso del template da includere.
|
||||
</para>
|
||||
<para>
|
||||
Opzionalmente si pu<70> passare l'attributo <emphasis>assign</emphasis>,
|
||||
che specifica un nome di variabile del template alla quale
|
||||
sar<61> assegnato l'output dell'<emphasis>include</emphasis>, invece
|
||||
di essere visualizzato.
|
||||
</para>
|
||||
<example>
|
||||
<title>funzione include</title>
|
||||
<programlisting>
|
||||
{include file="header.tpl"}
|
||||
|
||||
{* qui va il corpo del template *}
|
||||
|
||||
{include file="footer.tpl"}</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Potete anche passare variabili ai template inclusi sotto forma di
|
||||
attributi. Queste variabili saranno disponibili soltanto nello
|
||||
scope del file incluso. Le variabili attributo prevalgono su quelle
|
||||
del template attuale in caso di omonimia.
|
||||
</para>
|
||||
<example>
|
||||
<title>funzione include con passaggio di variabili</title>
|
||||
<programlisting>
|
||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
||||
|
||||
{* qui va il corpo del template *}
|
||||
|
||||
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Usate la sintassi delle <link
|
||||
linkend="template.resources">risorse dei template</link> per
|
||||
includere file esterni alla directory $template_dir.
|
||||
</para>
|
||||
<example>
|
||||
<title>esempi di funzione include con le risorse dei template</title>
|
||||
<programlisting>
|
||||
{* percorso assoluto *}
|
||||
{include file="/usr/local/include/templates/header.tpl"}
|
||||
|
||||
{* percorso assoluto (come sopra) *}
|
||||
{include file="file:/usr/local/include/templates/header.tpl"}
|
||||
|
||||
{* percorso assoluto su windows (NECESSARIO usare il prefisso "file:") *}
|
||||
{include file="file:C:/www/pub/templates/header.tpl"}
|
||||
|
||||
{* include da una risorsa chiamata "db" *}
|
||||
{include file="db:header.tpl"}</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.insert">
|
||||
<title>insert</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della funzione di insert (insert_name)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile del template cui verr<72>
|
||||
assegnato l'output</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>script</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome dello script php che viene incluso prima
|
||||
della chiamata alla funzione di insert</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>[variabile ...]</entry>
|
||||
<entry>[tipo variabile]</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Variabile da passare alla funzione di insert</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
I tag insert funzionano praticamente come i tag include, ad
|
||||
eccezione del fatto che i tag insert non vengono messi in
|
||||
cache quando avete il <link linkend="caching">caching</link>
|
||||
del template abilitato. Verranno quindi eseguiti ad ogni
|
||||
chiamata del template.
|
||||
</para>
|
||||
<para>
|
||||
Diciamo che abbiamo un template con uno spazio banner in cima
|
||||
alla pagina. Il banner pu<70> contenere qualsiasi mescolanza di HTML,
|
||||
immagini, flash, ecc., quindi non possiamo usare un link statico,
|
||||
e non vogliamo che questo contenuto sia messo in cache con la
|
||||
pagina. Ecco quindi l'utilit<69> del tag insert: il template conosce i
|
||||
valori di #banner_location_id# e #site_id# (presi da un file di
|
||||
configurazione), e ha bisogno di chiamare una funzione per ottenere
|
||||
il contenuto del banner.
|
||||
</para>
|
||||
<example>
|
||||
<title>funzione insert</title>
|
||||
<programlisting>
|
||||
{* esempio di caricamento di un banner *}
|
||||
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
In questo esempio stiamo usando il nome "getBanner" e passiamo i
|
||||
parametri #banner_location_id# e #site_id#. Smarty cercher<65> una
|
||||
funzione chiamata insert_getBanner() nell'applicazione PHP, passandole
|
||||
i valori di #banner_location_id# e #site_id# come primo argomento
|
||||
in un array associativo. Tutti i nomi di funzioni di insert
|
||||
nell'applicazione devono essere prefissati con "insert_", per evitare
|
||||
possibili conflitti nei nomi di funzione. La nostra funzione
|
||||
insert_getBanner() far<61> qualcosa con i valori passati e restituir<69>
|
||||
il risultato, che verr<72> visualizzato nel templat al posto del tag
|
||||
insert.
|
||||
In questo esempio, Smarty chiamerebbe questa funzione:
|
||||
insert_getBanner(array("lid" => "12345","sid" => "67890"));
|
||||
e visualizzerebbe il risultato restituito al posto del tag insert.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite l'attributo "assign", l'output del tag insert verr<72>
|
||||
assegnato a questa variabile invece di essere mostrato nel template.
|
||||
NOTA: assegnare l'output ad una variabile non <20> molto utile se il
|
||||
caching <20> abilitato.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite l'attributo "script", questo script verr<72> incluso (una
|
||||
volta sola) prima dell'esecuzione della funzione di insert. Questo
|
||||
caso pu<70> presentarsi quando la funzione di insert pu<70> non esistere
|
||||
ancora, e uno script php deve essere quindi incluso per farla
|
||||
funzionare. Il percorso pu<70> essere assoluto o relativo a $trusted_dir.
|
||||
Se la security <20> abilitata, lo script deve trovarsi in $trusted_dir.
|
||||
</para>
|
||||
<para>
|
||||
Come secondo argomento viene passato l'oggetto Smarty. In questo
|
||||
modo potete ottenere e modificare informazioni nell'oggetto Smarty
|
||||
dall'interno della funzione di insert.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
E' possibile avere porzioni di template non in cache. Se
|
||||
avete il <link linkend="caching">caching</link> abilitato,
|
||||
i tag insert non verranno messi in cache. Verranno quindi
|
||||
eseguiti dinamicamente ogni volta che la pagina viene creata,
|
||||
anche se questa si trova in cache. Questo viene utile per cose
|
||||
come banner, sondaggi, situazione del tempo, risultati di ricerche,
|
||||
aree di feedback utenti, ecc.
|
||||
</para>
|
||||
</note>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.ldelim">
|
||||
<title>ldelim,rdelim</title>
|
||||
<para>
|
||||
ldelim e rdelim si usano per fare l'escape dei delimitatori del template, nel nostro caso
|
||||
"{" o "}". Potete usare anche <link
|
||||
linkend="language.function.literal">{literal}{/literal}</link> per fare l'escape su
|
||||
blocchi di testo.
|
||||
Vedere anche <link linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>
|
||||
e <link linkend="language.variables.smarty.rdelim">{$smarty.rdelim}</link>
|
||||
</para>
|
||||
<example>
|
||||
<title>ldelim, rdelim</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* questo stamper<65> i delimitatori *}
|
||||
|
||||
{ldelim}funcname{rdelim} is how functions look in Smarty!
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
L'esempio sopra produrr<72>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
{funcname} is how functions look in Smarty!
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.literal">
|
||||
<title>literal</title>
|
||||
<para>
|
||||
I tag literal vi consentono di far s<> che un blocco di dati venga letto
|
||||
"letteralmente". Ci<43> <20> utile tipicamente quando avete un blocco javascript
|
||||
o CSS nel quale le parentesi graffe si confonderebbero con i delimitatori
|
||||
del template. Tutto ci<63> che si trova fra {literal} e {/literal} non viene
|
||||
interpretato, ma visualizzato cos<6F> com'<27>. Se avete bisogno di usare tag
|
||||
del template all'interno del blocco literal, considerate la possibilit<69> di
|
||||
usare invece <link linkend="language.function.ldelim">{ldelim}{rdelim}</link>
|
||||
per fare l'escape dei singoli delimitatori.
|
||||
</para>
|
||||
<example>
|
||||
<title>tag literal</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
|
||||
<!--
|
||||
function isblank(field) {
|
||||
if (field.value == '')
|
||||
{ return false; }
|
||||
else
|
||||
{
|
||||
document.loginform.submit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// -->
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.php">
|
||||
<title>php</title>
|
||||
<para>
|
||||
I tag php vi consentono di incorporare codice php direttamente
|
||||
nel template. Non sar<61> fatto l'escape, indipendentemente
|
||||
dall'impostazione di <link
|
||||
linkend="variable.php.handling">$php_handling</link>.
|
||||
Questa funzione <20> solo per utenti avanzati, normalmente non
|
||||
dovreste averne bisogno.
|
||||
</para>
|
||||
<example>
|
||||
<title>tag php</title>
|
||||
<programlisting>
|
||||
{php}
|
||||
// inclusione di uno script php
|
||||
// direttamente dal template.
|
||||
include("/path/to/display_weather.php");
|
||||
{/php}</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,569 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.section">
|
||||
<title>section,sectionelse</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della sezione</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>loop</entry>
|
||||
<entry>[$variable_name]</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile che determina il numero
|
||||
di iterazioni del ciclo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>start</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>0</emphasis></entry> <entry>L'indice
|
||||
dal quale inizier<65> il ciclo. Se il valore <20> negativo,
|
||||
la posizione di partenza <20> calcolata dalla fine dell'array.
|
||||
Ad esempio, se ci sono sette valori nell'array da ciclare
|
||||
e start <20> -2, l'indice di partenza sar<61> 5. Valori non
|
||||
validi (cio<69> al di fuori della lunghezza dell'array da
|
||||
ciclare) saranno automaticamente convertiti al valore
|
||||
valido pi<70> vicino.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>step</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>1</emphasis></entry>
|
||||
<entry>Il valore di passo da usare per attraversare
|
||||
l'array da ciclare. Ad esempio, step=2 cicler<65> sugli
|
||||
indici 0,2,4, ecc. Se step <20> negativo il ciclo proceder<65>
|
||||
sull'array all'indietro.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>max</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Massimo numero di cicli per la sezione.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>show</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>Stabilisce se mostrare o no la sezione</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Le sezioni sono usate per ciclare su array di dati. Tutti i tag
|
||||
<emphasis>section</emphasis> devono essere chiusi con
|
||||
<emphasis>/section</emphasis>. I parametri obbligatori sono
|
||||
<emphasis>name</emphasis> e <emphasis>loop</emphasis>. Il nome
|
||||
della sezione pu<70> essere quello che preferite, formato da lettere,
|
||||
numeri e underscore. Le sezioni possono essere nidificate, ed i nomi
|
||||
delle sezioni nidificate devono essere diversi fra loro. La variabile
|
||||
loop (di solito un array di valori) determina quante volte sar<61>
|
||||
eseguito il ciclo. Quando stampate una variabile all'interno di una
|
||||
sezione, il nome della sezione deve essere indicato a fianco del
|
||||
nome della variabile fra parentesi quadre [].
|
||||
<emphasis>sectionelse</emphasis> viene eseguito quando non ci sono
|
||||
valori nella variabile loop.
|
||||
</para>
|
||||
<example>
|
||||
<title>section</title>
|
||||
<programlisting>
|
||||
|
||||
{* questo esempio stamper<65> tutti i valori dell'array $custid *}
|
||||
{section name=customer loop=$custid}
|
||||
id: {$custid[customer]}<br>
|
||||
{/section}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
id: 1000<br>
|
||||
id: 1001<br>
|
||||
id: 1002<br></programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>variabile loop</title>
|
||||
<programlisting>
|
||||
{* la variabile loop determina soltanto il numero di cicli da ripetere.
|
||||
Potete accedere a qualsiasi variabile dal template della sezione.
|
||||
In questo esempio presumiamo che $custid, $name e $address siano
|
||||
tutti array contenenti lo stesso numero di valori *}
|
||||
{section name=customer loop=$custid}
|
||||
id: {$custid[customer]}<br>
|
||||
name: {$name[customer]}<br>
|
||||
address: {$address[customer]}<br>
|
||||
<p>
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
id: 1000<br>
|
||||
name: John Smith<br>
|
||||
address: 253 N 45th<br>
|
||||
<p>
|
||||
id: 1001<br>
|
||||
name: Jack Jones<br>
|
||||
address: 417 Mulberry ln<br>
|
||||
<p>
|
||||
id: 1002<br>
|
||||
name: Jane Munson<br>
|
||||
address: 5605 apple st<br>
|
||||
<p></programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>nomi delle sezioni</title>
|
||||
<programlisting>
|
||||
{* come nome della sezione potete usare quello che preferite,
|
||||
e viene usato per riferirsi ai dati all'interno della sezione *}
|
||||
{section name=mydata loop=$custid}
|
||||
id: {$custid[mydata]}<br>
|
||||
name: {$name[mydata]}<br>
|
||||
address: {$address[mydata]}<br>
|
||||
<p>
|
||||
{/section}</programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>sezioni nidificate</title>
|
||||
<programlisting>
|
||||
{* le sezioni possono essere nidificate a qualsiasi profondit<69>. Con
|
||||
le sezioni nidificate potete accedere a strutture di dati complesse,
|
||||
ad esempio array multidimensionali. In questo esempio, $contact_type[customer]
|
||||
<20> un array di tipi di contatto per il cliente corrente. *}
|
||||
{section name=customer loop=$custid}
|
||||
id: {$custid[customer]}<br>
|
||||
name: {$name[customer]}<br>
|
||||
address: {$address[customer]}<br>
|
||||
{section name=contact loop=$contact_type[customer]}
|
||||
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br>
|
||||
{/section}
|
||||
<p>
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
id: 1000<br>
|
||||
name: John Smith<br>
|
||||
address: 253 N 45th<br>
|
||||
home phone: 555-555-5555<br>
|
||||
cell phone: 555-555-5555<br>
|
||||
e-mail: john@myexample.com<br>
|
||||
<p>
|
||||
id: 1001<br>
|
||||
name: Jack Jones<br>
|
||||
address: 417 Mulberry ln<br>
|
||||
home phone: 555-555-5555<br>
|
||||
cell phone: 555-555-5555<br>
|
||||
e-mail: jack@myexample.com<br>
|
||||
<p>
|
||||
id: 1002<br>
|
||||
name: Jane Munson<br>
|
||||
address: 5605 apple st<br>
|
||||
home phone: 555-555-5555<br>
|
||||
cell phone: 555-555-5555<br>
|
||||
e-mail: jane@myexample.com<br>
|
||||
<p></programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>sezioni e array associativi</title>
|
||||
<programlisting>
|
||||
{* questo <20> un esempio di stampa di un array associativo
|
||||
di dati in una sezione *}
|
||||
{section name=customer loop=$contacts}
|
||||
name: {$contacts[customer].name}<br>
|
||||
home: {$contacts[customer].home}<br>
|
||||
cell: {$contacts[customer].cell}<br>
|
||||
e-mail: {$contacts[customer].email}<p>
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
name: John Smith<br>
|
||||
home: 555-555-5555<br>
|
||||
cell: 555-555-5555<br>
|
||||
e-mail: john@myexample.com<p>
|
||||
name: Jack Jones<br>
|
||||
home phone: 555-555-5555<br>
|
||||
cell phone: 555-555-5555<br>
|
||||
e-mail: jack@myexample.com<p>
|
||||
name: Jane Munson<br>
|
||||
home phone: 555-555-5555<br>
|
||||
cell phone: 555-555-5555<br>
|
||||
e-mail: jane@myexample.com<p></programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
|
||||
<example>
|
||||
<title>sectionelse</title>
|
||||
<programlisting>
|
||||
{* sectionelse viene eseguito se non ci sono valori in $custid *}
|
||||
{section name=customer loop=$custid}
|
||||
id: {$custid[customer]}<br>
|
||||
{sectionelse}
|
||||
there are no values in $custid.
|
||||
{/section}</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Le sezioni hanno anche le proprie variabili di gestione delle propriet<65>.
|
||||
Vengono indicate cos<6F>: {$smarty.section.nomesezione.nomevariabile}
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
A partire da Smarty 1.5.0, la sintassi per le variabili delle propriet<65>
|
||||
di sessione <20> cambiata da {%nomesezione.nomevariabile%} a
|
||||
{$smarty.section.sectionname.varname}. La vecchia sintassi <20> ancora
|
||||
supportata, ma negli esempi del manuale troverete solo riferimenti
|
||||
alla nuova.
|
||||
</para>
|
||||
</note>
|
||||
<sect2 id="section.property.index">
|
||||
<title>index</title>
|
||||
<para>
|
||||
index si usa per visualizzare l'attuale indice del ciclo, partendo
|
||||
da zero (o dall'attributo start se presente), e con incrementi di uno
|
||||
(o dell'attributo step se presente).
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Se le propriet<65> step e start non vengono modificate, index
|
||||
funziona allo stesso modo della propriet<65> iteration, ad
|
||||
eccezione del fatto che parte da 0 invece che da 1.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> index</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
0 id: 1000<br>
|
||||
1 id: 1001<br>
|
||||
2 id: 1002<br>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.index.prev">
|
||||
<title>index_prev</title>
|
||||
<para>
|
||||
index_prev visualizza l'indice del ciclo precedente.
|
||||
Sul primo ciclo <20> impostata a -1.
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> index_prev</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
||||
{* nota: $custid[customer.index] e $custid[customer] hanno identico significato *}
|
||||
{if $custid[customer.index_prev] ne $custid[customer.index]}
|
||||
The customer id changed<br>
|
||||
{/if}
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
0 id: 1000<br>
|
||||
The customer id changed<br>
|
||||
1 id: 1001<br>
|
||||
The customer id changed<br>
|
||||
2 id: 1002<br>
|
||||
The customer id changed<br>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.index.next">
|
||||
<title>index_next</title>
|
||||
<para>
|
||||
index_next visualizza l'indice del prossimo ciclo. Sull'ultimo
|
||||
ciclo ha sempre il valore maggiore dell'attuale (rispettando
|
||||
l'attributo step, quando presente).
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> index_next</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
||||
{* nota: $custid[customer.index] e $custid[customer] hanno identico significato *}
|
||||
{if $custid[customer.index_next] ne $custid[customer.index]}
|
||||
The customer id will change<br>
|
||||
{/if}
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
0 id: 1000<br>
|
||||
The customer id will change<br>
|
||||
1 id: 1001<br>
|
||||
The customer id will change<br>
|
||||
2 id: 1002<br>
|
||||
The customer id will change<br>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.iteration">
|
||||
<title>iteration</title>
|
||||
<para>
|
||||
iteration visualizza l'iterazione attuale del ciclo.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Al contrario di index, questa propriet<65> non <20> influenzata dalle
|
||||
propriet<65> start, step e max. Inoltre iteration comincia da 1
|
||||
invece che da 0 come index. rownum <20> un alias di iteration, e
|
||||
funziona in modo identico.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> iteration</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid start=5 step=2}
|
||||
current loop iteration: {$smarty.section.customer.iteration}<br>
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
||||
{* nota: $custid[customer.index] e $custid[customer] hanno identico significato *}
|
||||
{if $custid[customer.index_next] ne $custid[customer.index]}
|
||||
The customer id will change<br>
|
||||
{/if}
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
current loop iteration: 1
|
||||
5 id: 1000<br>
|
||||
The customer id will change<br>
|
||||
current loop iteration: 2
|
||||
7 id: 1001<br>
|
||||
The customer id will change<br>
|
||||
current loop iteration: 3
|
||||
9 id: 1002<br>
|
||||
The customer id will change<br>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.first">
|
||||
<title>first</title>
|
||||
<para>
|
||||
first vale true se l'iterazione attuale <20> la prima.
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> first</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{if $smarty.section.customer.first}
|
||||
<table>
|
||||
{/if}
|
||||
|
||||
<tr><td>{$smarty.section.customer.index} id:
|
||||
{$custid[customer]}</td></tr>
|
||||
|
||||
{if $smarty.section.customer.last}
|
||||
</table>
|
||||
{/if}
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
<table>
|
||||
<tr><td>0 id: 1000</td></tr>
|
||||
<tr><td>1 id: 1001</td></tr>
|
||||
<tr><td>2 id: 1002</td></tr>
|
||||
</table>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.last">
|
||||
<title>last</title>
|
||||
<para>
|
||||
last vale true se l'attuale iterazione <20> l'ultima.
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> last</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{if $smarty.section.customer.first}
|
||||
<table>
|
||||
{/if}
|
||||
|
||||
<tr><td>{$smarty.section.customer.index} id:
|
||||
{$custid[customer]}</td></tr>
|
||||
|
||||
{if $smarty.section.customer.last}
|
||||
</table>
|
||||
{/if}
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
<table>
|
||||
<tr><td>0 id: 1000</td></tr>
|
||||
<tr><td>1 id: 1001</td></tr>
|
||||
<tr><td>2 id: 1002</td></tr>
|
||||
</table>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.rownum">
|
||||
<title>rownum</title>
|
||||
<para>
|
||||
rownum visualizza l'iterazione attuale del ciclo, partendo
|
||||
da uno. E' un alias di iteration, e funziona in modo identico.
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> rownum</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
|
||||
{/section}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
1 id: 1000<br>
|
||||
2 id: 1001<br>
|
||||
3 id: 1002<br>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.loop">
|
||||
<title>loop</title>
|
||||
<para>
|
||||
loop visualizza l'index dell'ultimo ciclo visualizzato dalla
|
||||
sezione. Pu<50> essere usato all'interno o dopo la sezione.
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> index</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
||||
{/section}
|
||||
|
||||
There were {$smarty.section.customer.loop} customers shown above.
|
||||
|
||||
OUTPUT:
|
||||
|
||||
0 id: 1000<br>
|
||||
1 id: 1001<br>
|
||||
2 id: 1002<br>
|
||||
|
||||
There were 3 customers shown above.
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.show">
|
||||
<title>show</title>
|
||||
<para>
|
||||
<emphasis>show</emphasis> <20> usato come parametro per la sezione.
|
||||
<emphasis>show</emphasis> <20> un valore booleano, true o false. Se
|
||||
false, la sezione non verr<72> visualizzata. Se <20> presente un sectionelse,
|
||||
verr<72> visualizzato questo.
|
||||
</para>
|
||||
<example>
|
||||
<title>attributo show</title>
|
||||
<programlisting>
|
||||
{* $show_customer_info potrebbe essere stato passato dall'applicazione
|
||||
PHP, per stabilire se questa sezione deve essere visualizzata o no *}
|
||||
{section name=customer loop=$custid show=$show_customer_info}
|
||||
{$smarty.section.customer.rownum} id: {$custid[customer]}<br>
|
||||
{/section}
|
||||
|
||||
{if $smarty.section.customer.show}
|
||||
the section was shown.
|
||||
{else}
|
||||
the section was not shown.
|
||||
{/if}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
1 id: 1000<br>
|
||||
2 id: 1001<br>
|
||||
3 id: 1002<br>
|
||||
|
||||
the section was shown.
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="section.property.total">
|
||||
<title>total</title>
|
||||
<para>
|
||||
total visualizza il numero totale di iterazioni che la sezione
|
||||
eseguir<69>. Pu<50> essere usato all'interno o dopo la sezione.
|
||||
</para>
|
||||
<example>
|
||||
<title>propriet<EFBFBD> total</title>
|
||||
<programlisting>
|
||||
{section name=customer loop=$custid step=2}
|
||||
{$smarty.section.customer.index} id: {$custid[customer]}<br>
|
||||
{/section}
|
||||
|
||||
There were {$smarty.section.customer.total} customers shown above.
|
||||
|
||||
OUTPUT:
|
||||
|
||||
0 id: 1000<br>
|
||||
2 id: 1001<br>
|
||||
4 id: 1002<br>
|
||||
|
||||
There were 3 customers shown above.
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.strip">
|
||||
<title>strip</title>
|
||||
<para>
|
||||
Molte volte i progettisti di pagine web si trovano davanti al
|
||||
problema causato da spazi e "a capo" che influiscono sull'output
|
||||
HTML generato (a causa delle "caratteristiche" del browser), per
|
||||
cui si trovano costretti a mettere tutti insieme i tag del template
|
||||
per ottenere il risultato voluto. Questo di solito significa
|
||||
ritrovarsi con un template illeggibile o ingestibile.
|
||||
</para>
|
||||
<para>
|
||||
Tutto ci<63> che <20> compreso fra i tag {strip}{/strip} in Smarty viene
|
||||
ripulito dagli spazi extra o dai caratteri di ritorno a capo all'inizio
|
||||
e alla fine delle righe, prima di essere visualizzato. In
|
||||
questo modo potete mantenere la leggibilit<69> dei vostri template senza
|
||||
preoccuparvi dei problemi causati dagli spazi.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
{strip}{/strip} non modificano il contenuto delle variabili del template.
|
||||
Vedere la <link linkend="language.modifier.strip">funzione strip modifier</link>.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>tag strip</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* il codice seguente uscir<69> in output su una riga unica *}
|
||||
{strip}
|
||||
<table border=0>
|
||||
<tr>
|
||||
<td>
|
||||
<A HREF="{$url}">
|
||||
<font color="red">This is a test</font>
|
||||
</A>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/strip}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
<table border=0><tr><td><A HREF="http://my.example.com"><font color="red">This is a test</font></A></td></tr></table>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Notate che nell'esempio qui sopra tutte le righe iniziano e
|
||||
finiscono con tag HTML. Tenete presente che tutte le linee
|
||||
vengono "attaccate", per cui se avete del testo all'inizio
|
||||
o alla fine di qualche riga, questo verr<72> attaccato, e probabilmente
|
||||
non <20> ci<63> che volete.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
64
docs/it/designers/language-combining-modifiers.xml
Normal file
64
docs/it/designers/language-combining-modifiers.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.combining.modifiers">
|
||||
<title>Combinare i modificatori</title>
|
||||
<para>
|
||||
Potete applicare qualsiasi numero di modificatori ad una variabile.
|
||||
Verranno eseguiti nell'ordine in cui li avete indicati, da sinistra
|
||||
a destra. Devono essere separati con un carattere <literal>|</literal> (pipe).
|
||||
</para>
|
||||
<example>
|
||||
<title>combinare i modificatori</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
index.php:
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
|
||||
index.tpl:
|
||||
|
||||
{$articleTitle}
|
||||
{$articleTitle|upper|spacify}
|
||||
{$articleTitle|lower|spacify|truncate}
|
||||
{$articleTitle|lower|truncate:30|spacify}
|
||||
{$articleTitle|lower|spacify|truncate:30:". . ."}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
L'esempio sopra stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Smokers are Productive, but Death Cuts Efficiency.
|
||||
S M O K E R S A R E P R O D U C T I V E , B U T D E A T H C U T S E F F I C I E N C Y .
|
||||
s m o k e r s a r e p r o d u c t i v e , b u t d e a t h c u t s...
|
||||
s m o k e r s a r e p r o d u c t i v e , b u t . . .
|
||||
s m o k e r s a r e p. . .
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
49
docs/it/designers/language-custom-functions.xml
Normal file
49
docs/it/designers/language-custom-functions.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.custom.functions">
|
||||
<title>Custom Functions</title>
|
||||
<para>
|
||||
Smarty <20> fornito di numerose funzioni utente che potete
|
||||
utilizzare nei template.
|
||||
</para>
|
||||
|
||||
&designers.language-custom-functions.language-function-assign;
|
||||
&designers.language-custom-functions.language-function-counter;
|
||||
&designers.language-custom-functions.language-function-cycle;
|
||||
&designers.language-custom-functions.language-function-debug;
|
||||
&designers.language-custom-functions.language-function-eval;
|
||||
&designers.language-custom-functions.language-function-fetch;
|
||||
&designers.language-custom-functions.language-function-html-checkboxes;
|
||||
&designers.language-custom-functions.language-function-html-image;
|
||||
&designers.language-custom-functions.language-function-html-options;
|
||||
&designers.language-custom-functions.language-function-html-radios;
|
||||
&designers.language-custom-functions.language-function-html-select-date;
|
||||
&designers.language-custom-functions.language-function-html-select-time;
|
||||
&designers.language-custom-functions.language-function-html-table;
|
||||
&designers.language-custom-functions.language-function-math;
|
||||
&designers.language-custom-functions.language-function-mailto;
|
||||
&designers.language-custom-functions.language-function-popup-init;
|
||||
&designers.language-custom-functions.language-function-popup;
|
||||
&designers.language-custom-functions.language-function-textformat;
|
||||
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.assign">
|
||||
<title>assign</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>var</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Nome della variabile valorizzata</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>value</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Valore assegnato alla variabile</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
assign <20> usato per assegnare valori alle variabili del template
|
||||
durante l'esecuzione dello stesso.
|
||||
</para>
|
||||
<example>
|
||||
<title>assign</title>
|
||||
<programlisting>
|
||||
{assign var="name" value="Bob"}
|
||||
|
||||
The value of $name is {$name}.
|
||||
|
||||
OUTPUT:
|
||||
|
||||
The value of $name is Bob.</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.counter">
|
||||
<title>counter</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>default</emphasis></entry>
|
||||
<entry>Nome del contatore</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>start</entry>
|
||||
<entry>numerico</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>1</emphasis></entry>
|
||||
<entry>Valore di partenza del contatore</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>skip</entry>
|
||||
<entry>numerico</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>1</emphasis></entry>
|
||||
<entry>Passo del contatore</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>direction</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>up</emphasis></entry>
|
||||
<entry>Direzione del conteggio (up/down)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>print</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>Se stampare il valore oppure no</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>la variabile del template a cui assegnare il valore</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
counter si usa per stampare un conteggio. counter terr<72> il conto
|
||||
del valore ad ogni iterazione. Potete impostare il valore di partenza,
|
||||
l'intervallo e la direzione del conteggio, cos<6F> come decidere se
|
||||
stampare il valore oppure no. Potete utilizzare pi<70> contatori
|
||||
contemporaneamente indicando un nome diverso per ciascuno. Se non indicate
|
||||
un nome, verr<72> usato il nome 'default'.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite lo speciale attributo "assign", l'output della funzione contatore
|
||||
verr<72> assegnato a questa variabile invece di essere stampata in output.
|
||||
</para>
|
||||
<example>
|
||||
<title>counter</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* inizializzazione del contatore *}
|
||||
{counter start=0 skip=2}<br />
|
||||
{counter}<br />
|
||||
{counter}<br />
|
||||
{counter}<br />
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
0<br />
|
||||
2<br />
|
||||
4<br />
|
||||
6<br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.cycle">
|
||||
<title>cycle</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>default</emphasis></entry>
|
||||
<entry>Nome del ciclo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>values</entry>
|
||||
<entry>misto</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Valori da usare nel ciclo: pu<70> essere
|
||||
una lista delimitata da un separatore (vedere attributo
|
||||
delimiter), oppure un array di valori.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>print</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>Se stampare il valore oppure no.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>advance</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>Se avanzare o no al prossimo valore.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>delimiter</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>,</emphasis></entry>
|
||||
<entry>Delimitatore per l'attributo values.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>Variabile del template cui assegnare l'output.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Cycle si usa per effettuare un ciclo alternato fra un insieme di valori.
|
||||
Ci d<> la possibilit<69> di alternare facilmente due o pi<70> colori in una
|
||||
tabella, o di effettuare un ciclo su un array di valori.
|
||||
</para>
|
||||
<para>
|
||||
Potete effettuare il ciclo su pi<70> di un insieme di valori nel template
|
||||
fornendo l'attributo name, se date ad ogni insieme un nome diverso.
|
||||
</para>
|
||||
<para>
|
||||
Potete evitare che il valore corrente venga stampato impostando
|
||||
l'attributo set a false. Pu<50> essere utile per saltare un valore.
|
||||
</para>
|
||||
<para>
|
||||
L'attributo advance serve per ripetere un valore. Se lo impostate a
|
||||
false, l'iterazione successiva del ciclo stamper<65> lo stesso valore.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite lo speciale attributo "assign", l'output della funzione cycle
|
||||
verr<72> assegnato a questa variabile invece di essere stampato in output.
|
||||
</para>
|
||||
<example>
|
||||
<title>cycle</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{section name=rows loop=$data}
|
||||
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
|
||||
<td>{$data[rows]}</td>
|
||||
</tr>
|
||||
{/section}
|
||||
]]>
|
||||
</programlisting>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<tr bgcolor="#eeeeee">
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr bgcolor="#d0d0d0">
|
||||
<td>2</td>
|
||||
</tr>
|
||||
<tr bgcolor="#eeeeee">
|
||||
<td>3</td>
|
||||
</tr>
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.debug">
|
||||
<title>debug</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>output</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>html</emphasis></entry>
|
||||
<entry>tipo di output: html o javascript</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
{debug} produce un dump sulla pagina della console di debug. Funziona
|
||||
indipendentemente dall'impostazione <link linkend="chapter.debugging.console">debug</link>
|
||||
di Smarty. Siccome viene eseguita a runtime, <20> in grado di
|
||||
mostrare soltanto le variabili, non i template che state utilizzando.
|
||||
Comunque vedrete tutte le variabili attualmente disponibili nello
|
||||
scope di questo template.
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.eval">
|
||||
<title>eval</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>var</entry>
|
||||
<entry>misto</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>variabile (o stringa) da valorizzare</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>la variabile cui verr<72> assegnato l'output</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
eval si usa per valorizzare una variabile come se fosse un
|
||||
template. Si pu<70> usare per incorporare tag o variabili di template
|
||||
dentro altre variabili, oppure tag o variabili nelle variabili dei
|
||||
file di configurazione.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite lo speciale attributo "assign" l'output della funzione
|
||||
eval sar<61> assegnato a questa variabile invece di essere stampato
|
||||
in output.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
La variabili valorizzate con eval sono trattate allo stesso modo
|
||||
dei template. Seguono le stesse regole di escape e di sicurezza,
|
||||
come se fossero template
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Le variabili valorizzate con eval vengono compilate ad ogni chiamata:
|
||||
la versione compilata non viene salvata! Comunque, se avete il
|
||||
caching abilitato, l'output verr<72> messo in cache con il resto del
|
||||
template.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>eval</title>
|
||||
<programlisting>
|
||||
setup.conf
|
||||
----------
|
||||
|
||||
emphstart = <b>
|
||||
emphend = </b>
|
||||
title = Welcome to {$company}'s home page!
|
||||
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
|
||||
ErrorState = You must supply a {#emphstart#}state{#emphend#}.
|
||||
|
||||
|
||||
index.tpl
|
||||
---------
|
||||
|
||||
{config_load file="setup.conf"}
|
||||
|
||||
{eval var=$foo}
|
||||
{eval var=#title#}
|
||||
{eval var=#ErrorCity#}
|
||||
{eval var=#ErrorState# assign="state_error"}
|
||||
{$state_error}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
This is the contents of foo.
|
||||
Welcome to Foobar Pub & Grill's home page!
|
||||
You must supply a <b>city</b>.
|
||||
You must supply a <b>state</b>.
|
||||
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.fetch">
|
||||
<title>fetch</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>il file o l'indirizzo http o ftp da caricare</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>la variabile del template cui assegnare l'output</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
fetch si usa per recuperare file dal filesystem locale, oppure da
|
||||
un indirizzo http o ftp, e visualizzarne il contenuto. Se il nome
|
||||
del file inizia per "http://", la pagina web verr<72> letta e
|
||||
visualizzata. Se il nome del file inizia per "ftp://", il file
|
||||
verr<72> recuperato dal server ftp e visualizzato. Per i file locali
|
||||
deve essere indicato l'intero percorso sul filesystem oppure un
|
||||
percorso relativo all'indirizzo dello script php in esecuzione.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite lo speciale attributo "assign", l'output della funzione
|
||||
fetch verr<72> assegnato a questa variabile invece di essere stampato
|
||||
in output. (novit<69> di Smarty 1.5.0)
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
I redirect http non sono supportati, quindi assicuratevi di
|
||||
mettere lo slash finale sull'indirizzo della pagina web quando
|
||||
necessario.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Se <20> attivata la security del template e state cercando di
|
||||
caricare un file dal filesystem locale, saranno consentiti
|
||||
soltanto file compresi in una delle directory definite sicure
|
||||
($secure_dir).
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>fetch</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* inclusione di un javascript nel template *}
|
||||
{fetch file="/export/httpd/www.example.com/docs/navbar.js"}
|
||||
|
||||
{* incorporazione nel template del testo relativo al tempo proveniente da un altro sito *}
|
||||
{fetch file="http://www.myweather.com/68502/"}
|
||||
|
||||
{* lettura via ftp dei titoli delle ultime notizie *}
|
||||
{fetch file="ftp://user:password@ftp.example.com/path/to/currentheadlines.txt"}
|
||||
|
||||
{* assegnazione del contenuto letto ad una variabile del template *}
|
||||
{fetch file="http://www.myweather.com/68502/" assign="weather"}
|
||||
{if $weather ne ""}
|
||||
<b>{$weather}</b>
|
||||
{/if}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.checkboxes">
|
||||
<title>html_checkboxes</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>checkbox</emphasis></entry>
|
||||
<entry>nome della lista di checkbox</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>values</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usi l'attributo options</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di valori per le checkbox</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>output</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usi l'attributo options</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di output per le checkbox</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>selected</entry>
|
||||
<entry>stringa/array</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>la/le checkbox preselezionata/e</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>options</entry>
|
||||
<entry>array associativo</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usino values e output</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array associativo di valori e output</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>separator</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>stringa di testo da usare come separatore fra le checkbox</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>labels</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>aggiunge i tag <label> all'output</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_checkboxes <20> una funzione utente che usa i dati forniti per
|
||||
creare un gruppo di checkbox html. Si occupa anche di impostare
|
||||
la casella selezionata per default. Gli attributi obbligatori sono
|
||||
values e output, a meno che non usiate invece options. Tutto
|
||||
l'output generato <20> compatibile XHTML.
|
||||
</para>
|
||||
<para>
|
||||
Tutti i parametri non compresi nella lista qui sopra vengono
|
||||
stampati come coppie nome/valore all'interno di ogni tag <input>.
|
||||
</para>
|
||||
<example>
|
||||
<title>html_checkboxes</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane Johnson','Charlie Brown'));
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_checkboxes', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown'));
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="id" options=$cust_checkboxes selected=$customer_id separator="<br />"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
entrambi gli esempi produrranno in output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
|
||||
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.image">
|
||||
<title>html_image</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>nome/percorso dell'immagine</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>border</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>0</emphasis></entry>
|
||||
<entry>dimensione del bordo dell'immagine</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>height</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>altezza effettiva dell'immagine</emphasis></entry>
|
||||
<entry>altezza con cui visualizzare l'immagine</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>width</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>larghezza effettiva dell'immagine</emphasis></entry>
|
||||
<entry>larghezza con cui visualizzare l'immagine</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>basedir</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>doc root del web server</emphasis></entry>
|
||||
<entry>directory di base per percorsi relativi</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>alt</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>""</emphasis></entry>
|
||||
<entry>descrizione alternativa dell'immagine</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>href</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>valore di href per il link dell'immagine</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_image <20> una funzione utente che genera un tag HTML per una
|
||||
immagine. L'altezza e la larghezza, quando non indicate, vengono
|
||||
calcolate automaticamente dal file dell'immagine.
|
||||
</para>
|
||||
<para>
|
||||
basedir <20> la directory di riferimento per percorsi relativi. Se non
|
||||
viene indicata, viene usata come base la document root del web
|
||||
server (variabile di ambiente DOCUMENT_ROOT). Se la security <20>
|
||||
abilitata, il percorso dell'immagine deve trovarsi in una directory
|
||||
considerata sicura.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>href</parameter> <20> l'indirizzo del link a cui collegare
|
||||
l'immagine. Se viene fornito, verr<72> creato un tag
|
||||
<a href="LINKVALUE"><a> attorno al tag image.
|
||||
</para>
|
||||
<para>
|
||||
Tutti i parametri non compresi nella lista qui sopra vengono
|
||||
stampati come coppie nome/valore all'interno del tag <img>
|
||||
generato.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
html_image richiede un accesso al disco per leggere il
|
||||
file dell'immagine e calcolarne altezza e larghezza. Se non
|
||||
usate il caching dei template, <20> generalmente consigliabile
|
||||
evitare html_image e lasciare i tag image statici per
|
||||
ottenere prestazioni ottimali.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>esempio di html_image</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_image file="pumpkin.jpg"}
|
||||
{html_image file="/path/from/docroot/pumpkin.jpg"}
|
||||
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
un possibile output potrebbe essere:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<img src="pumpkin.jpg" alt="" border="0" width="44" height="68" />
|
||||
<img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" />
|
||||
<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44" height="68" />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.options">
|
||||
<title>html_options</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>values</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usi l'attributo options</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di valori per il men<65> a discesa</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>output</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usi l'attributo options</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di output per il men<65> a discesa</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>selected</entry>
|
||||
<entry>stringa/array</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>l'elemento/gli elementi selezionato/i</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>options</entry>
|
||||
<entry>array associativo</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usino values e output</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array associativo di valori e output</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>nome del gruppo select</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_options <20> una funzione utente che usa i dati forniti per creare
|
||||
un gruppo di opzioni, cio<69> di valori option per un men<65> a discesa
|
||||
(casella select). Si occupa anche di quale o quali valori devono
|
||||
essere preselezionati. Gli attributi obbligatori sono values e output,
|
||||
a meno che non usiate invece options.
|
||||
</para>
|
||||
<para>
|
||||
Se uno dei valori forniti <20> un array, verr<72> trattato come un gruppo
|
||||
di opzioni (OPTGROUP), e visualizzato di conseguenza. E' possibile
|
||||
creare gruppi ricorsivi (a pi<70> livelli). Tutto l'output generato <20>
|
||||
compatibile XHTML.
|
||||
</para>
|
||||
<para>
|
||||
Se viene fornito l'attributo opzionale <emphasis>name</emphasis>,
|
||||
la lista di opzioni verr<72> racchiusa con il tag
|
||||
<select name="groupname"></select>. In caso contrario
|
||||
verr<72> generata solo la lista di opzioni.
|
||||
</para>
|
||||
<para>
|
||||
Tutti i parametri non compresi nella lista qui sopra verranno
|
||||
stampati come coppie nome/valore nel tag <select>.
|
||||
Saranno ignorati se l'attributo <emphasis>name</emphasis> non <20>
|
||||
presente.
|
||||
</para>
|
||||
<example>
|
||||
<title>html_options</title>
|
||||
<programlisting>
|
||||
index.php:
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
||||
Johnson','Carlie Brown'));
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
index.tpl:
|
||||
|
||||
<select name=customer_id>
|
||||
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
|
||||
</select>
|
||||
|
||||
|
||||
index.php:
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_options', array(
|
||||
1001 => 'Joe Schmoe',
|
||||
1002 => 'Jack Smith',
|
||||
1003 => 'Jane Johnson',
|
||||
1004 => 'Charlie Brown'));
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
index.tpl:
|
||||
|
||||
<select name=customer_id>
|
||||
{html_options options=$cust_options selected=$customer_id}
|
||||
</select>
|
||||
|
||||
|
||||
OUTPUT: (per entrambi gli esempi)
|
||||
|
||||
<select name=customer_id>
|
||||
<option value="1000">Joe Schmoe</option>
|
||||
<option value="1001" selected="selected">Jack Smith</option>
|
||||
<option value="1002">Jane Johnson</option>
|
||||
<option value="1003">Charlie Brown</option>
|
||||
</select></programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.radios">
|
||||
<title>html_radios</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>radio</emphasis></entry>
|
||||
<entry>nome dell'insieme di pulsanti radio</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>values</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usi l'attributo options</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di valori per i pulsanti radio</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>output</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usi l'attributo options</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di output per i pulsanti radio</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>selected</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>l'elemento preselezionato</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>options</entry>
|
||||
<entry>array associativo</entry>
|
||||
<entry>s<EFBFBD>, a meno che si usino values e output</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>array associativo di valori e output</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>separator</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>stringa di testo da usare come separatore fra le diverse voci</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_radios <20> una funzione utente che usa i dati forniti per creare
|
||||
un gruppo di pulsanti radio html. Si occupa anche di quale deve
|
||||
essere selezionato per default. Gli attributi obbligatori sono values
|
||||
e output, a meno che non usiate invece options. Tutto l'output
|
||||
generato <20> compatibile XHTML.
|
||||
</para>
|
||||
<para>
|
||||
Tutti i parametri non compresi nella lista qui sopra verranno
|
||||
stampati come coppie nome/valore in ciascuno dei tag <input>
|
||||
creati.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>html_radios</title>
|
||||
<programlisting>
|
||||
index.php:
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
||||
Johnson','Charlie Brown'));
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
|
||||
index.tpl:
|
||||
|
||||
{html_radios name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
|
||||
|
||||
|
||||
index.php:
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('cust_radios', array(
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown'));
|
||||
$smarty->assign('customer_id', 1001);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
|
||||
index.tpl:
|
||||
|
||||
{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />"}
|
||||
|
||||
|
||||
OUTPUT: (per entrambi gli esempi)
|
||||
|
||||
<input type="radio" name="id" value="1000">Joe Schmoe<br />
|
||||
<input type="radio" name="id" value="1001" checked="checked">Jack Smith<br />
|
||||
<input type="radio" name="id" value="1002">Jane Johnson<br />
|
||||
<input type="radio" name="id" value="1003">Charlie Brown<br /></programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,361 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.select.date">
|
||||
<title>html_select_date</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>prefix</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>Date_</entry>
|
||||
<entry>prefisso per i nomi delle variabili</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>time</entry>
|
||||
<entry>timestamp/YYYY-MM-DD</entry>
|
||||
<entry>no</entry>
|
||||
<entry>data attuale in formato unix timestamp o YYYY-MM-DD</entry>
|
||||
<entry>data preselezionata</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>start_year</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>anno corrente</entry>
|
||||
<entry>primo anno visualizzato: pu<70> essere in valore assoluto
|
||||
o relativo all'anno corrente(+/- N)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>end_year</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>uguale a start_year</entry>
|
||||
<entry>ultimo anno visualizzato: pu<70> essere in valore assoluto
|
||||
o relativo all'anno corrente(+/- N)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_days</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se visualizzare i giorni oppure no</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_months</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se visualizzare i mesi oppure no</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_years</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se visualizzare gli anni oppure no</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>month_format</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>%B</entry>
|
||||
<entry>formato per i mesi in output (strftime)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>day_format</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>%02d</entry>
|
||||
<entry>formato per i giorni in output (sprintf)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>day_value_format</entry>
|
||||
<entry>string</entry>
|
||||
<entry>no</entry>
|
||||
<entry>%d</entry>
|
||||
<entry>formato per il valore dei giorni (sprintf)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>year_as_text</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>false</entry>
|
||||
<entry>se visualizzare gli anni in forma testuale oppure no</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>reverse_years</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>false</entry>
|
||||
<entry>se visualizzare gli anni in ordine inverso</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>field_array</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se viene fornito un nome, le caselle select
|
||||
verranno create in modo che il risultato
|
||||
venga fornito a PHP nella forma nome[Day],
|
||||
nome[Year], nome[Month].
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>day_size</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge l'attributo size al tag select</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>month_size</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge l'attributo size al tag select</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>year_size</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge l'attributo size al tag select</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>all_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra a tutti i tag select</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>day_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra ai tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>month_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra ai tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>year_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra ai tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>field_order</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>MDY</entry>
|
||||
<entry>ordine di visualizzazione dei campi (mese, giorno, anno)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>field_separator</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>\n</entry>
|
||||
<entry>stringa di separazione fra i campi</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>month_value_format</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>%m</entry>
|
||||
<entry>formato strftime per i valori dei mesi</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>year_empty</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>Se presente, il primo elemento della casella select per gli anni
|
||||
conterr<72> questo valore come output e "" come valore. E' utile per mostrare,
|
||||
ad esempio, sul men<65> a discesa la frase "Selezionare l'anno".
|
||||
Notate che potete utilizzare valori del tipo "-MM-DD" nell'attributo time
|
||||
per indicare che l'anno non deve essere preselezionato.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>month_empty</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>Se presente, il primo elemento della casella select per i mesi
|
||||
conterr<72> questo valore come output e "" come valore.
|
||||
Notate che potete utilizzare valori del tipo "YYYY---DD" nell'attributo time
|
||||
per indicare che il mese non deve essere preselezionato.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>day_empty</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>Se presente, il primo elemento della casella select per i giorni
|
||||
conterr<72> questo valore come output e "" come valore.
|
||||
Notate che potete utilizzare valori del tipo "YYYY-MM-" nell'attributo time
|
||||
per indicare che il giorno non deve essere preselezionato.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_select_date <20> una funzione utente che crea per voi men<65> a discesa
|
||||
per le date. Pu<50> mostrare anno, mese e giorno o solo qualcuno di questi
|
||||
valori.
|
||||
</para>
|
||||
<para>
|
||||
L'attributo time pu<70> avere diversi formati: pu<70> essere un timestamp UNIX
|
||||
o una stringa di tipo Y-M-D (anno-mese-giorno). Il formato pi<70> comune
|
||||
sarebbe YYYY-MM-DD, ma vengono riconosciuti anche mesi e giorni con meno
|
||||
di due cifre. Se uno dei tre valori (Y,M,D) <20> una stringa vuota, il campo
|
||||
select corrispondente non avr<76> nessuna preselezione. Ci<43> <20> utile in
|
||||
special modo con gli attributi year_empty, month_empty e day_empty.
|
||||
</para>
|
||||
<example>
|
||||
<title>html_select_date</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_select_date}
|
||||
+]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<select name="Date_Month">
|
||||
<option value="1">January</option>
|
||||
<option value="2">February</option>
|
||||
<option value="3">March</option>
|
||||
<option value="4">April</option>
|
||||
<option value="5">May</option>
|
||||
<option value="6">June</option>
|
||||
<option value="7">July</option>
|
||||
<option value="8">August</option>
|
||||
<option value="9">September</option>
|
||||
<option value="10">October</option>
|
||||
<option value="11">November</option>
|
||||
<option value="12" selected="selected">December</option>
|
||||
</select>
|
||||
<select name="Date_Day">
|
||||
<option value="1">01</option>
|
||||
<option value="2">02</option>
|
||||
<option value="3">03</option>
|
||||
<option value="4">04</option>
|
||||
<option value="5">05</option>
|
||||
<option value="6">06</option>
|
||||
<option value="7">07</option>
|
||||
<option value="8">08</option>
|
||||
<option value="9">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13" selected="selected">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="28">28</option>
|
||||
<option value="29">29</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
</select>
|
||||
<select name="Date_Year">
|
||||
<option value="2001" selected="selected">2001</option>
|
||||
</select>
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>html_select_date</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* l'anno iniziale e finale possono essere relativi a quello corrente *}
|
||||
{html_select_date prefix="StartDate" time=$time start_year="-5" end_year="+1" display_days=false}
|
||||
+]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>: (l'anno corrente <20> il 2000)
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<select name="StartDateMonth">
|
||||
<option value="1">January</option>
|
||||
<option value="2">February</option>
|
||||
<option value="3">March</option>
|
||||
<option value="4">April</option>
|
||||
<option value="5">May</option>
|
||||
<option value="6">June</option>
|
||||
<option value="7">July</option>
|
||||
<option value="8">August</option>
|
||||
<option value="9">September</option>
|
||||
<option value="10">October</option>
|
||||
<option value="11">November</option>
|
||||
<option value="12" selected="selected">December</option>
|
||||
</select>
|
||||
<select name="StartDateYear">
|
||||
<option value="1995">1995</option>
|
||||
<option value="1996">1996</option>
|
||||
<option value="1997">1997</option>
|
||||
<option value="1998">1998</option>
|
||||
<option value="1999">1999</option>
|
||||
<option value="2000" selected="selected">2000</option>
|
||||
<option value="2001">2001</option>
|
||||
</select>
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,331 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.select.time">
|
||||
<title>html_select_time</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>prefix</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>Time_</entry>
|
||||
<entry>prefisso per i nomi delle variabili</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>time</entry>
|
||||
<entry>timestamp</entry>
|
||||
<entry>no</entry>
|
||||
<entry>ora corrente</entry>
|
||||
<entry>ora preselezionata</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_hours</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se mostrare o no le ore</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_minutes</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se mostrare o no i minuti</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_seconds</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se mostrare o no i secondi</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_meridian</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se mostrare o no il valore "am/pm" (antimeridiano / pomeridiano).
|
||||
Questo valore non viene mai mostrato (e quindi il parametro
|
||||
ignorato) se use_24_hours <20> true.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>use_24_hours</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry>true</entry>
|
||||
<entry>se usare o no l'orologio di 24 ore</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>minute_interval</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry>1</entry>
|
||||
<entry>intervallo dei minuti nel men<65> a discesa relativo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>second_interval</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry>1</entry>
|
||||
<entry>intervallo dei secondi nel men<65> a discesa relativo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>field_array</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>nessuno</entry>
|
||||
<entry>imposta i valori in un array con questo nome</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>all_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra a tutti i tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>hour_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra al tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>minute_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra al tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>second_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra al tag select/input</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>meridian_extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry>null</entry>
|
||||
<entry>se presente aggiunge attributi extra al tag select/input</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_select_time <20> una funzione utente che crea per voi men<65> a discesa per
|
||||
la selezione di un orario. Potete scegliere quali campi visualizzare fra
|
||||
ore, minuti, secondi e antimeridiano/postmeridiano.
|
||||
</para>
|
||||
<para>
|
||||
L'attributo time pu<70> avere vari formati. Pu<50> essere un timestamp o
|
||||
una stringa nel formato YYYYMMDDHHMMSS o una stringa leggibile
|
||||
dalla funzione php strtotime().
|
||||
</para>
|
||||
<example>
|
||||
<title>html_select_time</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_select_time use_24_hours=true}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
This will output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<select name="Time_Hour">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09" selected="selected">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
</select>
|
||||
<select name="Time_Minute">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20" selected="selected">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="28">28</option>
|
||||
<option value="29">29</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
<option value="32">32</option>
|
||||
<option value="33">33</option>
|
||||
<option value="34">34</option>
|
||||
<option value="35">35</option>
|
||||
<option value="36">36</option>
|
||||
<option value="37">37</option>
|
||||
<option value="38">38</option>
|
||||
<option value="39">39</option>
|
||||
<option value="40">40</option>
|
||||
<option value="41">41</option>
|
||||
<option value="42">42</option>
|
||||
<option value="43">43</option>
|
||||
<option value="44">44</option>
|
||||
<option value="45">45</option>
|
||||
<option value="46">46</option>
|
||||
<option value="47">47</option>
|
||||
<option value="48">48</option>
|
||||
<option value="49">49</option>
|
||||
<option value="50">50</option>
|
||||
<option value="51">51</option>
|
||||
<option value="52">52</option>
|
||||
<option value="53">53</option>
|
||||
<option value="54">54</option>
|
||||
<option value="55">55</option>
|
||||
<option value="56">56</option>
|
||||
<option value="57">57</option>
|
||||
<option value="58">58</option>
|
||||
<option value="59">59</option>
|
||||
</select>
|
||||
<select name="Time_Second">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23" selected="selected">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="28">28</option>
|
||||
<option value="29">29</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
<option value="32">32</option>
|
||||
<option value="33">33</option>
|
||||
<option value="34">34</option>
|
||||
<option value="35">35</option>
|
||||
<option value="36">36</option>
|
||||
<option value="37">37</option>
|
||||
<option value="38">38</option>
|
||||
<option value="39">39</option>
|
||||
<option value="40">40</option>
|
||||
<option value="41">41</option>
|
||||
<option value="42">42</option>
|
||||
<option value="43">43</option>
|
||||
<option value="44">44</option>
|
||||
<option value="45">45</option>
|
||||
<option value="46">46</option>
|
||||
<option value="47">47</option>
|
||||
<option value="48">48</option>
|
||||
<option value="49">49</option>
|
||||
<option value="50">50</option>
|
||||
<option value="51">51</option>
|
||||
<option value="52">52</option>
|
||||
<option value="53">53</option>
|
||||
<option value="54">54</option>
|
||||
<option value="55">55</option>
|
||||
<option value="56">56</option>
|
||||
<option value="57">57</option>
|
||||
<option value="58">58</option>
|
||||
<option value="59">59</option>
|
||||
</select>
|
||||
<select name="Time_Meridian">
|
||||
<option value="am" selected="selected">AM</option>
|
||||
<option value="pm">PM</option>
|
||||
</select>
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.html.table">
|
||||
<title>html_table</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>loop</entry>
|
||||
<entry>array</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>array di dati da visualizzare nella tabella</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cols</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>3</emphasis></entry>
|
||||
<entry>numero di colonne della tabella</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>table_attr</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>border="1"</emphasis></entry>
|
||||
<entry>attributi per il tag table</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>tr_attr</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>attributi per i tag tr (gli array vengono alternati)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>td_attr</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>attributi per i tag td (gli array vengono alternati)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>trailpad</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>&nbsp;</emphasis></entry>
|
||||
<entry>valore per le celle aggiuntive dell'ultima riga,
|
||||
se presenti</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>hdir</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>right</emphasis></entry>
|
||||
<entry>direzione di riempimento delle righe. Valori possibili: <emphasis>left</emphasis>/<emphasis>right</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>vdir</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>down</emphasis></entry>
|
||||
<entry>direzione di riempimento delle colonne. Valori possibili: <emphasis>up</emphasis>/<emphasis>down</emphasis></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
<emphasis>html_table</emphasis> <20> una funzione utente che formatta
|
||||
un array di dati in una tabella HTML. L'attributo <emphasis>cols</emphasis>
|
||||
determina il numero di colonne che formeranno la tabella. I valori
|
||||
di <emphasis>table_attr</emphasis>, <emphasis>tr_attr</emphasis> e
|
||||
<emphasis>td_attr</emphasis> determinano gli attributi dei tag table,
|
||||
tr e td. Se <emphasis>tr_attr</emphasis> o <emphasis>td_attr</emphasis>
|
||||
sono array, la funzione user<65> un ciclo per alternarne i valori.
|
||||
<emphasis>trailpad</emphasis> <20> il valore da usare nelle ultime celle
|
||||
da aggiungere all'ultima riga, nel caso in cui il numero di valori
|
||||
nell'array loop non sia divisibile per il numero di colonne.
|
||||
</para>
|
||||
<example>
|
||||
<title>html_table</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
index.php:
|
||||
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
|
||||
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
index.tpl:
|
||||
|
||||
{html_table loop=$data}
|
||||
{html_table loop=$data cols=4 table_attr='border="0"'}
|
||||
{html_table loop=$data cols=4 tr_attr=$tr}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
<table border="1">
|
||||
<tr><td>1</td><td>2</td><td>3</td></tr>
|
||||
<tr><td>4</td><td>5</td><td>6</td></tr>
|
||||
<tr><td>7</td><td>8</td><td>9</td></tr>
|
||||
</table>
|
||||
<table border="0">
|
||||
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
|
||||
<tr><td>5</td><td>6</td><td>7</td><td>8</td></tr>
|
||||
<tr><td>9</td><td> </td><td> </td><td> </td></tr>
|
||||
</table>
|
||||
<table border="1">
|
||||
<tr bgcolor="#eeeeee"><td>1</td><td>2</td><td>3</td><td>4</td></tr>
|
||||
<tr bgcolor="#dddddd"><td>5</td><td>6</td><td>7</td><td>8</td></tr>
|
||||
<tr bgcolor="#eeeeee"><td>9</td><td> </td><td> </td><td> </td></tr>
|
||||
</table>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.mailto">
|
||||
<title>mailto</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>address</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>l'indirizzo e-mail</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>text</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>il testo da visualizzare sul link; il default
|
||||
<20> l'indirizzo e-mail</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>encode</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>none</emphasis></entry>
|
||||
<entry>Come codificare l'indirizzo. Pu<50> essere
|
||||
<literal>none</literal>, <literal>hex</literal> o
|
||||
<literal>javascript</literal>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cc</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>indirizzi e-mail da mettere 'per conoscenza'.
|
||||
Separateli con una virgola.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>bcc</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>indirizzi e-mail da mettere 'in copia nascosta'.
|
||||
Separateli con una virgola.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>subject</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>oggetto della e-mail.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>newsgroups</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>newsgroups a cui scrivere. Separateli con una virgola.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>followupto</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>indirizzi per il follow up to. Separateli con una virgola.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>extra</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>qualsiasi informazione ulteriore che vogliate passare
|
||||
al link, ad esempio classi per i fogli di stile</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
La funzione mailto automatizza la creazione di link mailto e,
|
||||
opzionalmente, li codifica. Codificare gli indirizzi e-mail
|
||||
rende pi<70> difficile per i web spider raccoglierli dal vostro sito.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
javascript <20> probabilmente il metodo pi<70> completo di
|
||||
codifica, ma potete usare anche la codifica esadecimale.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>mailto</title>
|
||||
<programlisting>
|
||||
{mailto address="me@example.com"}
|
||||
{mailto address="me@example.com" text="send me some mail"}
|
||||
{mailto address="me@example.com" encode="javascript"}
|
||||
{mailto address="me@example.com" encode="hex"}
|
||||
{mailto address="me@example.com" subject="Hello to you!"}
|
||||
{mailto address="me@example.com" cc="you@example.com,they@example.com"}
|
||||
{mailto address="me@example.com" extra='class="email"'}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
<a href="mailto:me@example.com" >me@domain.com</a>
|
||||
<a href="mailto:me@example.com" >send me some mail</a>
|
||||
<script type="text/javascript" language="javascript">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6
|
||||
9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%
|
||||
61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e
|
||||
%27%29%3b'))</script>
|
||||
<a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" >me@domain.com</a>
|
||||
<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@domain.com</a>
|
||||
<a href="mailto:me@example.com?cc=you@domain.com%2Cthey@domain.com" >me@domain.com</a>
|
||||
<a href="mailto:me@example.com" class="email">me@domain.com</a></programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.math">
|
||||
<title>math</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>equation</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>l'equazione da eseguire</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>format</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>formato del risultato (sprintf)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>var</entry>
|
||||
<entry>numerico</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>valore di una variabile dell'equazione</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>variabile del template cui verr<72> assegnato il risultato</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>[var ...]</entry>
|
||||
<entry>numerico</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>valore di una variabile dell'equazione</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
La funzione math permette al progettista di effettuare equazioni
|
||||
matematiche nel template. Qualsiasi variabile numerica del template
|
||||
pu<70> essere utilizzata nell'equazione; il risultato verr<72> stampato
|
||||
al posto del tag. Le variabili usate nell'equazione vengono passate
|
||||
come parametri, che possono essere variabili del template o valori
|
||||
statici. +, -, /, *, abs, ceil, cos, exp, floor, log, log10, max,
|
||||
min, pi, pow, rand, round, sin, sqrt, srans e tan sono tutti operatori
|
||||
validi. Controllate la documentazione di PHP per ulteriori informazioni
|
||||
su queste funzioni matematiche.
|
||||
</para>
|
||||
<para>
|
||||
Se fornite lo speciale attributo "assign", l'output della
|
||||
funzione verr<72> assegnato a questa variabile del template,
|
||||
invece di essere stampato in output.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
math <20> una funzione costosa in termini di prestazioni, a
|
||||
causa dell'uso che fa della funzione php eval(). Fare i
|
||||
calcoli matematici in PHP <20> molto pi<70> efficiente, quindi,
|
||||
quando possibile, fate i calcoli in PHP ed assegnate i
|
||||
risultati al template. Evitate decisamente chiamate
|
||||
ripetitive alla funzione math, ad esempio in cicli section.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>math</title>
|
||||
<programlisting>
|
||||
{* $height=4, $width=5 *}
|
||||
|
||||
{math equation="x + y" x=$height y=$width}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
9
|
||||
|
||||
|
||||
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
|
||||
|
||||
{math equation="height * width / division"
|
||||
height=$row_height
|
||||
width=$row_width
|
||||
division=#col_div#}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
100
|
||||
|
||||
|
||||
{* potete usare le parentesi *}
|
||||
|
||||
{math equation="(( x + y ) / z )" x=2 y=10 z=2}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
6
|
||||
|
||||
|
||||
{* potete indicare un parametro format in formato sprintf *}
|
||||
|
||||
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
9.44</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.popup.init">
|
||||
<title>popup_init</title>
|
||||
<para>
|
||||
popup <20> un'integrazione di overLib, una libreria usata per
|
||||
le finestre popup. Tali finestre (si tratta di finestre interne
|
||||
al documento, non finestre di programma come quelle che si aprono
|
||||
con "javascript:window.open...") si usano per informazioni
|
||||
relative al contesto, ad esempio aiuto o suggerimenti.
|
||||
popup_init deve essere chiamata una volta all'inizio di ogni
|
||||
pagina in cui pensate di utilizzare la funzione <link
|
||||
linkend="language.function.popup">popup</link>. overLib <20> stata
|
||||
scritta da Erik Bosrup, e la sua homepage si trova all'indirizzo
|
||||
http://www.bosrup.com/web/overlib/.
|
||||
</para>
|
||||
<para>
|
||||
A partire dalla versione di Smarty 2.1.2, overLib NON fa pi<70>
|
||||
parte della release. Quindi scaricate overLib, piazzate il file
|
||||
overlib.js sotto la vostra document root e indicate il percorso
|
||||
relativo a questo file come parametro "src" di popup_init.
|
||||
</para>
|
||||
<example>
|
||||
<title>popup_init</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* popup_init deve essere chiamata una volta in cima alla pagina *}
|
||||
{popup_init src="/javascripts/overlib.js"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,428 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.popup">
|
||||
<title>popup</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>text</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>s<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>testo o codice html da visualizzare nel popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>trigger</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>mo</entry>
|
||||
<entry><emphasis>onMouseOver</emphasis></entry>
|
||||
<entry>evento usato per attivare il popup. Pu<50> essere
|
||||
onMouseOver oppure onClick</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>sticky</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>fa s<> che il popup rimanga visibile fino a quando non viene chiuso</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>caption</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta il titolo del popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>fgcolor</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>colore dell'interno del popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>bgcolor</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>colore del bordo del popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>textcolor</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>colore del testo del popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>capcolor</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>colore del titolo del popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>closecolor</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>mo</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>colore del link di chiusura</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>textfont</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>carattere del testo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>captionfont</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>carattere del titolo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>closefont</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>mo</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>carattere del link di chiusura</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>textsize</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>dimensione del carattere del testo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>captionsize</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>dimensione del carattere del titolo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>closesize</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>dimensione del carattere del link di chiusura</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>width</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>larghezza del box</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>height</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>altezza del box</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>left</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>posiziona il popup a sinistra del mouse</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>right</entry>
|
||||
<entry>booleanp</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>posiziona il popup a destra del mouse</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>center</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>posiziona il popup centrato rispetto al mouse</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>above</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>posiziona il popup al di sopra del mouse. NOTA: possibile
|
||||
solo se <20> stata impostata l'altezza</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>below</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>posiziona il popup al di sotto del mouse</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>border</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>rende il bordo del popup pi<70> grosso o pi<70> sottile</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>offsetx</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>distanza orizzontale del popup rispetto al mouse</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>offsety</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>distanza verticale del popup rispetto al mouse</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>fgbackground</entry>
|
||||
<entry>url di un'immagine</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>definisce un'immagine da usare invece del colore di
|
||||
sfondo nel popup.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>bgbackground</entry>
|
||||
<entry>url di un'immagine</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>definisce un'immagine da usare invece del colore per
|
||||
il bordo del popup. NOTA: dovete impostare il bgcolor a "",
|
||||
altrimenti il colore si vedr<64> comunque. NOTA: quando <20>
|
||||
presente un link di chiusura, Netscape ridisegner<65> le
|
||||
celle della tabella, rendendo la visualizzazione
|
||||
non corretta</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>closetext</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta un testo come link di chiusura invece di "Close"</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>noclose</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>non mostra il link di chiusura sui popup "sticky"
|
||||
con un titolo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>status</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta il testo sulla barra di stato del browser</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>autostatus</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta il testo della barra di stato uguale a quello del popup.
|
||||
NOTA: prevale sull'impostazione di status</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>autostatuscap</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta il testo della barra di stato uguale a quello del titolo.
|
||||
NOTA: prevale sull'impostazione di status e autostatus</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>inarray</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>comunica ad overLib di leggere il testo da questo indice
|
||||
dell'array ol_text, che si trova in overlib.js. Questo parametro
|
||||
pu<70> essere usato al posto di text</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>caparray</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>comunica ad overLib di leggere il titolo da
|
||||
questo indice nell'array ol_caps</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>capicon</entry>
|
||||
<entry>url</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>mostra l'immagine indicata prima del titolo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>snapx</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>aggancia il popup ad una posizione in una griglia
|
||||
orizzontale</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>snapy</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>aggancia il popup ad una posizione in una griglia
|
||||
verticale</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>fixx</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>blocca la posizione orizzontale del popup. Nota:
|
||||
prevale su qualsiasi altro posizionamento orizzontale</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>fixy</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>blocca la posizione verticale del popup. Nota:
|
||||
prevale su qualsiasi altro posizionamento verticale</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>background</entry>
|
||||
<entry>url</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta un'immagine da utilizzare al posto dello
|
||||
sfondo della tabella</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>padx</entry>
|
||||
<entry>intero,intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta un padding orizzontale sull'immagine di sfondo
|
||||
per il testo. Nota: l'attributo richiede due valori</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>pady</entry>
|
||||
<entry>intero,intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>imposta un padding verticale sull'immagine di sfondo
|
||||
per il testo. Nota: l'attributo richiede due valori</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>fullhtml</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>consente di utilizzare codice html per l'immagine di sfondo.
|
||||
Il codice html dovr<76> trovarsi nell'attributo text</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>frame</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>controlla il popup in un altro frame. Vedere la documentazione
|
||||
di overlib per maggiori informazioni su questa funzione</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>timeout</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>chiama la funzione javascript specificata e prende il
|
||||
valore restituito come testo da mostrare nel popup</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>delay</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>fa s<> che il popup si comporti come un tooltip. Verr<72>
|
||||
visualizzato solo dopo questo ritardo in millisecondi.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>hauto</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>determina automaticamente se il popup deve apparire a sinistra
|
||||
o a destra del mouse.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>vauto</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>determina automaticamente se il popup deve
|
||||
apparire sopra o sotto il mouse.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
popup si usa per creare finestre popup javascript.
|
||||
</para>
|
||||
<example>
|
||||
<title>popup</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* popup_init deve essere chiamata una volta in cima alla pagina *}
|
||||
{popup_init src="/javascripts/overlib.js"}
|
||||
|
||||
{* crea un link con un popup che appare al passaggio del mouse *}
|
||||
<a href="mypage.html" {popup text="This link takes you to my page!"}>mypage</a>
|
||||
|
||||
{* potete usare html, links, etc nel testo del popup *}
|
||||
<a href="mypage.html" {popup sticky=true caption="mypage contents"
|
||||
text="<ul><li>links</li><li>pages</li><li>images</li></ul>" snapx=10
|
||||
snapy=10}>mypage</a>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,254 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.function.textformat">
|
||||
<title>textformat</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome Attributo</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>style</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>stile predefinito</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>indent</entry>
|
||||
<entry>numero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>0</emphasis></entry>
|
||||
<entry>numero di caratteri da rientrare ad ogni riga</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>indent_first</entry>
|
||||
<entry>numero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>0</emphasis></entry>
|
||||
<entry>numero di caratteri da rientrare alla prima riga</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>indent_char</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>(spazio singolo)</emphasis></entry>
|
||||
<entry>carattere (o stringa di caratteri) da usare come rientro</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>wrap</entry>
|
||||
<entry>numero</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>80</emphasis></entry>
|
||||
<entry>a quanti caratteri spezzare ogni riga</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>wrap_char</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>\n</emphasis></entry>
|
||||
<entry>caratteri (o stringa di caratteri) da usare per
|
||||
spezzare le righe</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>wrap_cut</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>false</emphasis></entry>
|
||||
<entry>se vero, le righe verranno spezzate al carattere esatto
|
||||
invece che al termine di una parola</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>assign</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>no</entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>variabile del template cui assegnare l'output</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
textformat <20> una funzione di blocco usata per formattare il testo.
|
||||
Fondamentalmente rimuove spazi e caratteri speciali, e formatta
|
||||
i paragrafi spezzando le righe ad una certa lunghezza ed inserendo
|
||||
dei rientri.
|
||||
</para>
|
||||
<para>
|
||||
Potete impostare i parametri esplicitamente oppure usare uno
|
||||
stile predefinito. Attualmente "email" <20> l'unico stile disponibile.
|
||||
</para>
|
||||
<example>
|
||||
<title>textformat</title>
|
||||
<programlisting>
|
||||
{textformat wrap=40}
|
||||
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
|
||||
{/textformat}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
This is foo. This is foo. This is foo.
|
||||
This is foo. This is foo. This is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo. bar foo bar foo
|
||||
foo. bar foo bar foo foo. bar foo bar
|
||||
foo foo. bar foo bar foo foo. bar foo
|
||||
bar foo foo. bar foo bar foo foo.
|
||||
|
||||
|
||||
{textformat wrap=40 indent=4}
|
||||
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
|
||||
{/textformat}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
This is foo. This is foo. This is
|
||||
foo. This is foo. This is foo. This
|
||||
is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo. bar foo bar foo
|
||||
foo. bar foo bar foo foo. bar foo
|
||||
bar foo foo. bar foo bar foo foo.
|
||||
bar foo bar foo foo. bar foo bar
|
||||
foo foo.
|
||||
|
||||
{textformat wrap=40 indent=4 indent_first=4}
|
||||
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
|
||||
{/textformat}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
This is foo. This is foo. This
|
||||
is foo. This is foo. This is foo.
|
||||
This is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo. bar foo bar
|
||||
foo foo. bar foo bar foo foo. bar
|
||||
foo bar foo foo. bar foo bar foo
|
||||
foo. bar foo bar foo foo. bar foo
|
||||
bar foo foo.
|
||||
|
||||
{textformat style="email"}
|
||||
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
This is foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
bar foo bar foo foo.
|
||||
|
||||
{/textformat}
|
||||
|
||||
OUTPUT:
|
||||
|
||||
This is foo. This is foo. This is foo. This is foo. This is foo. This is
|
||||
foo.
|
||||
|
||||
This is bar.
|
||||
|
||||
bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo
|
||||
bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo
|
||||
foo.
|
||||
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
101
docs/it/designers/language-modifiers.xml
Normal file
101
docs/it/designers/language-modifiers.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.modifiers">
|
||||
<title>Modificatori delle variabili</title>
|
||||
<para>
|
||||
I modificatori delle variabili si possono applicare alle variabili, alle
|
||||
funzioni utente o a stringhe. Per applicare un modificatore bisogna indicare
|
||||
il valore seguito da <literal>|</literal> (pipe) e dal nome del modificatore.
|
||||
Un modificatore pu<70> accettare parametri addizionali che modificano il suo
|
||||
comportamento. Questi parametri seguono il nome del modificatore e sono
|
||||
separati da <literal>:</literal> (due punti).
|
||||
</para>
|
||||
<example>
|
||||
<title>esempio di modificatore</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* Mettere il titolo in maiuscolo *}
|
||||
<h2>{$title|upper}</h2>
|
||||
|
||||
{* Troncare il topic a 40 caratteri usando ... alla fine *}
|
||||
Topic: {$topic|truncate:40:"..."}
|
||||
|
||||
{* Formattare una stringa indicata direttamente *}
|
||||
{"now"|date_format:"%Y/%m/%d"}
|
||||
|
||||
{* Applicare un modificatore ad una funzione utente *}
|
||||
{mailto|upper address="me@domain.dom"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Se applicate un modificatore ad un array invece che ad un singolo valore,
|
||||
il modificatore verr<72> applicato ad ogni valore dell'array. Se volete che
|
||||
il modificatore lavori sull'intero array considerandolo un valore unico,
|
||||
dovete premettere al nome del modificatore un simbolo <literal>@</literal>,
|
||||
cos<6F>: <literal>{$articleTitle|@count}</literal> (questo stampa il numero
|
||||
di elementi nell'array $articleTitle).
|
||||
</para>
|
||||
<para>
|
||||
I modificatori possono essere autocaricati dalla <link
|
||||
linkend="variable.plugins.dir">$plugins_dir</link> (vedere <link
|
||||
linkend="plugins.naming.conventions">Convenzioni di nomenclatura</link>)
|
||||
oppure possono essere registrati esplicitamente (vedere <link
|
||||
linkend="api.register.modifier">register_modifier</link>). Inoltre tutte
|
||||
le funzioni php possono essere usate implicitamente come modificatori.
|
||||
(L'esempio <literal>@count</literal> visto sopra usa in realt<6C> la funzione
|
||||
php count e non un modificatore di Smarty). L'uso delle funzioni php
|
||||
come modificatori porta con s<> due piccoli trabocchetti: Primo: A volte
|
||||
l'ordine dei parametri delle funzioni non <20> quello desiderato
|
||||
(<literal>{"%2.f"|sprintf:$float}</literal> funziona, ma non <20> molto
|
||||
intuitivo. Pi<50> facile <20> <literal>{$float|string_format:"%2.f"}</literal>,
|
||||
che <20> fornito da Smarty). Secondo: con <link linkend="variable.security">$security</link>
|
||||
attivato, tutte le funzioni php che si vogliono usare come modificatori
|
||||
devono essere dichiarate affidabili nell'array <link linkend="variable.security.settings">
|
||||
$security_settings['MODIFIER_FUNCS']</link>.
|
||||
</para>
|
||||
|
||||
&designers.language-modifiers.language-modifier-capitalize;
|
||||
&designers.language-modifiers.language-modifier-count-characters;
|
||||
&designers.language-modifiers.language-modifier-cat;
|
||||
&designers.language-modifiers.language-modifier-count-paragraphs;
|
||||
&designers.language-modifiers.language-modifier-count-sentences;
|
||||
&designers.language-modifiers.language-modifier-count-words;
|
||||
&designers.language-modifiers.language-modifier-date-format;
|
||||
&designers.language-modifiers.language-modifier-default;
|
||||
&designers.language-modifiers.language-modifier-escape;
|
||||
&designers.language-modifiers.language-modifier-indent;
|
||||
&designers.language-modifiers.language-modifier-lower;
|
||||
&designers.language-modifiers.language-modifier-nl2br;
|
||||
&designers.language-modifiers.language-modifier-regex-replace;
|
||||
&designers.language-modifiers.language-modifier-replace;
|
||||
&designers.language-modifiers.language-modifier-spacify;
|
||||
&designers.language-modifiers.language-modifier-string-format;
|
||||
&designers.language-modifiers.language-modifier-strip;
|
||||
&designers.language-modifiers.language-modifier-strip-tags;
|
||||
&designers.language-modifiers.language-modifier-truncate;
|
||||
&designers.language-modifiers.language-modifier-upper;
|
||||
&designers.language-modifiers.language-modifier-wordwrap;
|
||||
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.capitalize">
|
||||
<title>capitalize</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>No</entry>
|
||||
<entry>false</entry>
|
||||
<entry>Stabilisce se le parole contenenti cifre verranno
|
||||
trasformate in maiuscolo</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Si usa per mettere in maiuscolo la prima lettera di tutte le parole nella variabile.
|
||||
</para>
|
||||
<example>
|
||||
<title>capitalize</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|capitalize}
|
||||
{$articleTitle|capitalize:true}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
next x-men film, x3, delayed.
|
||||
Next X-Men Film, x3, Delayed.
|
||||
Next X-Men Film, X3, Delayed.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.cat">
|
||||
<title>cat</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="cat" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>Valore che viene concatenato alla variabile.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Questo valore viene concatenato alla variabile data.
|
||||
</para>
|
||||
<example>
|
||||
<title>cat</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Psychics predict world didn't end");
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle|cat:" yesterday."}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Psychics predict world didn't end yesterday.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.count.characters">
|
||||
<title>count_characters</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>No</entry>
|
||||
<entry>false</entry>
|
||||
<entry>Stabilisce se gli spazi devono essere inclusi nel conteggio.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
E' usato per contare il numero di caratteri contenuti in una variabile.
|
||||
</para>
|
||||
<example>
|
||||
<title>count_characters</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|count_characters}
|
||||
{$articleTitle|count_characters:true}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Cold Wave Linked to Temperatures.
|
||||
29
|
||||
33
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.count.paragraphs">
|
||||
<title>count_paragraphs</title>
|
||||
<para>
|
||||
Si usa per contare il numero di paragrafi contenuti in una variabile.
|
||||
</para>
|
||||
<example>
|
||||
<title>count_paragraphs</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "War Dims Hope for Peace. Child's Death Ruins
|
||||
Couple's Holiday.\n\nMan is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.");
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|count_paragraphs}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.
|
||||
|
||||
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
|
||||
2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.count.sentences">
|
||||
<title>count_sentences</title>
|
||||
<para>
|
||||
E' usato per contare il numero di frasi contenute in una variabile.
|
||||
</para>
|
||||
<example>
|
||||
<title>count_sentences</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|count_sentences}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
|
||||
2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.count.words">
|
||||
<title>count_words</title>
|
||||
<para>
|
||||
E' usato per contare il numero di parole contenute in una variabile.
|
||||
</para>
|
||||
<example>
|
||||
<title>count_words</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|count_words}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Dealers Will Hear Car Talk at Noon.
|
||||
7
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,234 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.date.format">
|
||||
<title>date_format</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry>%b %e, %Y</entry>
|
||||
<entry>E' il formato per la data in output.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry>nessuno</entry>
|
||||
<entry>E' la data di default se la variabile in input <20> vuota.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Questo modificatore formatta una data e un'ora nel formato dato di
|
||||
strftime(). Le date possono essere passate a Smarty come timestamp Unix,
|
||||
timestamp MySql o una qualsiasi stringa contenente mese giorno anno
|
||||
(riconoscibile da strtotime). I progettisti quindi possono usare
|
||||
date_format per avere il pieno controllo della formattazione della data.
|
||||
Se la data passata a date_format <20> vuota ed <20> presente un secondo parametro,
|
||||
verr<72> usato questo come data da formattare.
|
||||
</para>
|
||||
<example>
|
||||
<title>date_format</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('yesterday', strtotime('-1 day'));
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$smarty.now|date_format}
|
||||
{$smarty.now|date_format:"%A, %B %e, %Y"}
|
||||
{$smarty.now|date_format:"%H:%M:%S"}
|
||||
{$yesterday|date_format}
|
||||
{$yesterday|date_format:"%A, %B %e, %Y"}
|
||||
{$yesterday|date_format:"%H:%M:%S"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Feb 6, 2001
|
||||
Tuesday, February 6, 2001
|
||||
14:33:00
|
||||
Feb 5, 2001
|
||||
Monday, February 5, 2001
|
||||
14:33:00
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
Parametri di conversione di date_format:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
%a - nome abbreviato del giorno della settimana in base all'impostazione di "locale"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%A - nome intero del giorno della settimana in base all'impostazione di "locale"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%b - nome abbreviato del mese in base all'impostazione di "locale"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%B - nome intero del mese in base all'impostazione di "locale"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%c - rappresentazione preferita di ora e data in base all'impostazione di "locale"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%C - numero del secolo (l'anno diviso per 100 e troncato ad intero, range da 00 a 99)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%d - giorno del mese come numero decimale (range da 00 a 31)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%D - corrisponde a %m/%d/%y
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%e - giorno del mese come numero decimale; la cifra singola <20> preceduta da uno spazio (range da 1 a 31)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%g - anno in base alle settimane, su due cifre [00,99]
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%G - anno in base alle settimane, su quattro cifre [0000,9999]
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%h - corrisponde a %b
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%H - ora come numero decimale, su 24 ore (range da 00 a 23)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%I - ora come numero decimale, su 12 ore (range da 01 a 12)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%j - giorno dell'anno come numero decimale (range da 001 a 366)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%k - ora (su 24 ore) con le cifre singole precedute da spazio (range da 0 a 23)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%l - ora (su 12 ore) con le cifre singole precedute da spazio (range da 1 a 12)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%m - mese come numero decimale (range da 01 a 12)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%M - minuto come numero decimale
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%n - carattere di "a capo"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%p - `am' o `pm' (antimeridiane o postmeridiane) in base all'ora, o valore corrispondente in base all'impostazione di "locale"
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%r - ora completa nella notazione con a.m. e p.m.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%R - ora completa nella notazione su 24 ore
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%S - secondi come numero decimale
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%t - carattere di tabulazione
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%T - ora corrente, con formato equivalente a %H:%M:%S
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%u - giorno della settimana come numero decimale [1,7], in cui 1 rappresenta Luned<65>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%U - numero della settimana nell'anno come numero decimale, partendo dalla prima Domenica come primo giorno della prima settimana
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%V - Il numero della settimana ISO 8601:1988 come numero decimale, range da 01 a 53, dove la settimana 1 <20> la prima ad avere almeno 4 giorni nell'anno, e Luned<65> <20> il primo giorno della settimana.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%w - giorno della settimana come numero decimale, dove la Domenica <20> 0
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%W - numero della settimana nell'anno come numero decimale, partendo dal primo luned<65> come primo giorno della prima settimana
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%x - rappresentazione preferita della data secondo l'impostazione di "locale", senza l'ora
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%X - rappresentazione preferita dell'ora secondo l'impostazione di "locale", senza data
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%y - anno come numero decimale su due cifre (range da 00 a 99)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%Y - anno come numero decimale su quattro cifre
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%Z - time zone o nome o abbreviazione
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%% - il carattere `%'
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
<note>
|
||||
<title>Nota per i programmatori</title>
|
||||
<para>
|
||||
date_format <20> fondamentalmente un involucro per la funzione PHP strftime().
|
||||
Potete avere disponibili pi<70> o meno specificatori di conversione, in base
|
||||
alla funzione strftime() del sistema su cui PHP <20> stato compilato. Controllate
|
||||
le pagine di manuale del vostro sistema per una lista completa degli
|
||||
specificatori validi.
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.default">
|
||||
<title>default</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>vuoto</emphasis></entry>
|
||||
<entry>E' il valore di default da stampare se la variabile <20> vuota.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
E' usato per impostare un valore di default per una variabile. Se la
|
||||
variabile <20> vuota o non impostata, il valore di default viene stampato
|
||||
al suo posto. Prende un parametro.
|
||||
</para>
|
||||
<example>
|
||||
<title>default</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle|default:"no title"}
|
||||
{$myTitle|default:"no title"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Dealers Will Hear Car Talk at Noon.
|
||||
no title
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.escape">
|
||||
<title>escape</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="6">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="possible" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Valori possibili</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry>html,htmlall,url,quotes,hex,hexentity,javascript</entry>
|
||||
<entry>html</entry>
|
||||
<entry>E' il tipo di escape da utilizzare.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
E' usato per fare un escape di tipo html, url, su apici per una variabile
|
||||
su cui non sia gi<67> stato fatto l'escape, hex (esadecimale), hexentity o
|
||||
javascript.
|
||||
Per default viene applicato un escape di tipo html.
|
||||
</para>
|
||||
<example>
|
||||
<title>escape</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|escape}
|
||||
{$articleTitle|escape:"html"} {* escapes & " ' < > *}
|
||||
{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
|
||||
{$articleTitle|escape:"url"}
|
||||
{$articleTitle|escape:"quotes"}
|
||||
<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||
'Stiff Opposition Expected to Casketless Funeral Plan'
|
||||
%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27
|
||||
\'Stiff Opposition Expected to Casketless Funeral Plan\'
|
||||
<a href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob@me.net</a>
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.indent">
|
||||
<title>indent</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>No</entry>
|
||||
<entry>4</entry>
|
||||
<entry>Stabilisce di quanti caratteri deve essere l'indentazione.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry>(uno spazio)</entry>
|
||||
<entry>Questo <20> il carattere usato per l'indentazione.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Questo modificatore effettua un'indentazione della stringa ad ogni riga, per
|
||||
default di 4 caratteri. Come parametro opzionale si pu<70> specificare di quanti
|
||||
caratteri deve essere l'indentazione. Si pu<70> indicare anche, come secondo
|
||||
parametro opzionale, quale carattere usare per l'indentazione (usare "\t"
|
||||
per il tabulatore).
|
||||
</para>
|
||||
<example>
|
||||
<title>indent</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.
|
||||
Sun or rain expected today, dark tonight.
|
||||
Statistics show that teen pregnancy drops off significantly after 25.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
|
||||
{$articleTitle|indent}
|
||||
|
||||
{$articleTitle|indent:10}
|
||||
|
||||
{$articleTitle|indent:1:"\t"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
NJ judge to rule on nude beach.
|
||||
Sun or rain expected today, dark tonight.
|
||||
Statistics show that teen pregnancy drops off significantly after 25.
|
||||
|
||||
NJ judge to rule on nude beach.
|
||||
Sun or rain expected today, dark tonight.
|
||||
Statistics show that teen pregnancy drops off significantly after 25.
|
||||
|
||||
NJ judge to rule on nude beach.
|
||||
Sun or rain expected today, dark tonight.
|
||||
Statistics show that teen pregnancy drops off significantly after 25.
|
||||
|
||||
NJ judge to rule on nude beach.
|
||||
Sun or rain expected today, dark tonight.
|
||||
Statistics show that teen pregnancy drops off significantly after 25.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.lower">
|
||||
<title>lower</title>
|
||||
<para>
|
||||
Si usa per trasformare una variabile in lettere minuscole.
|
||||
</para>
|
||||
<example>
|
||||
<title>lower</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|lower}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Two Convicts Evade Noose, Jury Hung.
|
||||
two convicts evade noose, jury hung.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.nl2br">
|
||||
<title>nl2br</title>
|
||||
<para>
|
||||
Tutti i caratteri di interruzione di linea verranno convertiti in tag
|
||||
<br /> nella variabile data. E' equivalente alla funzione PHP
|
||||
nl2br().
|
||||
</para>
|
||||
<example>
|
||||
<title>nl2br</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle|nl2br}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Sun or rain expected<br />today, dark tonight
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.regex.replace">
|
||||
<title>regex_replace</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>S<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>E' l'espressione regolare da sostituire.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>S<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>E' la stringa di testo da usare per la sostituzione.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Un 'trova e sostituisci' di una espressione regolare su una variabile.
|
||||
Usare la sintassi per preg_replace() dal manuale PHP.
|
||||
</para>
|
||||
<example>
|
||||
<title>regex_replace</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* sostituisce i carriage return, i tab e gli a capo con uno spazio *}
|
||||
|
||||
{$articleTitle}
|
||||
{$articleTitle|regex_replace:"/[\r\t\n]/":" "}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Infertility unlikely to
|
||||
be passed on, experts say.
|
||||
Infertility unlikely to be passed on, experts say.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.replace">
|
||||
<title>replace</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>S<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>E' la stringa di testo da sostituire.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>S<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>E' la stringa di testo da usare per la sostituzione.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Una semplice ricerca e sostituzione su una variabile.
|
||||
</para>
|
||||
<example>
|
||||
<title>replace</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|replace:"Garden":"Vineyard"}
|
||||
{$articleTitle|replace:" ":" "}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Child's Stool Great for Use in Garden.
|
||||
Child's Stool Great for Use in Vineyard.
|
||||
Child's Stool Great for Use in Garden.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.spacify">
|
||||
<title>spacify</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>uno spazio</emphasis></entry>
|
||||
<entry>E' ci<63> che viene inserito fra i caratteri della variabile.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
spacify <20> un modo per inserire uno spazio fra tutti i caratteri di una variabile.
|
||||
E' possibile, opzionalmente, passare un diverso carattere (o stringa) da inserire.
|
||||
</para>
|
||||
<example>
|
||||
<title>spacify</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|spacify}
|
||||
{$articleTitle|spacify:"^^"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Something Went Wrong in Jet Crash, Experts Say.
|
||||
S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
|
||||
S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.string.format">
|
||||
<title>string_format</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>S<EFBFBD></entry>
|
||||
<entry><emphasis>nessuno</emphasis></entry>
|
||||
<entry>E' il formato da usare. (sprintf)</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Questo <20> un modo di formattare stringhe, ad esempio per i numeri
|
||||
decimali e altro. Utilizzare la sintassi della funzione PHP sprintf().
|
||||
</para>
|
||||
<example>
|
||||
<title>string_format</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('number', 23.5787446);
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$number}
|
||||
{$number|string_format:"%.2f"}
|
||||
{$number|string_format:"%d"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
23.5787446
|
||||
23.58
|
||||
24
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.strip.tags">
|
||||
<title>strip_tags</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>No</entry>
|
||||
<entry>true</entry>
|
||||
<entry>Stabilisce se i tag saranno sostituiti con ' ' (true) o con '' (false)</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Questo elimina i tag di markup, cio<69> fondamentalmente qualsiasi cosa compresa
|
||||
fra < and >.
|
||||
</para>
|
||||
<example>
|
||||
<title>strip_tags</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New
|
||||
Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|strip_tags} {* equivale a {$articleTitle|strip_tags:true} *}
|
||||
{$articleTitle|strip_tags:false}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.
|
||||
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years .
|
||||
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.strip">
|
||||
<title>strip</title>
|
||||
<para>
|
||||
Sostituisce tutte le sequenze di spazi, a capo e tabulatori con
|
||||
un singolo spazio o con la stringa fornita.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota</title>
|
||||
<para>
|
||||
Se volete fare lo strip su blocchi di testo del template, usate
|
||||
la <link linkend="language.function.strip">funzione strip</link>.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>strip</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Grandmother of\neight makes\t hole in one.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|strip}
|
||||
{$articleTitle|strip:" "}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Grandmother of
|
||||
eight makes hole in one.
|
||||
Grandmother of eight makes hole in one.
|
||||
Grandmother of eight makes hole in one.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.truncate">
|
||||
<title>truncate</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>No</entry>
|
||||
<entry>80</entry>
|
||||
<entry>Stabilisce a quanti caratteri effettuare il troncamento.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry>...</entry>
|
||||
<entry>Testo da aggiungere in fondo quando c'<27> troncamento.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>3</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>No</entry>
|
||||
<entry>false</entry>
|
||||
<entry>Stabilisce se troncare dopo una parola (false), o al carattere
|
||||
esatto (true).</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Effettua il troncamento di una variabile ad un certo numero di caratteri,
|
||||
per default 80. Come secondo parametro opzionale potete specificare una
|
||||
stringa di testo da mostrare alla fine se la variabile <20> stata troncata.
|
||||
Questi caratteri non vengono conteggiati nella lunghezza della
|
||||
stringa troncata. Per default, truncate cercher<65> di tagliare la stringa al
|
||||
termine di una parola. Se invece volete effettuare il troncamento alla
|
||||
lunghezza esatta in caratteri, passate il terzo parametro opzionale come true.
|
||||
</para>
|
||||
<example>
|
||||
<title>truncate</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|truncate}
|
||||
{$articleTitle|truncate:30}
|
||||
{$articleTitle|truncate:30:""}
|
||||
{$articleTitle|truncate:30:"---"}
|
||||
{$articleTitle|truncate:30:"":true}
|
||||
{$articleTitle|truncate:30:"...":true}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Two Sisters Reunite after Eighteen Years at Checkout Counter.
|
||||
Two Sisters Reunite after Eighteen Years at Checkout Counter.
|
||||
Two Sisters Reunite after...
|
||||
Two Sisters Reunite after
|
||||
Two Sisters Reunite after---
|
||||
Two Sisters Reunite after Eigh
|
||||
Two Sisters Reunite after E...
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.upper">
|
||||
<title>upper</title>
|
||||
<para>
|
||||
Si usa per trasformare una variabile in maiuscolo.
|
||||
</para>
|
||||
<example>
|
||||
<title>upper</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
{$articleTitle|upper}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
If Strike isn't Settled Quickly it may Last a While.
|
||||
IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.modifier.wordwrap">
|
||||
<title>wordwrap</title>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
<colspec colname="type" align="center" />
|
||||
<colspec colname="required" align="center" />
|
||||
<colspec colname="default" align="center" />
|
||||
<colspec colname="desc"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Posizione del Parametro</entry>
|
||||
<entry>Tipo</entry>
|
||||
<entry>Obbligatorio</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Descrizione</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>1</entry>
|
||||
<entry>intero</entry>
|
||||
<entry>No</entry>
|
||||
<entry>80</entry>
|
||||
<entry>Stabilisce la larghezza della colonna.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>2</entry>
|
||||
<entry>stringa</entry>
|
||||
<entry>No</entry>
|
||||
<entry>\n</entry>
|
||||
<entry>Questa <20> la stringa usata per andare a capo.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>3</entry>
|
||||
<entry>booleano</entry>
|
||||
<entry>No</entry>
|
||||
<entry>false</entry>
|
||||
<entry>Stabilisce se andare a capo dopo una parola intera (false),
|
||||
o al carattere esatto (true).</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Dispone una stringa su pi<70> righe usando come riferimento una certa
|
||||
larghezza di colonna, per default 80. Come secondo parametro opzionale
|
||||
potete specificare una stringa da usare per separare le righe (il
|
||||
default <20> \n). Per default, wordwrap cercher<65> di andare a capo dopo
|
||||
una parola intera. Se volete che vada a capo all'esatta larghezza in
|
||||
caratteri, passate il terzo parametro opzionale come true.
|
||||
</para>
|
||||
<example>
|
||||
<title>wordwrap</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$articleTitle}
|
||||
|
||||
{$articleTitle|wordwrap:30}
|
||||
|
||||
{$articleTitle|wordwrap:20}
|
||||
|
||||
{$articleTitle|wordwrap:30:"<br />\n"}
|
||||
|
||||
{$articleTitle|wordwrap:30:"\n":true}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo stamper<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Blind woman gets new kidney from dad she hasn't seen in years.
|
||||
|
||||
Blind woman gets new kidney
|
||||
from dad she hasn't seen in
|
||||
years.
|
||||
|
||||
Blind woman gets new
|
||||
kidney from dad she
|
||||
hasn't seen in
|
||||
years.
|
||||
|
||||
Blind woman gets new kidney<br />
|
||||
from dad she hasn't seen in<br />
|
||||
years.
|
||||
|
||||
Blind woman gets new kidney
|
||||
from dad she hasn't seen in
|
||||
years.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
51
docs/it/designers/language-variables.xml
Normal file
51
docs/it/designers/language-variables.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.variables">
|
||||
<title>Variabili</title>
|
||||
<para>
|
||||
Smarty usa parecchi tipi diversi di variabili. Il tipo di variabile
|
||||
dipende da quale simbolo si usa come prefisso (o come delimitatore).
|
||||
</para>
|
||||
<para>
|
||||
In Smarty le variabili possono essere visualizzate direttamente oppure
|
||||
usate come argomenti per gli attributi e i modificatori delle funzioni,
|
||||
oppure in espressioni condizionali, ecc. Per stampare una variabile,
|
||||
<20> sufficiente includerla fra i delimitatori in modo che sia l'unica
|
||||
cosa contenuta fra essi. Esempi:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$Name}
|
||||
|
||||
{$Contacts[row].Phone}
|
||||
|
||||
<body bgcolor="{#bgcolor#}">
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
&designers.language-variables.language-assigned-variables;
|
||||
&designers.language-variables.language-config-variables;
|
||||
&designers.language-variables.language-variables-smarty;
|
||||
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.assigned.variables">
|
||||
<title>Variabili valorizzate da PHP</title>
|
||||
<para>
|
||||
Le variabili valorizzate da PHP sono referenziate facendole precedere
|
||||
da un segno di dollaro <literal>$</literal>. Anche le variabili
|
||||
valorizzate internamente al template con la funzione <link
|
||||
linkend="language.function.assign">assign</link> vengono visualizzate
|
||||
in questo modo.
|
||||
</para>
|
||||
<example>
|
||||
|
||||
<title>variabili valorizzate</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
Hello {$firstname}, glad to see you could make it.
|
||||
<br />
|
||||
Your last login was on {$lastLoginDate}.
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo visualizzer<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Hello Doug, glad to see you could make it.
|
||||
<br />
|
||||
Your last login was on January 11th, 2001.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<sect2 id="language.variables.assoc.arrays">
|
||||
<title>Array associativi</title>
|
||||
<para>
|
||||
Potete fare riferimento ad array associativi valorizzati da
|
||||
PHP specificando l'indice dopo il punto '.'
|
||||
</para>
|
||||
<example>
|
||||
<title>accesso ad array associativi</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('Contacts',
|
||||
array('fax' => '555-222-9876',
|
||||
'email' => 'zaphod@slartibartfast.com',
|
||||
'phone' => array('home' => '555-444-3333',
|
||||
'cell' => '555-111-1234')));
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
dove il contenuto di index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$Contacts.fax}<br />
|
||||
{$Contacts.email}<br />
|
||||
{* ovviamente si possono usare anche array multidimensionali *}
|
||||
{$Contacts.phone.home}<br />
|
||||
{$Contacts.phone.cell}<br />
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
questo visualizzer<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
555-222-9876<br />
|
||||
zaphod@slartibartfast.com<br />
|
||||
555-444-3333<br />
|
||||
555-111-1234<br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="language.variables.array.indexes">
|
||||
<title>Array con indici numerici</title>
|
||||
<para>
|
||||
Potete referenziare gli array con il loro indice, come in PHP.
|
||||
</para>
|
||||
<example>
|
||||
<title>accesso agli array per indice numerico</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('Contacts',
|
||||
array('555-222-9876',
|
||||
'zaphod@slartibartfast.com',
|
||||
array('555-444-3333',
|
||||
'555-111-1234')));
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
dove index.tpl <20>:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$Contacts[0]}<br />
|
||||
{$Contacts[1]}<br />
|
||||
{* anche qui si possono usare array multidimensionali *}
|
||||
{$Contacts[2][0]}<br />
|
||||
{$Contacts[2][1]}<br />
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo visualizzer<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
555-222-9876<br />
|
||||
zaphod@slartibartfast.com<br />
|
||||
555-444-3333<br />
|
||||
555-111-1234<br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="language.variables.objects">
|
||||
<title>Oggetti</title>
|
||||
<para>
|
||||
Le propriet<65> di oggetti valorizzate da PHP possono essere
|
||||
referenziate indicando il nome della propriet<65> dopo il
|
||||
simbolo '->'
|
||||
</para>
|
||||
<example>
|
||||
<title>accesso alle propriet<65> degli oggetti</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
name: {$person->name}<br />
|
||||
email: {$person->email}<br />
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo visualizzer<65>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
name: Zaphod Beeblebrox<br />
|
||||
email: zaphod@slartibartfast.com<br />
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.config.variables">
|
||||
<title>Variabili caricate da file di configurazione</title>
|
||||
<para>
|
||||
Le variabili caricate dai file di configurazione sono referenziate
|
||||
racchiudendole fra due simboli cancelletto (#), oppure attraverso
|
||||
la variabile <link
|
||||
linkend="language.variables.smarty.config">$smarty.config</link>.
|
||||
La seconda sintassi <20> utile per includerle in valori di attributi
|
||||
indicati fra virgolette.
|
||||
</para>
|
||||
<example>
|
||||
<title>variabili di configurazione</title>
|
||||
<para>
|
||||
foo.conf:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
pageTitle = "This is mine"
|
||||
bodyBgColor = "#eeeeee"
|
||||
tableBorderSize = "3"
|
||||
tableBgColor = "#bbbbbb"
|
||||
rowBgColor = "#cccccc"
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
index.tpl:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="foo.conf"}
|
||||
<html>
|
||||
<title>{#pageTitle#}</title>
|
||||
<body bgcolor="{#bodyBgColor#}">
|
||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
||||
<tr bgcolor="{#rowBgColor#}">
|
||||
<td>First</td>
|
||||
<td>Last</td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
index.tpl: (sintassi alternativa)
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="foo.conf"}
|
||||
<html>
|
||||
<title>{$smarty.config.pageTitle}</title>
|
||||
<body bgcolor="{$smarty.config.bodyBgColor}">
|
||||
<table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
|
||||
<tr bgcolor="{$smarty.config.rowBgColor}">
|
||||
<td>First</td>
|
||||
<td>Last</td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
questo <20> l'output prodotto da entrambi gli esempi:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<html>
|
||||
<title>This is mine</title>
|
||||
<body bgcolor="#eeeeee">
|
||||
<table border="3" bgcolor="#bbbbbb">
|
||||
<tr bgcolor="#cccccc">
|
||||
<td>First</td>
|
||||
<td>Last</td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
Le variabili dei file di configurazione non possono essere usate
|
||||
fino a dopo che sono state caricate dal file che le contiene.
|
||||
Questa procedura viene spiegata pi<70> avanti in questo documento,
|
||||
in <command>config_load</command>.
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.variables.smarty">
|
||||
<title>La variabile riservata {$smarty}</title>
|
||||
<para>
|
||||
La variabile riservata {$smarty} pu<70> essere usate per accedere
|
||||
a parecchie variabili speciali del template. Quella che segue
|
||||
<20> la lista completa.
|
||||
</para>
|
||||
|
||||
<sect2 id="language.variables.smarty.request">
|
||||
<title>Variabili della richiesta HTTP</title>
|
||||
<para>
|
||||
Alle variabili get, post, cookies, server,
|
||||
environment e session si pu<70> accedere come mostrato negli
|
||||
esempi qui sotto:
|
||||
</para>
|
||||
<example>
|
||||
<title>visualizzazione delle variabili request</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* visualizza il valore di "page" dall'URL (GET) http://www.example.com/index.php?page=foo *}
|
||||
{$smarty.get.page}
|
||||
|
||||
{* visualizza la variabile "page" da un modulo (POST) *}
|
||||
{$smarty.post.page}
|
||||
|
||||
{* visualizza il valore del cookie "username" *}
|
||||
{$smarty.cookies.username}
|
||||
|
||||
{* visualizza la variabile del server "SERVER_NAME" *}
|
||||
{$smarty.server.SERVER_NAME}
|
||||
|
||||
{* visualizza la variabile di ambiente "PATH" *}
|
||||
{$smarty.env.PATH}
|
||||
|
||||
{* visualizza la variabile di sessione PHP "id" *}
|
||||
{$smarty.session.id}
|
||||
|
||||
{* visualizza la variabile "username" dalla fusione di get/post/cookies/server/env *}
|
||||
{$smarty.request.username}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<note>
|
||||
<para>
|
||||
Per motivi storici si pu<70> accedere direttamente a {$SCRIPT_NAME},
|
||||
sebbene {$smarty.server.SCRIPT_NAME} sia la maniera consigliata
|
||||
per ottenere questo valore.
|
||||
</para>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="language.variables.smarty.now">
|
||||
<title>{$smarty.now}</title>
|
||||
<para>
|
||||
Si pu<70> accedere al timestamp corrente con {$smarty.now}.
|
||||
Questo numero rappresenta il numero di secondi passati dalla
|
||||
cosiddetta Epoch (1<> gennaio 1970) e pu<70> essere passato
|
||||
direttamente al modificatore date_format per la visualizzazione.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso di {$smarty.now}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* uso del modificatore date_format per mostrare data e ora attuali *}
|
||||
{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="language.variables.smarty.const">
|
||||
<title>{$smarty.const}</title>
|
||||
<para>
|
||||
Pu<50> essere usato per accedere direttamente alle costanti PHP.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso di {$smarty.const}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$smarty.const._MY_CONST_VAL}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="language.variables.smarty.capture">
|
||||
<title>{$smarty.capture}</title>
|
||||
<para>
|
||||
Si pu<70> accedere all'output catturato attraverso il costrutto
|
||||
{capture}..{/capture} con la variabile {$smarty}. Consultare
|
||||
la sezione <link linkend="language.function.capture">capture</link>
|
||||
per avere un esempio.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="language.variables.smarty.config">
|
||||
<title>{$smarty.config}</title>
|
||||
<para>
|
||||
La variabile {$smarty} pu<70> essere usata per referenziare le
|
||||
variabili di configurazione caricate. {$smarty.config.foo}
|
||||
<20> sinonimo di {#foo#}. Consultare la sezione
|
||||
<link linkend="language.function.config.load">config_load</link>
|
||||
per avere un esempio.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="language.variables.smarty.loops">
|
||||
<title>{$smarty.section}, {$smarty.foreach}</title>
|
||||
<para>
|
||||
La variabile {$smarty} pu<70> essere usata per referenziare
|
||||
le propriet<65> dei loop 'section' e 'foreach'. Vedere la documentazione
|
||||
di <link linkend="language.function.section">section</link> e
|
||||
<link linkend="language.function.foreach">foreach</link>.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="language.variables.smarty.template">
|
||||
<title>{$smarty.template}</title>
|
||||
<para>
|
||||
Questa variabile contiene il nome del template attualmente in fase di elaborazione.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="language.variables.smarty.version">
|
||||
<title>{$smarty.version}</title>
|
||||
<para>
|
||||
Questa variabile contiene la versione di Smarty con cui il template <20> stato compilato.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="language.variables.smarty.ldelim">
|
||||
<title>{$smarty.ldelim}</title>
|
||||
<para>
|
||||
Questa variabile <20> usata per stampare il delimitatore sinistro di Smarty in modo
|
||||
letterale, cio<69> senza che venga interpretato come tale. Vedere anche
|
||||
<link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="language.variables.smarty.rdelim">
|
||||
<title>{$smarty.rdelim}</title>
|
||||
<para>
|
||||
Questa variabile <20> usata per stampare il delimitatore destro di Smarty in modo
|
||||
letterale, cio<69> senza che venga interpretato come tale. Vedere anche
|
||||
<link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
532
docs/it/getting-started.xml
Normal file
532
docs/it/getting-started.xml
Normal file
@@ -0,0 +1,532 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<part id="getting.started">
|
||||
<title>Introduzione</title>
|
||||
|
||||
<chapter id="what.is.smarty">
|
||||
<title>Cos'<27> Smarty?</title>
|
||||
<para>
|
||||
Smarty <20> un motore di template per PHP. Pi<50> specificatamente, fornisce un
|
||||
modo semplice di separare la logica e il contenuto dell'applicazione dalla
|
||||
sua presentazione. Questo concetto si pu<70> comprendere meglio in una situazione
|
||||
in cui il programmatore ed il progettista dei template hanno ruoli diversi,
|
||||
o nella maggior parte dei casi non sono la stessa persona.
|
||||
</para>
|
||||
<para>
|
||||
Per esempio,
|
||||
diciamo che dovete creare una pagina web che mostra un articolo di giornale.
|
||||
Il titolo, il sommario, l'autore e il corpo dell'articolo sono gli elementi
|
||||
del contenuto: non contengono informazioni su come saranno presentati. Vengono
|
||||
passati a Smarty dall'applicazione, dopodich<63> il grafico modifica i template
|
||||
e usa una combinazione di tag HTML e tag di template per formattare la
|
||||
presentazione di questi elementi (tabelle HTML, colori di sfondo, dimensione
|
||||
dei caratteri, fogli di stile ecc.). Un giorno il programmatore ha bisogno
|
||||
di cambiare il sistema in cui viene ottenuto il contenuto dell'articolo (si
|
||||
tratta di una modifica alla logica dell'applicazione). Questa modifica non
|
||||
influisce sul lavoro del grafico, infatti il contenuto arriver<65> al template
|
||||
esattamente uguale a prima. Allo stesso modo, se il grafico vuole ridisegnare
|
||||
completamente il template, questo non richieder<65> modifica alla logica
|
||||
applicativa. Quindi, il programmatore pu<70> fare modifice alla logica senza
|
||||
bisogno di ristrutturare i template, e il grafico pu<70> modificare i template
|
||||
senza rovinare la logica dell'applicazione.
|
||||
</para>
|
||||
<para>
|
||||
Uno degli obiettivi progettuali di Smarty <20> la separazione della logica di
|
||||
business dalla logica di presentazione. Questo significa che i template possono
|
||||
contenere logica, a condizione che tale logica sia esclusivamente relativa alla
|
||||
presentazione. Cose come includere un altro template, alternare i colori delle
|
||||
righe di tabella, mostrare un dato in maiuscolo, ciclare su un array di dati
|
||||
per visualizzarli, ecc., sono tutti esempi di logica di presentazione. Questo non
|
||||
significa che Smarty forza una separazione fra la logica di business e quella di
|
||||
presentazione. Smarty non pu<70> sapere che cosa <20> una cosa e cosa <20> l'altra, per
|
||||
cui se mettete logica di business nel template sono affari vostri. Inoltre,
|
||||
se <emphasis>non volete</emphasis> alcuna logica nei template, potete
|
||||
sicuramente ottenere ci<63> riducendo il contenuto a solo testo e variabili.
|
||||
</para>
|
||||
<para>
|
||||
Uno degli aspetti caratteristici di Smarty <20> la compilazione dei template. Questo
|
||||
significa che Smarty legge i file dei template e crea script PHP a partire da
|
||||
questi. Una volta creati, questi script vengono eseguiti da quel momento in poi:
|
||||
di conseguenza si evita una costosa analisi dei template ad ogni richiesta, e
|
||||
ogni template pu<70> avvantaggiarsi pienamente di strumenti per velocizzare
|
||||
l'esecuzione come Zend Accelerator (<ulink url="&url.zend;">&url.zend;</ulink>)
|
||||
o PHP Accelerator (<ulink url="&url.php-accelerator;">&url.php-accelerator;</ulink>).
|
||||
</para>
|
||||
<para>
|
||||
Ecco alcune delle funzionalit<69> di Smarty:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
E' estremamente veloce.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
E' efficiente, perch<63> <20> l'analizzatore di PHP a fare il "lavoro sporco".
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Non c'<27> sovraccarico per l'analisi del template, che viene compilato una sola volta.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
E' abbastanza furbo da saper ricompilare solo i template che sono stati modificati.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Potete creare <link linkend="language.custom.functions">funzioni personalizzate</link>
|
||||
e <link linkend="language.modifiers">modificatori di variabili</link> personalizzati,
|
||||
il che rende il linguaggio dei template estremamente estensibile.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
La sintassi dei tag di delimitazione dei template <20> configurabile: potete usare
|
||||
{}, {{}}, <!--{}-->, ecc.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
I costrutti if/elseif/else/endif vengono passati al PHP, quindi la sintassi delle
|
||||
espressioni condizionali pu<70> essere semplice o complicata a vostro piacimento.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
E' consentito nidificare in maniera illimitata sezioni, test, ecc.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
E' possibile incorporare direttamente codice PHP nei file di template, sebbene
|
||||
non dovrebbe essercene bisogno (e nemmeno <20> raccomandato), essendo il motore
|
||||
cos<6F> personalizzabile.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Supporto nativo al caching
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Scelta arbitraria dei sorgenti dei template
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Funzioni personalizzate di gestione della cache
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Architettura a plugin
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</chapter>
|
||||
<chapter id="installation">
|
||||
<title>Installazione</title>
|
||||
|
||||
<sect1 id="installation.requirements">
|
||||
<title>Requisiti</title>
|
||||
<para>
|
||||
Smarty necessita di un web server su cui gira PHP 4.0.6 o successivo.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="installing.smarty.basic">
|
||||
<title>Installazione di base</title>
|
||||
<para>
|
||||
Installate i file delle librerie di Smarty che si trovano nella directory
|
||||
/libs/ della distribuzione. Questi sono i file PHP che NON DOVETE modificare.
|
||||
Sono condivisi da tutte le applicazioni e vengono modificati solo quando
|
||||
passate ad una nuova versione di Smarty.
|
||||
</para>
|
||||
<example>
|
||||
<title>File delle librerie di Smarty</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Smarty.class.php
|
||||
Smarty_Compiler.class.php
|
||||
Config_File.class.php
|
||||
debug.tpl
|
||||
/internals/*.php (tutti)
|
||||
/plugins/*.php (tutti)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
Smarty usa una costante PHP chiamata <link
|
||||
linkend="constant.smarty.dir">SMARTY_DIR</link> che contiene il path di sistema
|
||||
della directory delle librerie di Smarty. Fondamentalmente, se la vostra applicazione
|
||||
<20> in grado di trovare il file <filename>Smarty.class.php</filename>, non avete bisogno
|
||||
di impostare SMARTY_DIR, in quanto Smarty la trover<65> da solo. Tuttavia, se
|
||||
<filename>Smarty.class.php</filename> non si trova nel vostro include_path, o se non
|
||||
fornite alla vostra applicazione un percorso assoluto per questo file, allora dovete
|
||||
definire manualmente SMARTY_DIR. La costante SMARTY_DIR <emphasis>deve</emphasis>
|
||||
contenere uno slash (/) finale.
|
||||
</para>
|
||||
<para>
|
||||
Ecco come creerete un'istanza di Smarty nei vostri script PHP:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Creazione di un'istanza di Smarty</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Provate a lanciare lo script qui sopra. Se ricevete un errore che dice che
|
||||
il file <filename>Smarty.class.php</filename> non si trova, dovete fare una
|
||||
delle cose seguenti:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Fornire un percorso assoluto al file delle librerie</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
require('/usr/local/lib/php/Smarty/Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Aggiungere la directory della libreria all'include_path di PHP</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Modificate il file php.ini, aggiungete la directory delle
|
||||
// librerie di Smarty all'include_path e riavviate il server web.
|
||||
// A questo punto il codice seguente dovrebbe funzionare:
|
||||
require('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Impostare manualmente la costante SMARTY_DIR</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
define('SMARTY_DIR', '/usr/local/lib/php/Smarty/');
|
||||
require(SMARTY_DIR . 'Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Ora che i file delle librerie sono al loro posto, <20> ora di impostare le
|
||||
directory di Smarty per la vostra applicazione. Smarty necessita di quattro
|
||||
directory chiamate (per default) <filename class="directory">templates</filename>,
|
||||
<filename class="directory">templates_c</filename>, <filename
|
||||
class="directory">configs</filename> e <filename class="directory">cache</filename>.
|
||||
Ciascuna di queste <20> definibile dalle propriet<65>
|
||||
della classe Smarty <varname>$template_dir</varname>,
|
||||
<varname>$compile_dir</varname>, <varname>$config_dir</varname>, e
|
||||
<varname>$cache_dir</varname> rispettivamente. E' altamente raccomandato
|
||||
impostare un insieme separato di queste directory per ogni applicazione che
|
||||
user<65> Smarty.
|
||||
</para>
|
||||
<para>
|
||||
Assicuratevi di conoscere il percorso della document root del vostro web
|
||||
server. Nel nostro esempio, la document root <20> <filename
|
||||
class="directory">/web/www.mydomain.com/docs/</filename>.
|
||||
Le directory di Smarty vengono accedute solo dalle librerie di Smarty e mai
|
||||
direttamente dal browser. Tuttavia, per evitare problemi di sicurezza, si
|
||||
raccomanda di mettere queste directory <emphasis>al di fuori</emphasis> della
|
||||
document root.
|
||||
</para>
|
||||
<para>
|
||||
Per la nostra installazione di esempio, imposteremo l'ambiente di Smarty per
|
||||
una applicazione di guest book. Abbiamo scelto un'applicazione al solo scopo
|
||||
di avere una convenzione per il nome delle directory. Potete usare lo stesso
|
||||
ambiente per qualsiasi applicazione, soltanto sostituendo "guestbook" con il
|
||||
nome della vostra applicazione. Metteremo le nostre directory di Smarty sotto
|
||||
<filename class="directory">/web/www.mydomain.com/smarty/guestbook/</filename>.
|
||||
</para>
|
||||
<para>
|
||||
Avrete bisogno di almeno un file sotto la document root, e quello sar<61> lo script
|
||||
a cui pu<70> accedere ilbrowser. Lo chiameremo <filename>index.php</filename>,
|
||||
e lo metteremo in una sottodirectory della document root chiamata <filename
|
||||
class="directory">/guestbook/</filename>.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Conviene impostare il web server in modo che "index.php" possa essere identificato
|
||||
come indice di default della directory, cos<6F> se provate a richiedere
|
||||
"http://www.example.com/guestbook/", lo script index.php verr<72> eseguito senza
|
||||
"index.php" nell'URL. In Apache questo pu<70> essere impostato aggiungendo
|
||||
"index.php" alla fine dell'impostazione DirectoryIndex (le voci vanno separate
|
||||
con uno spazio l'una dall'altra).
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Diamo un'occhiata alla struttura dei file fino ad ora:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Esempio di struttura dei file</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/usr/local/lib/php/Smarty/Smarty.class.php
|
||||
/usr/local/lib/php/Smarty/Smarty_Compiler.class.php
|
||||
/usr/local/lib/php/Smarty/Config_File.class.php
|
||||
/usr/local/lib/php/Smarty/debug.tpl
|
||||
/usr/local/lib/php/Smarty/internals/*.php
|
||||
/usr/local/lib/php/Smarty/plugins/*.php
|
||||
|
||||
/web/www.example.com/smarty/guestbook/templates/
|
||||
/web/www.example.com/smarty/guestbook/templates_c/
|
||||
/web/www.example.com/smarty/guestbook/configs/
|
||||
/web/www.example.com/smarty/guestbook/cache/
|
||||
|
||||
/web/www.example.com/docs/guestbook/index.php
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Smarty necessita del diritto di scrittura su <emphasis>$compile_dir</emphasis> e su
|
||||
<emphasis>$cache_dir</emphasis>, quindi assicuratevi che l'utente del web
|
||||
server possa scriverci sopra. Di solito si tratta dell'utente "nobody" e
|
||||
gruppo "nobody". Per utenti di OS X, il default <20> utente "www" e gruppo "www".
|
||||
Se usate Apache, potete guardare nel file httpd.conf (di solito in
|
||||
"/usr/local/apache/conf/") per vedere quale utente e gruppo vengono usati.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Impostazione dei permessi sui file</title>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
chown nobody:nobody /web/www.example.com/smarty/guestbook/templates_c/
|
||||
chmod 770 /web/www.example.com/smarty/guestbook/templates_c/
|
||||
|
||||
chown nobody:nobody /web/www.example.com/smarty/guestbook/cache/
|
||||
chmod 770 /web/www.example.com/smarty/guestbook/cache/
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
chmod 770 vi garantisce una notevole sicurezza, in quanto consente solo
|
||||
all'utente e al gruppo "nobody" l'accesso in lettura/scrittura alle directory.
|
||||
Se volete consentire la lettura a chiunque (soprattutto per vostra comodit<69>,
|
||||
se volete guardare questi file), potete impostare invece 775.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Ora dobbiamo creare il file index.tpl che Smarty caricher<65>. Si trover<65> nella
|
||||
directory $template_dir.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Edit di /web/www.example.com/smarty/guestbook/templates/index.tpl</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
|
||||
{* Smarty *}
|
||||
|
||||
Hello, {$name}!
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
{* Smarty *} <20> un commento del template. Non <20> obbligatorio, ma <20> buona pratica
|
||||
iniziare tutti i file di template con questo commento. Rende semplice
|
||||
riconoscere il file, indipendentemente dalla sua estensione. Ad esempio,
|
||||
un editor di testo potrebbe riconoscere il file ed attivare una particolare
|
||||
evidenziazione della sintassi.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Ora editiamo index.php. Creeremo un'istanza di Smarty, valorizzeremo una
|
||||
variabile del template e faremo il display del file index.tpl. Nel nostro
|
||||
ambiente di esempio, "/usr/local/lib/php/Smarty" si trova nell'include_path.
|
||||
Assicuratevi che sia cos<6F> anche per voi, oppure usate percorsi assoluti.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Edit di /web/www.example.com/docs/guestbook/index.php</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// caricamento delle librerie di Smarty
|
||||
require('Smarty.class.php');
|
||||
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
|
||||
$smarty->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
|
||||
$smarty->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
|
||||
$smarty->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
|
||||
|
||||
$smarty->assign('name','Ned');
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Nell'esempio stiamo usando percorsi assoluti per tutte le directory
|
||||
di Smarty. Se <filename
|
||||
class="directory">/web/www.example.com/smarty/guestbook/</filename> fa
|
||||
parte dell'include_path di PHP, questo non <20> necessario. Comunque, <20> pi<70>
|
||||
efficiente e (per esperienza) meno soggetto ad errori usare percorsi
|
||||
assoluti. Questo vi garantisce che Smarty prenda i file dalle directory
|
||||
giuste.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Ora richiamate il file <filename>index.php</filename> dal browser.
|
||||
Dovreste vedere "Hello, Ned!"
|
||||
</para>
|
||||
<para>
|
||||
Avete completato l'installazione base di Smarty!
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="installing.smarty.extended">
|
||||
<title>Installazione avanzata</title>
|
||||
|
||||
<para>
|
||||
Questo <20> il seguito della <link
|
||||
linkend="installing.smarty.basic">installazione di base</link>, siete pregati
|
||||
di leggerla prima!
|
||||
</para>
|
||||
<para>
|
||||
Un modo leggermente pi<70> flessibile di installare Smarty <20> di estendere la
|
||||
classe e inizializzare il vostro ambiente di Smarty. Cos<6F>, invece di impostare
|
||||
ripetutamente i percorsi delle directory, riassegnare le stesse variabili ecc.,
|
||||
possiamo farlo in un unico punto.
|
||||
Creiamo una nuova directory "/php/includes/guestbook/" e un file chiamato
|
||||
<filename>setup.php</filename>. Nel nostro ambiente di esempio, "/php/includes" fa parte
|
||||
dell'include_path. Assicuratevi che sia cos<6F> anche per voi, oppure usate percorsi
|
||||
assoluti.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Edit di /php/includes/guestbook/setup.php</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// caricamento delle librerie di Smarty
|
||||
require('Smarty.class.php');
|
||||
|
||||
// Il file setup.php <20> un buon punto dal quale caricare
|
||||
// le librerie necessarie all'applicazione, quindi
|
||||
// potete farlo qui. Ad esempio:
|
||||
// require('guestbook/guestbook.lib.php');
|
||||
|
||||
class Smarty_GuestBook extends Smarty {
|
||||
|
||||
function Smarty_GuestBook()
|
||||
{
|
||||
|
||||
// Costruttore della Classe. Questi dati vengono automaticamente impostati
|
||||
// per ogni nuova istanza.
|
||||
|
||||
$this->Smarty();
|
||||
|
||||
$this->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
|
||||
$this->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
|
||||
$this->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
|
||||
$this->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
|
||||
|
||||
$this->caching = true;
|
||||
$this->assign('app_name', 'Guest Book');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Ora modifichiamo il file index.php per usare setup.php:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Edit di /web/www.example.com/docs/guestbook/index.php</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
require('guestbook/setup.php');
|
||||
|
||||
$smarty = new Smarty_GuestBook;
|
||||
|
||||
$smarty->assign('name','Ned');
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Come potete vedere, <20> molto semplice creare un'istanza di Smarty, basta usare
|
||||
Smarty_GuestBook che inizializza automaticamente tutto ci<63> che serve alla
|
||||
nostra applicazione.
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
</part>
|
||||
|
||||
<!-- 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
|
||||
-->
|
6
docs/it/language-defs.ent
Normal file
6
docs/it/language-defs.ent
Normal file
@@ -0,0 +1,6 @@
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<!ENTITY SMARTYManual "Manuale di Smarty">
|
||||
<!ENTITY SMARTYDesigners "Smarty Per Progettisti di Template">
|
||||
<!ENTITY SMARTYProgrammers "Smarty Per Programmatori">
|
||||
<!ENTITY Appendixes "Appendici">
|
23
docs/it/language-snippets.ent
Normal file
23
docs/it/language-snippets.ent
Normal file
@@ -0,0 +1,23 @@
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<!ENTITY note.parameter.merge '<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Il parametro <parameter>merge</parameter> rispetta le chiavi degli array,
|
||||
quindi se fate un merge su due array a indici numerici rischiate che alcuni
|
||||
valori vengano sovrascritti, o di avere indici in ordine non sequenziale.
|
||||
Questo comportamento <20> diverso da quello della funzione array_merge() di PHP
|
||||
che elimina le chiavi numeriche ed effettua una rinumerazione.
|
||||
</para>
|
||||
</note>'>
|
||||
|
||||
<!ENTITY parameter.compileid '<para>
|
||||
Come terzo parametro opzionale, potete passare un <parameter>compile_id</parameter>.
|
||||
Questo nel caso in cui vogliate compilare versioni diverse dello stesso template,
|
||||
oppure avere template diversi per lingue diverse. Un altro uso di compile_id
|
||||
<20> quando usate pi<70> di una $template_dir ma soltanto una $compile_dir.
|
||||
Impostate un <parameter>compile_id</parameter> diverso per ogni $template_dir,
|
||||
altrimenti i template con lo stesso nome si sovrascriveranno a vicenda.
|
||||
Potete anche impostare la variabile <link linkend="variable.compile.id">$compile_id</link>
|
||||
una volta sola invece di passarla ogni volta che chiamate questa funzione.
|
||||
</para>'>
|
7
docs/it/livedocs.ent
Normal file
7
docs/it/livedocs.ent
Normal file
@@ -0,0 +1,7 @@
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<!ENTITY livedocs.author 'Authors:<br />'>
|
||||
<!ENTITY livedocs.editors 'Edited by:<br />'>
|
||||
<!ENTITY livedocs.copyright 'Copyright © %s by %s'>
|
||||
<!ENTITY livedocs.published 'Published on: %s'>
|
||||
|
94
docs/it/preface.xml
Normal file
94
docs/it/preface.xml
Normal file
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<preface id="preface">
|
||||
<title>Prefazione</title>
|
||||
<para>
|
||||
Indubbiamente <20> una delle domande pi<70> frequenti sulle mailing list del
|
||||
PHP: perch<63> devo rendere i miei script PHP indipendenti dal layout? Se
|
||||
<20> vero che PHP <20> conosciuto come "linguaggio di scripting incorporato in
|
||||
HTML", dopo aver realizzato un paio di progetti che mescolano liberamente
|
||||
PHP e HTML nasce l'idea che separare forma e contenuti sia una buona cosa.
|
||||
Inoltre, in molte aziende i ruoli dei grafici (progettisti del layout)
|
||||
e dei programmatori sono separati. La ricerca di una soluzione con i
|
||||
template <20> quindi una conseguenza naturale.
|
||||
</para>
|
||||
<para>
|
||||
Ad esempio, nella nostra azienda lo sviluppo di un applicazione procede
|
||||
cos<6F>: dopo che sono stati redatti i documenti con le specifiche richieste,
|
||||
i progettisti delle interfacce creano dei modelli di interfaccia e li danno
|
||||
ai programmatori. Questi implementano la logica di business in PHP e usano
|
||||
i modelli di interfaccia per creare scheletri di template. A questo punto
|
||||
il progetto passa al progettista HTML/creatore di layout per le pagine web,
|
||||
che porta i template al loro massimo splendore. Il progetto potrebbe ancora
|
||||
andare avanti e indietro un paio di volte fra programmazione e HTML. Quindi
|
||||
<20> importante avere un buon supporto per i template, perch<63> i programmatori
|
||||
non vogliono avere a che fare con l'HTML e non vogliono che i progettisti
|
||||
HTML facciano danni col codice PHP. I grafici hanno bisogno di supporto per
|
||||
i file di configurazione, i blocchi dinamici e altri elementi di interfaccia,
|
||||
ma non vogliono dover avere a che fare con le complicazioni del linguaggio
|
||||
di programmazione.
|
||||
</para>
|
||||
<para>
|
||||
Dando un'occhiata alle diverse soluzioni di template attualmente disponibili
|
||||
per PHP, vediamo che la maggior parte di esse fornisce solo un modo rudimentale
|
||||
per sostituire variabili nei template e hanno delle forme limitate di
|
||||
funzionalit<69> relative ai blocchi dinamici. Ma le nostre necessit<69> erano un
|
||||
po' maggiori di queste. Noi volevamo che i programmatori evitassero DEL TUTTO
|
||||
di avere a che fare con l'HTML, ma questo era quasi inevitabile. Ad esempio,
|
||||
se un grafico voleva alternare i colori di sfondo su un blocco dinamico, questo
|
||||
doveva essere ottenuto preventivamente dal programmatore. Volevamo anche
|
||||
che i grafici potessero usare i propri file di configurazione, ed importare
|
||||
da questi le variabili nei template. La lista potrebbe continuare ancora.
|
||||
</para>
|
||||
<para>
|
||||
Iniziammo cos<6F> a scrivere una specifica per un motore di template verso la fine
|
||||
del 1999. Dopo avere finito le specifiche, iniziammo a lavorare su un motore
|
||||
scritto in C che, speravamo, avrebbe potuto essere incluso in PHP. Non solo
|
||||
per<65> ci scontrammo con molti complicati ostacoli tecnici, ma c'era anche un
|
||||
dibattito molto acceso su cosa esattamente un motore di template avrebbe dovuto
|
||||
fare e cosa no. Da questa esperienza decidemmo che il motore sarebbe stato scritto
|
||||
in PHP come classe, in modo che ognuno potesse usarlo come gli pareva. Cos<6F>
|
||||
scrivemmo un motore che faceva proprio quello e <productname>SmartTemplate</productname>
|
||||
venne alla luce (nota: questa classe non <20> mai stata pubblicata). Era una classe
|
||||
che faceva quasi tutto quello che volevamo: sostituzione delle variabili,
|
||||
supporto per l'inclusione di altri template, integrazione con i file di
|
||||
configurazione, incorporazione del codice PHP, limitate funzionalit<69> con
|
||||
istruzioni 'if' e molti altri robusti blocchi dinamici che potevano essere
|
||||
nidificati ripetutamente. Tutto questo veniva fatto con le espressioni regolari
|
||||
e il codice che ne venne fuori era, per cos<6F> dire, impenetrabile. Era anche
|
||||
notevolmente lento nelle grosse applicazioni, per via di tutta l'analisi (parsing)
|
||||
ed il lavoro sulle espressioni regolari che doveva fare ad ogni invocazione.
|
||||
Il problema pi<70> grosso dal punto di vista di un programmatore era tutto il
|
||||
lavoro necessario nello script PHP per creare ed elaborare i template ed i
|
||||
blocchi dinamici. Come rendere tutto questo pi<70> semplice?
|
||||
</para>
|
||||
<para>
|
||||
Cos<6F> nacque la visione di quello che poi <20> diventato Smarty. Sappiamo quanto
|
||||
<20> veloce PHP senza il sovraccarico dell'analisi dei template. Sappiamo anche
|
||||
quanto il linguaggio possa apparire meticoloso ed estremamente noioso per il
|
||||
grafico medio, e questo pu<70> essere mascherato con una sintassi di template
|
||||
molto pi<70> semplice. Allora, perch<63> non combinare i due punti di forza? Cos<6F>
|
||||
nacque Smarty...
|
||||
</para>
|
||||
</preface>
|
||||
|
||||
<!-- 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
|
||||
-->
|
35
docs/it/programmers/advanced-features.xml
Normal file
35
docs/it/programmers/advanced-features.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="advanced.features">
|
||||
<title>Funzioni avanzate</title>
|
||||
&programmers.advanced-features.advanced-features-objects;
|
||||
&programmers.advanced-features.advanced-features-prefilters;
|
||||
|
||||
&programmers.advanced-features.advanced-features-postfilters;
|
||||
|
||||
&programmers.advanced-features.advanced-features-outputfilters;
|
||||
|
||||
&programmers.advanced-features.section-template-cache-handler-func;
|
||||
|
||||
&programmers.advanced-features.template-resources;
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="advanced.features.objects">
|
||||
<title>Oggetti</title>
|
||||
<para>
|
||||
Smarty consente di accedere agli oggetti PHP attraverso i template. Ci sono
|
||||
due modi per farlo. Uno <20> registrare gli oggetti al template, quindi accedere
|
||||
ad essi attraverso una sintassi simile a quella delle funzioni utente. L'altro
|
||||
modo <20> di assegnare gli oggetti ai template ed accedere loro come ad una
|
||||
qualsiasi variabile assegnata. Il primo metodo ha una sintassi del template
|
||||
migliore. E' anche pi<70> sicuro, perch<63> su un oggetto registrato potete impedire
|
||||
l'accesso a certi metodi o propriet<65>. D'altra parte, su un oggetto registrato
|
||||
non potete effettuare dei cicli o metterlo in un array di oggetti, ecc.
|
||||
Il metodo che sceglierete dipender<65> dalle vostre necessit<69>, ma quando possibile
|
||||
usate sempre il primo metodo, per mantenere la sintassi del template al massimo
|
||||
della semplicit<69>.
|
||||
</para>
|
||||
<para>
|
||||
Se la security <20> abilitata, non <20> possibile accedere a metodi o funzioni private
|
||||
(che cominciano con "_") dell'oggetto. Quando esistono un metodo e una propriet<65>
|
||||
con lo stesso nome, verr<72> usato il metodo.
|
||||
</para>
|
||||
<para>
|
||||
Potete impedire l'accesso a certi metodi e propriet<65> elencandoli in un array
|
||||
come terzo parametro di registrazione.
|
||||
</para>
|
||||
<para>
|
||||
Per default, i parametri passati agli oggetti attraverso i template sono
|
||||
passati nello stesso modo in cui li leggono le funzioni utente. Il primo
|
||||
parametro <20> un array associativo, e il secondo <20> l'oggetto smarty. Se
|
||||
volete i parameteri passati uno alla volta per ogni argomento come nel
|
||||
tradizionale passaggio di parametri per gli oggetti, impostate il quarto
|
||||
parametro di registrazione a false.
|
||||
</para>
|
||||
<para>
|
||||
Il quinto parametro opzionale ha effetto soltanto quando
|
||||
<parameter>format</parameter> <20> <literal>true</literal> e
|
||||
contiene una lista di metodi che devono essere trattati come
|
||||
blocchi. Ci<43> significa che questi metodi hanno un tag di
|
||||
chiusura nel template
|
||||
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) e i
|
||||
parametri passati al metodo hanno la stessa struttura di
|
||||
quelli per le funzioni plugin per i blocchi. Questi metodi
|
||||
quindi ricevono 4 parametri <parameter>$params</parameter>,
|
||||
<parameter>$content</parameter>, <parameter>&$smarty</parameter>
|
||||
e <parameter>&$repeat</parameter> e si comportano come
|
||||
funzioni plugin per i blocchi.
|
||||
</para>
|
||||
<example>
|
||||
<title>usare un oggetto registrato o assegnato</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// the object
|
||||
|
||||
class My_Object {
|
||||
function meth1($params, &$smarty_obj) {
|
||||
return "this is my meth1";
|
||||
}
|
||||
}
|
||||
|
||||
$myobj = new My_Object;
|
||||
// registriamo l'oggetto (sar<61> usato per riferimento)
|
||||
$smarty->register_object("foobar",$myobj);
|
||||
// se vogliamo impedire l'accesso a metodi o propriet<65>, elenchiamoli
|
||||
$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
|
||||
// se vogliamo usare il formato tradizionale per i parametri, passiamo un false
|
||||
$smarty->register_object("foobar",$myobj,null,false);
|
||||
|
||||
// Possiamo anche assegnare gli oggetti. Facciamolo per riferimento quando possibile.
|
||||
$smarty->assign_by_ref("myobj", $myobj);
|
||||
|
||||
$smarty->display("index.tpl");
|
||||
?>
|
||||
+]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Ed ecco come accedere all'oggetto in index.tpl:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* accediamo all'oggetto registrato *}
|
||||
{foobar->meth1 p1="foo" p2=$bar}
|
||||
|
||||
{* possiamo anche assegnare l'output *}
|
||||
{foobar->meth1 p1="foo" p2=$bar assign="output"}
|
||||
the output was {$output}
|
||||
|
||||
{* accediamo all'oggetto assegnato *}
|
||||
{$myobj->meth1("foo",$bar)}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="advanced.features.outputfilters">
|
||||
<title>Filtri di output</title>
|
||||
<para>
|
||||
Quando il template viene richiamato via display() o fetch(), <20> possibile
|
||||
eseguire uno o pi<70> filtri sul suo output. Ci<43> <20> diverso dai postfiltri,
|
||||
perch<63> questi ultimi lavorano sul template compilato prima che venga
|
||||
salvato su disco, mentre i filtri dioutput lavorano sull'output del
|
||||
template quando viene eseguito.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
I filtri di output possono essere
|
||||
<link linkend="api.register.outputfilter">registrati</link> o caricati
|
||||
dalla directory plugins con la funzione
|
||||
<link linkend="api.load.filter">load_filter()</link> oppure impostando la
|
||||
variabile <link linkend="variable.autoload.filters">$autoload_filters</link>.
|
||||
Smarty passer<65> l'output del template come primo argomento, e si aspetter<65>
|
||||
che la funzione restituisca il risultato dell'esecuzione.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso di un filtro di output</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// mettiamo questo nell'applicazione
|
||||
function protect_email($tpl_output, &$smarty)
|
||||
{
|
||||
$tpl_output =
|
||||
preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
|
||||
'$1%40$2', $tpl_output);
|
||||
return $tpl_output;
|
||||
}
|
||||
|
||||
// registriamo il filtro
|
||||
$smarty->register_outputfilter("protect_email");
|
||||
$smarty->display("index.tpl");
|
||||
|
||||
// ora ogni indirizzo email nell'output del template avr<76> una semplice
|
||||
// protezione contro gli spambot
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="advanced.features.postfilters">
|
||||
<title>Postfiltri</title>
|
||||
<para>
|
||||
I postfiltri sui template sono funzioni PHP che vengono eseguite sui template
|
||||
dopo la compilazione. I postfiltri possono essere
|
||||
<link linkend="api.register.postfilter">registrati</link> oppure caricati
|
||||
dalla directory plugins con la funzione <link
|
||||
linkend="api.load.filter">load_filter()</link> o impostando la variabile
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>.
|
||||
Smarty passer<65> il codice del template compilato come primo parametro,
|
||||
e si aspetter<65> che la funzione restituisca il template risultante.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso di un postfiltro</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// mettiamo questo nell'applicazione
|
||||
function add_header_comment($tpl_source, &$smarty)
|
||||
{
|
||||
return "<?php echo \"<!-- Created by Smarty! -->\n\"; ?>\n".$tpl_source;
|
||||
}
|
||||
|
||||
// registriamo il postfiltro
|
||||
$smarty->register_postfilter("add_header_comment");
|
||||
$smarty->display("index.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo far<61> s<> che il template compilato index.tpl appaia cos<6F>:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<!-- Created by Smarty! -->
|
||||
{* resto del template... *}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="advanced.features.prefilters">
|
||||
<title>Prefiltri</title>
|
||||
<para>
|
||||
I prefiltri sui template sono funzioni PHP che vengono eseguite sui template
|
||||
prima della compilazione. Sono utili per pre-processare i template allo
|
||||
scopo di rimuovere commenti non desiderati, tenere d'occhio ci<63> che i
|
||||
progettisti mettono nei template, ecc. I prefiltri possono essere
|
||||
<link linkend="api.register.prefilter">registrati</link> oppure caricati
|
||||
dalla directory plugins con la funzione <link
|
||||
linkend="api.load.filter">load_filter()</link> o impostando la variabile
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>.
|
||||
Smarty passer<65> il codice sorgente del template come primo parametro,
|
||||
e si aspetter<65> che la funzione restituisca il codice sorgente risultante.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso di un prefiltro</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// mettiamo questo nell'applicazione
|
||||
function remove_dw_comments($tpl_source, &$smarty)
|
||||
{
|
||||
return preg_replace("/<!--#.*-->/U","",$tpl_source);
|
||||
}
|
||||
|
||||
// registriamo il prefiltro
|
||||
$smarty->register_prefilter("remove_dw_comments");
|
||||
$smarty->display("index.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Questo rimuover<65> tutti i commenti dal sorgente del template.
|
||||
</para>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="section.template.cache.handler.func">
|
||||
<title>Funzione di gestione della Cache</title>
|
||||
<para>
|
||||
Come alternativa all'uso del meccanismo di default per la cache basato
|
||||
sui file, potete specificare una funzione personalizzata di gestione
|
||||
che verr<72> usata per leggere, scrivere ed eliminare i file in cache.
|
||||
</para>
|
||||
<para>
|
||||
Create una funzione nella vostra applicazione che Smarty user<65> come
|
||||
gestore della cache. Impostate il nome di questa funzione nella variabile
|
||||
di classe <link linkend="variable.cache.handler.func">$cache_handler_func</link>.
|
||||
Smarty ora user<65> questa funzione per gestire i dati della cache. Il primo
|
||||
parametro <20> l'azione, che pu<70> essere 'read', 'write' o 'clear'. Il
|
||||
secondo parametro <20> l'oggetto Smarty. Il terzo parametro <20> il contenuto in
|
||||
cache. In una 'write', Smarty passa il contenuto da mettere in cache in
|
||||
questo parametro. In una 'read', Smarty si aspetta che la funzione prenda questo
|
||||
parametro per riferimento e che lo riempia con i dati della cache.
|
||||
In una 'clear', il parametro non viene usato, quindi passate una variabile
|
||||
dummy. Il quarto parametro <20> il nome del file del template (necessario
|
||||
per le read e le write), il quinto parametro <20> il cache_id (opzionale), e
|
||||
il sesto <20> il compile_id (opzionale).
|
||||
</para>
|
||||
<para>
|
||||
Nota: l'ultimo parametro ($exp_time) <20> stato aggiunto in Smarty-2.6.0.
|
||||
</para>
|
||||
<example>
|
||||
<title>esempio con l'uso di MySQL per la cache</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
|
||||
esempio:
|
||||
|
||||
include('Smarty.class.php');
|
||||
include('mysql_cache_handler.php');
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->cache_handler_func = 'mysql_cache_handler';
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
|
||||
il database mysql avr<76> questo formato:
|
||||
|
||||
create database SMARTY_CACHE;
|
||||
|
||||
create table CACHE_PAGES(
|
||||
CacheID char(32) PRIMARY KEY,
|
||||
CacheContents MEDIUMTEXT NOT NULL
|
||||
);
|
||||
|
||||
*/
|
||||
|
||||
function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
|
||||
{
|
||||
// impostiamo i dati d'accesso al db
|
||||
$db_host = 'localhost';
|
||||
$db_user = 'myuser';
|
||||
$db_pass = 'mypass';
|
||||
$db_name = 'SMARTY_CACHE';
|
||||
$use_gzip = false;
|
||||
|
||||
// creiamo un cache id unico
|
||||
$CacheID = md5($tpl_file.$cache_id.$compile_id);
|
||||
|
||||
if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
|
||||
$smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
|
||||
return false;
|
||||
}
|
||||
mysql_select_db($db_name);
|
||||
|
||||
switch ($action) {
|
||||
case 'read':
|
||||
// leggiamo la cache dal database
|
||||
$results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
|
||||
if(!$results) {
|
||||
$smarty_obj->_trigger_error_msg("cache_handler: query failed.");
|
||||
}
|
||||
$row = mysql_fetch_array($results,MYSQL_ASSOC);
|
||||
|
||||
if($use_gzip && function_exists("gzuncompress")) {
|
||||
$cache_content = gzuncompress($row["CacheContents"]);
|
||||
} else {
|
||||
$cache_content = $row["CacheContents"];
|
||||
}
|
||||
$return = $results;
|
||||
break;
|
||||
case 'write':
|
||||
// salviamo la cache sul database
|
||||
|
||||
if($use_gzip && function_exists("gzcompress")) {
|
||||
// compress the contents for storage efficiency
|
||||
$contents = gzcompress($cache_content);
|
||||
} else {
|
||||
$contents = $cache_content;
|
||||
}
|
||||
$results = mysql_query("replace into CACHE_PAGES values(
|
||||
'$CacheID',
|
||||
'".addslashes($contents)."')
|
||||
");
|
||||
if(!$results) {
|
||||
$smarty_obj->_trigger_error_msg("cache_handler: query failed.");
|
||||
}
|
||||
$return = $results;
|
||||
break;
|
||||
case 'clear':
|
||||
// eliminiamo i dati in cache
|
||||
if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
|
||||
// eliminiamo tutto
|
||||
$results = mysql_query("delete from CACHE_PAGES");
|
||||
} else {
|
||||
$results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
|
||||
}
|
||||
if(!$results) {
|
||||
$smarty_obj->_trigger_error_msg("cache_handler: query failed.");
|
||||
}
|
||||
$return = $results;
|
||||
break;
|
||||
default:
|
||||
// errore, azione non prevista
|
||||
$smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
|
||||
$return = false;
|
||||
break;
|
||||
}
|
||||
mysql_close($link);
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
246
docs/it/programmers/advanced-features/template-resources.xml
Normal file
246
docs/it/programmers/advanced-features/template-resources.xml
Normal file
@@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="template.resources">
|
||||
<title>Risorse</title>
|
||||
<para>
|
||||
I template possono arrivare da varie risorse. Quando fate la display o la
|
||||
fetch di un template, o quando fate la include da un altro template,
|
||||
fornite un tipo di risorsa, seguito dal percorso appropriato e dal nome
|
||||
del template. Se non viene esplicitamente indicato un tipo di risorsa,
|
||||
viene utilizzato il valore di <link
|
||||
linkend="variable.default.resource.type">$default_resource_type</link>.
|
||||
</para>
|
||||
<sect2 id="templates.from.template.dir">
|
||||
<title>Template della $template_dir</title>
|
||||
<para>
|
||||
I template provenienti dalla $template_dir non hanno bisogno che
|
||||
indichiate un tipo di risorsa, sebbene possiate indicare file: per
|
||||
coerenza. Basta che forniate il percorso per il template che volete
|
||||
usare, relativo alla directory radice $template_dir.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso dei template della $template_dir</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->display("index.tpl");
|
||||
$smarty->display("admin/menu.tpl");
|
||||
$smarty->display("file:admin/menu.tpl"); // equivale al precedente
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
And from within Smarty template:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{include file="index.tpl"}
|
||||
{include file="file:index.tpl"} {* equivale al precedente *}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2 id="templates.from.any.dir">
|
||||
<title>Template da qualsiasi directory</title>
|
||||
<para>
|
||||
I template che si trovano al di fuori della $template_dir richiedono
|
||||
obbligatoriamente che indichiate il tipo di risorsa file: seguito
|
||||
dal percorso assoluto e dal nome del template.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso dei template da qualsiasi directory</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->display("file:/export/templates/index.tpl");
|
||||
$smarty->display("file:/path/to/my/templates/menu.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
And from within Smarty template:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{include file="file:/usr/local/share/templates/navigation.tpl"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<sect3 id="templates.windows.filepath">
|
||||
<title>Percorsi su Windows</title>
|
||||
<para>
|
||||
Se usate una macchina Windows, i percorsi di solito comprendono
|
||||
una lettera di drive (C:) all'inizio del percorso. Accertatevi
|
||||
di usare "file:" nel path, per evitare conflitti di namespace e
|
||||
ottenere i risultati voluti.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso di template da percorsi di Windows</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->display("file:C:/export/templates/index.tpl");
|
||||
$smarty->display("file:F:/path/to/my/templates/menu.tpl");
|
||||
?>
|
||||
|
||||
{* dall'interno di un template *}
|
||||
{include file="file:D:/usr/local/share/templates/navigation.tpl"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="templates.from.elsewhere">
|
||||
<title>Template da altre risorse</title>
|
||||
<para>
|
||||
Potete ottenere template da qualsiasi risorsa alla quale sia
|
||||
possibile accedere con PHP: database, socket, directory LDAP, e
|
||||
cos<6F> via. Potete farlo scrivendo una funzione plugin per le
|
||||
risorse e registrandola a Smarty.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Consultate la sezione <link linkend="plugins.resources">plugin
|
||||
risorse</link> per maggiori informazioni sulle funzioni che
|
||||
dovrete creare.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Notate che non <20> possibile modificare il comportamento della risorsa
|
||||
<literal>file</literal>, ma potete fornire una risorsa che legge i
|
||||
template dal filesystem in maniera diversa registrandola con un altro
|
||||
nome di risorsa.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>uso di risorse personalizzate</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// mettete queste funzioni da qualche parte nell'applicazione
|
||||
function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
|
||||
{
|
||||
// fate qui le chiamate al database per ottenere il template
|
||||
// e riempire $tpl_source
|
||||
$sql = new SQL;
|
||||
$sql->query("select tpl_source
|
||||
from my_table
|
||||
where tpl_name='$tpl_name'");
|
||||
if ($sql->num_rows) {
|
||||
$tpl_source = $sql->record['tpl_source'];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
|
||||
{
|
||||
// qui facciamo una chiamata al db per riempire $tpl_timestamp.
|
||||
$sql = new SQL;
|
||||
$sql->query("select tpl_timestamp
|
||||
from my_table
|
||||
where tpl_name='$tpl_name'");
|
||||
if ($sql->num_rows) {
|
||||
$tpl_timestamp = $sql->record['tpl_timestamp'];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function db_get_secure($tpl_name, &$smarty_obj)
|
||||
{
|
||||
// ipotizziamo che tutti i template siano sicuri
|
||||
return true;
|
||||
}
|
||||
|
||||
function db_get_trusted($tpl_name, &$smarty_obj)
|
||||
{
|
||||
// non usata per i template
|
||||
}
|
||||
|
||||
// register the resource name "db"
|
||||
$smarty->register_resource("db", array("db_get_template",
|
||||
"db_get_timestamp",
|
||||
"db_get_secure",
|
||||
"db_get_trusted"));
|
||||
|
||||
// uso della risorsa dallo script php
|
||||
$smarty->display("db:index.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
And from within Smarty template:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{include file="db:/extras/navigation.tpl"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="default.template.handler.function">
|
||||
<title>Funzione di gestione dei template di default</title>
|
||||
<para>
|
||||
Potete specificare una funzione da usare per ottenere i contenuti
|
||||
del template nel caso in cui non sia possibile leggerlo dalla
|
||||
risorsa appropriata. Un uso possibile di questa funzione <20> di
|
||||
creare al volo template che non esistono.
|
||||
</para>
|
||||
<example>
|
||||
<title>uso della funzione di gestione dei template di default</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// mettete questa funzione da qualche parte nell'applicazione
|
||||
|
||||
function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
|
||||
{
|
||||
if( $resource_type == 'file' ) {
|
||||
if ( ! is_readable ( $resource_name )) {
|
||||
// create il file del template e restituite il contenuto.
|
||||
$template_source = "This is a new template.";
|
||||
$template_timestamp = time();
|
||||
$smarty_obj->_write_file($resource_name,$template_source);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// non <20> un file
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// impostate il gestore di default
|
||||
$smarty->default_template_handler_func = 'make_template';
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
72
docs/it/programmers/api-functions.xml
Normal file
72
docs/it/programmers/api-functions.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<reference id="api.functions">
|
||||
<title>Methods</title>
|
||||
<titleabbrev></titleabbrev>
|
||||
<partintro>
|
||||
<section>
|
||||
<title />
|
||||
<para></para>
|
||||
</section>
|
||||
</partintro>
|
||||
&programmers.api-functions.api-append;
|
||||
&programmers.api-functions.api-append-by-ref;
|
||||
&programmers.api-functions.api-assign;
|
||||
&programmers.api-functions.api-assign-by-ref;
|
||||
&programmers.api-functions.api-clear-all-assign;
|
||||
&programmers.api-functions.api-clear-all-cache;
|
||||
&programmers.api-functions.api-clear-assign;
|
||||
&programmers.api-functions.api-clear-cache;
|
||||
&programmers.api-functions.api-clear-compiled-tpl;
|
||||
&programmers.api-functions.api-clear-config;
|
||||
&programmers.api-functions.api-config-load;
|
||||
&programmers.api-functions.api-display;
|
||||
&programmers.api-functions.api-fetch;
|
||||
&programmers.api-functions.api-get-config-vars;
|
||||
&programmers.api-functions.api-get-registered-object;
|
||||
&programmers.api-functions.api-get-template-vars;
|
||||
&programmers.api-functions.api-is-cached;
|
||||
&programmers.api-functions.api-load-filter;
|
||||
&programmers.api-functions.api-register-block;
|
||||
&programmers.api-functions.api-register-compiler-function;
|
||||
&programmers.api-functions.api-register-function;
|
||||
&programmers.api-functions.api-register-modifier;
|
||||
&programmers.api-functions.api-register-object;
|
||||
&programmers.api-functions.api-register-outputfilter;
|
||||
&programmers.api-functions.api-register-postfilter;
|
||||
&programmers.api-functions.api-register-prefilter;
|
||||
&programmers.api-functions.api-register-resource;
|
||||
&programmers.api-functions.api-trigger-error;
|
||||
|
||||
&programmers.api-functions.api-template-exists;
|
||||
&programmers.api-functions.api-unregister-block;
|
||||
&programmers.api-functions.api-unregister-compiler-function;
|
||||
&programmers.api-functions.api-unregister-function;
|
||||
&programmers.api-functions.api-unregister-modifier;
|
||||
&programmers.api-functions.api-unregister-object;
|
||||
&programmers.api-functions.api-unregister-outputfilter;
|
||||
&programmers.api-functions.api-unregister-postfilter;
|
||||
&programmers.api-functions.api-unregister-prefilter;
|
||||
&programmers.api-functions.api-unregister-resource;
|
||||
|
||||
</reference>
|
||||
<!-- 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
|
||||
-->
|
60
docs/it/programmers/api-functions/api-append-by-ref.xml
Normal file
60
docs/it/programmers/api-functions/api-append-by-ref.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.append.by.ref">
|
||||
<refnamediv>
|
||||
<refname>append_by_ref</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>append_by_ref</methodname>
|
||||
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Si usa per aggiungere valori al template per riferimento.
|
||||
Se aggiungete una variabile per riferimento e poi cambiate il
|
||||
suo valore, il template vedr<64> il valore modificato. Per gli
|
||||
oggetti, append_by_ref() evita anche la copia in memoria
|
||||
dell'oggetto aggiunto. Consultate il manuale di PHP sui riferimenti
|
||||
alle variabili per una spiegazione approfondita. Se passate il
|
||||
terzo parametro opzionale a true, il valore verr<72> fuso nell'array
|
||||
corrente invece che aggiunto.
|
||||
</para>
|
||||
¬e.parameter.merge;
|
||||
<example>
|
||||
<title>append_by_ref</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// aggiunta di coppie nome/valore
|
||||
$smarty->append_by_ref("Name", $myname);
|
||||
$smarty->append_by_ref("Address", $address);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
64
docs/it/programmers/api-functions/api-append.xml
Normal file
64
docs/it/programmers/api-functions/api-append.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.append">
|
||||
<refnamediv>
|
||||
<refname>append</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>append</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>append</methodname>
|
||||
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Si usa per aggiungere un elemento ad un array. Se aggiungete un valore
|
||||
stringa, verr<72> convertito in un elemento di array e aggiunto. Potete
|
||||
passare esplicitamente coppie nome/valore, oppure array associativi
|
||||
contenenti le coppie nome/valore. Se passate il terzo parametro opzionale
|
||||
a true, il valore verr<72> fuso nell'array corrente invece che aggiunto.
|
||||
</para>
|
||||
¬e.parameter.merge;
|
||||
<example>
|
||||
<title>append</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// passaggio di coppie nome/valore
|
||||
$smarty->append("Name", "Fred");
|
||||
$smarty->append("Address", $address);
|
||||
|
||||
// passaggio di un array associativo
|
||||
$smarty->append(array("city" => "Lincoln", "state" => "Nebraska"));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
64
docs/it/programmers/api-functions/api-assign-by-ref.xml
Normal file
64
docs/it/programmers/api-functions/api-assign-by-ref.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.assign.by.ref">
|
||||
<refnamediv>
|
||||
<refname>assign_by_ref</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign_by_ref</methodname>
|
||||
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Si usa per assegnare valori ai template per riferimento invece di farne una
|
||||
copia. Consultate il manuale PHP sui riferimenti alle variabili per una
|
||||
spiegazione.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
Questo metodo si usa per assegnare valori ai template per riferimento.
|
||||
Se assegnate una variabile per riferimento e poi cambiate il suo
|
||||
valore, il template vedr<64> il valore modificato. Per gli oggetti,
|
||||
assign_by_ref() evita anche la copia in memoria dell'oggetto
|
||||
assegnato. Consultate il manuale PHP sui riferimenti alle variabili
|
||||
per una spiegazione approfondita.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>assign_by_ref</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// passaggio di coppie nome/valore
|
||||
$smarty->assign_by_ref('Name', $myname);
|
||||
$smarty->assign_by_ref('Address', $address);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
60
docs/it/programmers/api-functions/api-assign.xml
Normal file
60
docs/it/programmers/api-functions/api-assign.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.assign">
|
||||
<refnamediv>
|
||||
<refname>assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign</methodname>
|
||||
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Si usa per assegnare valori ai template. Potete passare
|
||||
esplicitamente coppie nome/valore, o array associativi
|
||||
contenenti le coppie nome/valore.
|
||||
</para>
|
||||
<example>
|
||||
<title>assign</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// passaggio di coppie nome/valore
|
||||
$smarty->assign('Name', 'Fred');
|
||||
$smarty->assign('Address', $address);
|
||||
|
||||
// passaggio di un array associativo
|
||||
$smarty->assign(array("city" => "Lincoln", "state" => "Nebraska"));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
49
docs/it/programmers/api-functions/api-clear-all-assign.xml
Normal file
49
docs/it/programmers/api-functions/api-clear-all-assign.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.all.assign">
|
||||
<refnamediv>
|
||||
<refname>clear_all_assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_all_assign</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Annulla i valori di tutte le variabili assegnate.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_all_assign</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// annulla tutte le variabili assegnate
|
||||
$smarty->clear_all_assign();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
51
docs/it/programmers/api-functions/api-clear-all-cache.xml
Normal file
51
docs/it/programmers/api-functions/api-clear-all-cache.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.all.cache">
|
||||
<refnamediv>
|
||||
<refname>clear_all_cache</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_all_cache</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Annulla l'intera cache del template. Come parametro opzionale
|
||||
potete fornire un'et<65> minima in secondi che i file della
|
||||
cache devono avere prima di essere eliminati.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_all_cache</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// clear the entire cache
|
||||
$smarty->clear_all_cache();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
53
docs/it/programmers/api-functions/api-clear-assign.xml
Normal file
53
docs/it/programmers/api-functions/api-clear-assign.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.assign">
|
||||
<refnamediv>
|
||||
<refname>clear_assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_assign</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Annulla il valore di una variabile assegnata in precedenza.
|
||||
Pu<50> essere un valore singolo, o un array di valori.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_assign</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// annullamento di una singola variabile
|
||||
$smarty->clear_assign("Name");
|
||||
|
||||
// annullamento di pi<70> variabili
|
||||
$smarty->clear_assign(array("Name", "Address", "Zip"));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
63
docs/it/programmers/api-functions/api-clear-cache.xml
Normal file
63
docs/it/programmers/api-functions/api-clear-cache.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.cache">
|
||||
<refnamediv>
|
||||
<refname>clear_cache</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_cache</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Elimina la cache per un <parameter>template</parameter> specifico. Se
|
||||
avete pi<70> cache per questo template, potete eliminarne una specifica
|
||||
fornendo il <parameter>cache_id</parameter> come secondo parametro.
|
||||
Potete anche passare un <parameter>compile_id</parameter> come terzo
|
||||
parametro. Potete "raggruppare" i template in modo da rimuoverli in
|
||||
gruppo. Leggete la <link linkend="caching">sezione sul caching</link>
|
||||
per maggiori informazioni. Come quarto parametro opzionale potete fornire
|
||||
un'et<65> minima in secondi che il file di cache deve avere prima di essere
|
||||
eliminato.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_cache</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// eliminazione della cache per un template
|
||||
$smarty->clear_cache("index.tpl");
|
||||
|
||||
// eliminazione di una particolare cache in un template a pi<70> cache
|
||||
$smarty->clear_cache("index.tpl", "CACHEID");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
61
docs/it/programmers/api-functions/api-clear-compiled-tpl.xml
Normal file
61
docs/it/programmers/api-functions/api-clear-compiled-tpl.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.compiled.tpl">
|
||||
<refnamediv>
|
||||
<refname>clear_compiled_tpl</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_compiled_tpl</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>tpl_file</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>exp_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Elimina la versione compilata dello specifico template indicato,
|
||||
o tutti file di template compilati se non ne viene specificato uno.
|
||||
Se passate un compile_id solo il template compilato relativo a questo
|
||||
compile_id viene eliminato. Se passate un exp_time, solo i template
|
||||
compilati con un'et<65> maggiore di exp_time (in secondi) vengono
|
||||
eliminati; per default tutti i template compilati vengono eliminati,
|
||||
indipendentemente dalla loro et<65>. Questa funzione <20> solo per uso
|
||||
avanzato, normalmente non ne avrete bisogno.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_compiled_tpl</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// eliminazione di uno specifico template
|
||||
$smarty->clear_compiled_tpl("index.tpl");
|
||||
|
||||
// eliminazione di tutti i template compilati
|
||||
$smarty->clear_compiled_tpl();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
54
docs/it/programmers/api-functions/api-clear-config.xml
Normal file
54
docs/it/programmers/api-functions/api-clear-config.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.config">
|
||||
<refnamediv>
|
||||
<refname>clear_config</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_config</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Elimina tutte le variabili di configurazione assegnate. Se viene
|
||||
fornito un nome di variabile, soltanto quella variabile viene
|
||||
eliminata.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_config</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// eliminazione di tutte le variabili di configurazione
|
||||
$smarty->clear_config();
|
||||
|
||||
// eliminazione di una variabile
|
||||
$smarty->clear_config('foobar');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
67
docs/it/programmers/api-functions/api-config-load.xml
Normal file
67
docs/it/programmers/api-functions/api-config-load.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.config.load">
|
||||
<refnamediv>
|
||||
<refname>config_load</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>config_load</methodname>
|
||||
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>section</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Carica i dati del file di configurazione <parameter>file</parameter> e
|
||||
li assegna al template. Funziona esattamente come la funzione del
|
||||
template <link linkend="language.function.config.load">config_load</link>.
|
||||
</para>
|
||||
<note>
|
||||
<title>Nota tecnica</title>
|
||||
<para>
|
||||
A partire da Smarty 2.4.0, le variabili dei template vengono
|
||||
mantenute fra le diverse chiamate di fetch() e display(). Le
|
||||
variabili di configurazione caricate con config_load() hanno
|
||||
sempre uno scope globale. Anche i file di configurazione vengono
|
||||
compilati per una esecuzione pi<70> veloce, e rispettano le
|
||||
impostazioni di <link linkend="variable.force.compile">force_compile</link>
|
||||
e <link linkend="variable.compile.check">compile_check</link>.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>config_load</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// caricamento delle variabili di configurazione e loro assegnazione al template
|
||||
$smarty->config_load('my.conf');
|
||||
|
||||
// caricamento di una sezione
|
||||
$smarty->config_load('my.conf', 'foobar');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
104
docs/it/programmers/api-functions/api-display.xml
Normal file
104
docs/it/programmers/api-functions/api-display.xml
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.display">
|
||||
<refnamediv>
|
||||
<refname>display</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>display</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Visualizza il template. Dovete fornire un tipo e percorso
|
||||
corretti per la <link linkend="template.resources">risorsa del template</link>.
|
||||
Come secondo parametro opzionale potete passare una cache id.
|
||||
Consultate la <link linkend="caching">sezione sul caching</link> per
|
||||
maggiori informazioni.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
<example>
|
||||
<title>display</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include("Smarty.class.php");
|
||||
$smarty = new Smarty;
|
||||
$smarty->caching = true;
|
||||
|
||||
// faccio le chiamate al db solo se
|
||||
// non esiste la cache
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
|
||||
// dummy up some data
|
||||
$address = "245 N 50th";
|
||||
$db_data = array(
|
||||
"City" => "Lincoln",
|
||||
"State" => "Nebraska",
|
||||
"Zip" => "68502"
|
||||
);
|
||||
|
||||
$smarty->assign("Name","Fred");
|
||||
$smarty->assign("Address",$address);
|
||||
$smarty->assign($db_data);
|
||||
|
||||
}
|
||||
|
||||
// visualizzo l'output
|
||||
$smarty->display("index.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Usate la sintassi delle <link
|
||||
linkend="template.resources">risorse dei template</link>
|
||||
per visualizzare file che si trovano al di fuori della
|
||||
directory $template_dir.
|
||||
</para>
|
||||
<example>
|
||||
<title>esempi di visualizzazione di risorse di template</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// percorso assoluto
|
||||
$smarty->display("/usr/local/include/templates/header.tpl");
|
||||
|
||||
// percorso assoluto (equivale al precedente)
|
||||
$smarty->display("file:/usr/local/include/templates/header.tpl");
|
||||
|
||||
// percorso assoluto windows (OBBLIGATORIO il prefisso "file:")
|
||||
$smarty->display("file:C:/www/pub/templates/header.tpl");
|
||||
|
||||
// inclusione dalla risorsa di template di nome "db"
|
||||
$smarty->display("db:header.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
86
docs/it/programmers/api-functions/api-fetch.xml
Normal file
86
docs/it/programmers/api-functions/api-fetch.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.fetch">
|
||||
<refnamediv>
|
||||
<refname>fetch</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>fetch</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Questo metodo restituisce l'output del template invece di
|
||||
visualizzarlo. Dovete fornire un tipo e percorso corretti per
|
||||
la <link linkend="template.resources">risorsa del template</link>.
|
||||
Come secondo parametro opzionale potete passare una cache id.
|
||||
Consultate la <link linkend="caching">sezione sul caching</link> per
|
||||
maggiori informazioni.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
<para>
|
||||
<example>
|
||||
<title>fetch</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include("Smarty.class.php");
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->caching = true;
|
||||
|
||||
// faccio le chiamate al db solo se
|
||||
// non esiste la cache
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
|
||||
// dummy up some data
|
||||
$address = "245 N 50th";
|
||||
$db_data = array(
|
||||
"City" => "Lincoln",
|
||||
"State" => "Nebraska",
|
||||
"Zip" => "68502"
|
||||
);
|
||||
|
||||
$smarty->assign("Name","Fred");
|
||||
$smarty->assign("Address",$address);
|
||||
$smarty->assign($db_data);
|
||||
|
||||
}
|
||||
|
||||
// catturo l'output
|
||||
$output = $smarty->fetch("index.tpl");
|
||||
|
||||
// qui faccio qualcosa con $output
|
||||
|
||||
echo $output;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
57
docs/it/programmers/api-functions/api-get-config-vars.xml
Normal file
57
docs/it/programmers/api-functions/api-get-config-vars.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.get.config.vars">
|
||||
<refnamediv>
|
||||
<refname>get_config_vars</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_config_vars</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Restituisce il valore della variabile di configurazione data, se <20> stata
|
||||
caricata. Se non viene passato un parametro viene restituito un array
|
||||
di tutte le variabili di configurazione caricate.
|
||||
</para>
|
||||
<example>
|
||||
<title>get_config_vars</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// recupero la variabile di configurazione del template 'foo'
|
||||
$foo = $smarty->get_config_vars('foo');
|
||||
|
||||
// recupero tutte le variabili di configurazione caricate
|
||||
$config_vars = $smarty->get_config_vars();
|
||||
|
||||
// diamo un'occhiata
|
||||
print_r($config_vars);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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
|
||||
-->
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user