Files
smarty/docs/es/designers/language-custom-functions/language-function-fetch.xml

115 lines
3.5 KiB
XML
Raw Normal View History

2004-10-07 18:50:52 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.fetch">
<title>{fetch}</title>
2004-10-07 18:50:52 +00:00
<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>Nombre del Atributo</entry>
<entry>Tipo</entry>
<entry>Requerido</entry>
<entry>Default</entry>
<entry>Descripci<EFBFBD>n</entry>
</row>
</thead>
<tbody>
<row>
<entry>file</entry>
<entry>string</entry>
<entry>Si</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>El archivo, sitio http o ftp para mandar llamar</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>La variable del template que va a recibir la salida</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
{fetch} es usado para obtener archivos de sistema local, http o ftp, y
2004-10-07 18:50:52 +00:00
mostrar el contenido. Si el nombre del archivo comienza con "http://",
la p<>gina del web site sera traida y mostrada. Si el nombre del archivo
comienza con "ftp://", el archivo ser<65> obtenido del servidor ftp y
mostrado. Para archivos locales, debe ser dada la ruta completa del
sistema de archivos, o una ruta relativa de el script php a ejecutar.
</para>
<para>
Si usted indica el atributo especial "assign", la salida de la funci<63>n
{fetch} se ira a una variable de template en vez de ser mostrada en el
2004-10-07 18:50:52 +00:00
template. (nuevo en Smarty 1.5.0)
</para>
<note>
<title>Nota T<>cnica</title>
<para>
Esto no soporta redirecionamento http, tenga la certeza de incluirlo
2004-10-07 18:50:52 +00:00
en la barra el seguimiento para ir a buscar donde sea necesario.
</para>
</note>
<note>
<title>Nota T<>cnica</title>
<para>
Si tiene activada la seguridad en su template y usted estuviera
recibiendo un archivo del sistema de archivos local, esto permitira
que solo archivos de uno de los directorios estuviera definido como
seguro. (<link linkend="variable.secure.dir">$secure_dir</link>)
2004-10-07 18:50:52 +00:00
</para>
</note>
<example>
<title>fetch</title>
<programlisting>
<![CDATA[
{* include some javascript in your template *}
{fetch file="/export/httpd/www.example.com/docs/navbar.js"}
2004-10-07 18:50:52 +00:00
{* embed some weather text in your template from another web site *}
2004-10-07 18:50:52 +00:00
{fetch file="http://www.myweather.com/68502/"}
{* fetch a news headline file via ftp *}
{fetch file="ftp://user:password@ftp.example.com/path/to/currentheadlines.txt"}
2004-10-07 18:50:52 +00:00
{* assign the fetched contents to a template variable *}
2004-10-07 18:50:52 +00:00
{fetch file="http://www.myweather.com/68502/" assign="weather"}
{if $weather ne ""}
<b>{$weather}</b>
2004-10-07 18:50:52 +00:00
{/if}
]]>
</programlisting>
</example>
<para>
Ver tambi<62>n <link linkend="language.function.capture">{capture}</link>,
<link linkend="language.function.eval">{eval}</link>
y <link linkend="api.fetch">fetch()</link>.
</para>
2004-10-07 18:50:52 +00:00
</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
-->