mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
tweaks
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<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)
|
||||
being output to the template.
|
||||
</para>
|
||||
|
||||
<informaltable frame="all">
|
||||
@@ -62,29 +62,32 @@
|
||||
<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.
|
||||
(<link linkend="variable.secure.dir">$secure_dir</link>)
|
||||
If template <link linkend="variable.security">$security</link>
|
||||
is turned on and you are
|
||||
fetching a file from the local file system, {fetch} will only allow
|
||||
files from within one of the defined
|
||||
<link linkend="variable.secure.dir">secure directories</link>.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>fetch</title>
|
||||
<title>{fetch} examples</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* include some javascript in your template *}
|
||||
{fetch file="/export/httpd/www.example.com/docs/navbar.js"}
|
||||
{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 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"}
|
||||
{fetch file='ftp://user:password@ftp.example.com/path/to/currentheadlines.txt'}
|
||||
{* as above but with variables *}
|
||||
{fetch file="ftp://`$user`:`$password`@`$server`/`$path`"}
|
||||
|
||||
{* assign the fetched contents to a template variable *}
|
||||
{fetch file="http://www.myweather.com/68502/" assign="weather"}
|
||||
{if $weather ne ""}
|
||||
<b>{$weather}</b>
|
||||
{fetch file='http://www.myweather.com/68502/' assign='weather'}
|
||||
{if $weather ne ''}
|
||||
<div id="weather">{$weather}</div>
|
||||
{/if}
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -92,7 +95,8 @@
|
||||
<para>
|
||||
See also
|
||||
<link linkend="language.function.capture">{capture}</link>,
|
||||
<link linkend="language.function.eval">{eval}</link>
|
||||
<link linkend="language.function.eval">{eval}</link>,
|
||||
<link linkend="language.function.assign">{assign}</link>
|
||||
and
|
||||
<link linkend="api.fetch">fetch()</link>.
|
||||
</para>
|
||||
|
Reference in New Issue
Block a user