mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-31 20:31:41 +01:00
168 lines
5.2 KiB
XML
168 lines
5.2 KiB
XML
|
|
<?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
|
|||
|
|
-->
|