Get Smarty

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Check reviews of PHP Web Hosting, compatible with Smarty Templates

{fetch}

Nombre del Atributo Tipo Requerido Default Descripción
file string Si n/a El archivo, sitio http o ftp para mandar llamar
assign string No n/a La variable del template que va a recibir la salida

{fetch} es usado para obtener archivos de sistema local, http o ftp, y 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á 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.

Si usted indica el atributo especial "assign", la salida de la función {fetch} se ira a una variable de template en vez de ser mostrada en el template. (nuevo en Smarty 1.5.0)

Nota Técnica

Esto no soporta redirecionamento http, tenga la certeza de incluirlo en la barra el seguimiento para ir a buscar donde sea necesario.

Nota Técnica

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. ($secure_dir)

Example 8.6. fetch


{* include some javascript in your template *}
{fetch file="/export/httpd/www.example.com/docs/navbar.js"}

{* embed some weather text in your template from another web site *}
{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"}

{* assign the fetched contents to a template variable *}
{fetch file="http://www.myweather.com/68502/" assign="weather"}
{if $weather ne ""}
  <b>{$weather}</b>
{/if}

  

Ver también {capture}, {eval} y fetch().

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 3 plus 12? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
Cheap Hosting @HostsVault
email marketing @ActiveCampaign
broadband deals @BroadbandGenie
Best UK Web Hosting @webhost.uk.net
Reliable UK and US Web Hosting @rshosting.com
Cheap US and UK Web Hosting @infrenion.com
I.T Certification Exams @pass-guaranteed.com
Certification Practice Tests @firsttrycertify.com
Certification Practice Exam Questions @ace-it-certifications.com
Broadband Speed Test @broadbandspeed.co.uk
bulk email software @americaint.com