File download
Contents
Syntax
<txp:file_download />
The file_download tag is a single tag which Textpattern will replace with Textpattern ‘file’ type Form templates. Inside that form go the other file tags.
Attributes
Tag will accept the following attributes (case-sensitive) as well as the global attributes :
filename="name"- Filename of the file to link to.
- Default: unset (nothing is returned).
form="form name"- Use specified form template to process the files.
- Default:
files. id="integer"- File
idof the file to link to. - Default: unset (nothing is returned).
Common global attributes
These attributes are shared by all tags - and plugins, provided they do not override the functionality.
break="value"- Where value is an HTML element, specified without brackets (e.g.
break="li") or some string to separate list items. - Default: br (see break cross-reference).
breakby="integer(s)"- Used to group list items when separating by
break. Possible values are lists of integers, like2(groups of 2 items) or1,2(alternate groups of 1 and 2 items). Otherwise, the value is evaluated on each loop and `break` happens as soon as it changes. Note that `string` must be enclosed in *double* quotes. - Default: 1 (unset) (see breakby cross-reference).
breakform="form name"- A form to be used as `break`, generally jointly with `breakby` attribute. The special `<+>` pattern in this form will be replaced with the list "chunk" accumulated when break happens.
- Default: unset (see breakform cross-reference).
class="class name"- HTML
classto apply to the wrapper. - Values: Any valid string.
- Default: unset.
default="value"- The value to display if the tag's output is blank.
- Values: Any.
- Default: unset.
escape="list, of, transforms"- The transforms to apply to the output. See tag escaping for details.
- Values:
html,js,json,url,float,integer,number,ordinal,spell,lower,upper,title,[r|l]trim,quote,tags,textile, _any tag_ - Default: html.
evaluate="number list"- Alter the processing order of top-level tags inside a form/container. Tags are normally executed from top to bottom. If you wish to change this order, imagine Textpattern tags are numbered incrementally from 1 inside a container. To process tags 3 and 5 first, then 1, 2, and 4, specify
evaluate="3, 5"in your container tag. - Values: Any comma-separated numbers corresponding with the numerical position of primary (top-level) tags inside the container.
- Default: unset.
html_id="value"- HTML
idto apply to the wrapper. - Values: Any valid string.
- Default: unset.
label="value"- The label to display before the output.
- Values: Any valid string.
- Default: unset.
labeltag="tag"- The tag (without angle brackets) to wrap the label.
- Values: Any valid HTML tag, e.g.
h3ordiv. - Default: unset.
not="boolean"- Switch
parts. - Values: 0 (no) or 1 (yes).
- Default: unset (0).
replace="string"- Replace the content stripped via the
trimattribute. - Values: Any valid string.
- Default: unset.
trim="string or regex"- Remove the matching patterns from the output.
- Values: Any. Use
/value/to trigger regular expression matching, otherwise the value will be treated verbatim as a set of characters to trim. - Default: unset.
wrapform="form name"- The form to be used as
wraptag. Handy if the wraptag pattern is too long, or is reused. - Values: Any defined form name.
- Default: unset.
wraptag="tag or pattern"- The tag (without angle brackets) to wrap the output.
- Values: HTML tag or a string containing
<+>pattern that will be replaced by the output. - Default: unset.
Examples
Example 1: Display a download form
<txp:file_download form="new-files" id="1" />
Gets file with id of 1 and displays results using new-files form.