aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md')
-rw-r--r--vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md56
1 files changed, 29 insertions, 27 deletions
diff --git a/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md b/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md
index 3dbc5610f..2ff494fdd 100644
--- a/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md
+++ b/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-fetch.md
@@ -1,10 +1,15 @@
-{fetch} {#language.function.fetch}
-=======
+# {fetch}
`{fetch}` is used to retrieve 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
+## Attributes
+| Attribute | Required | Description |
+|-----------|----------|------------------------------------------------------|
+| file | Yes | The file, http or ftp site to fetch |
+| assign | No | The template variable the output will be assigned to |
+
+- If the file name begins with `http://`, the website page will be
fetched and displayed.
> **Note**
@@ -20,40 +25,37 @@ ftp and display the contents.
> **Note**
>
- > If security is enabled and you are fetching a file from the local
+ > If security is enabled, and you are fetching a file from the local
> file system, `{fetch}` will only allow files from within the
> `$secure_dir` path of the security policy. See the
- > [Security](#advanced.features.security) section for details.
+ > [Security](../../programmers/advanced-features/advanced-features-security.md) section for details.
- If the `assign` attribute is set, the output of the `{fetch}`
function will be assigned to this template variable instead of being
output to the template.
- 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
-
-
- {* include some javascript in your template *}
- {fetch file='/export/httpd/www.example.com/docs/navbar.js'}
+## Examples
- {* embed some weather text in your template from another web site *}
- {fetch file='http://www.myweather.com/68502/'}
+```smarty
+{* include some javascript in your template *}
+{fetch file='/export/httpd/www.example.com/docs/navbar.js'}
- {* fetch a news headline file via ftp *}
- {fetch file='ftp://user:password@ftp.example.com/path/to/currentheadlines.txt'}
- {* as above but with variables *}
- {fetch file="ftp://`$user`:`$password`@`$server`/`$path`"}
+{* embed some weather text in your template from another web site *}
+{fetch file='http://www.myweather.com/68502/'}
- {* assign the fetched contents to a template variable *}
- {fetch file='http://www.myweather.com/68502/' assign='weather'}
- {if $weather ne ''}
- <div id="weather">{$weather}</div>
- {/if}
+{* fetch a news headline file via ftp *}
+{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 ''}
+ <div id="weather">{$weather}</div>
+{/if}
+```
-See also [`{capture}`](#language.function.capture),
-[`{eval}`](#language.function.eval),
-[`{assign}`](#language.function.assign) and [`fetch()`](#api.fetch).
+See also [`{capture}`](../language-builtin-functions/language-function-capture.md),
+[`{eval}`](language-function-eval.md),
+[`{assign}`](../language-builtin-functions/language-function-assign.md) and [`fetch()`](../../programmers/api-functions/api-fetch.md).