mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-04 16:20:55 +02:00
- domain.com => example.com, as suggested by RFC 2606 - fix and introduce more dockbook tags - fix white spaces and use CDATA sections - add some paras to make the text more reader friendly
111 lines
3.1 KiB
XML
111 lines
3.1 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>Attribute Name</entry>
|
|
<entry>Type</entry>
|
|
<entry>Required</entry>
|
|
<entry>Default</entry>
|
|
<entry>Description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>file</entry>
|
|
<entry>string</entry>
|
|
<entry>Yes</entry>
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
<entry>the file, http or ftp site to fetch</entry>
|
|
</row>
|
|
<row>
|
|
<entry>assign</entry>
|
|
<entry>string</entry>
|
|
<entry>No</entry>
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
<entry>the template variable the output will be assigned
|
|
to</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
fetch is used to fetch files from the local file system, http, or
|
|
ftp and display the contents. If the file name begins with
|
|
"http://", the web site page will be fetched and displayed. If the
|
|
file name begins with "ftp://", the file will be fetched from the
|
|
ftp server and displayed. For local files, the full system file
|
|
path must be given, or a path relative to the executed php script.
|
|
</para>
|
|
<para>
|
|
If you supply the special "assign" attribute, the output of the
|
|
fetch function will be assigned to this template variable instead of
|
|
being output to the template. (new in Smarty 1.5.0)
|
|
</para>
|
|
<note>
|
|
<title>Technical Note</title>
|
|
<para>
|
|
This will not support http redirects, be sure to
|
|
include a trailing slash on your web page fetches where necessary.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<title>Technical Note</title>
|
|
<para>
|
|
If template security is turned on and you are
|
|
fetching a file from the local file system, this will only allow
|
|
files from within one of the defined secure directories.
|
|
($secure_dir)
|
|
</para>
|
|
</note>
|
|
<example>
|
|
<title>fetch</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* 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}
|
|
]]>
|
|
</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
|
|
-->
|