mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-27 18:31:36 +01:00
112 lines
3.3 KiB
XML
112 lines
3.3 KiB
XML
<?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ì</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à letta e
|
|
visualizzata. Se il nome del file inizia per "ftp://", il file
|
|
verrà 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à assegnato a questa variabile invece di essere stampato
|
|
in output. (novità 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 è 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
|
|
-->
|