fetch

PHP Smarty

Smarty - the compiling PHP template engine
Smarty - php 模板编译引擎
Prev 来源:PHP中文社区 Chapter 8. Custom Functions[第八章.自定义函数] Next

fetch

Attribute Name Type Required Default Description
file string Yes n/a the file, http or ftp site to fetch
assign string No n/a the template variable the output will be assigned to

属性 类型 是否必须 缺省值 描述
file string Yes n/a 待请求的文件,http或ftp方式.
assign string No n/a 输出值将被赋给模板变量的名称
{* include some javascript in your template *}
{fetch file="/export/httpd/www.domain.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:[email protected]/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}

Prev 来源:PHP中文社区 Home Next
eval Up html_checkboxes