{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.
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)
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 |
Technical Note: This will not support http redirects, be sure to include a trailing slash on your web page fetches where necessary.
Technical Note: 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)