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 angle brackets (e.g.
break="li") or some string to separate list items. - Default: br (see break cross-reference).
breakby="integer(s)"v4.7.0+- 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 andbreakhappens as soon as it changes. Note thatstringmust be enclosed in *double* quotes. - Default: 1 (unset) (see breakby cross-reference).
breakform="form name"- A form to be used as
break, generally jointly withbreakbyattribute. 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:
db,float,html,integer,js,json,lower,number,ordinal,quote,[r|l]trim,spell,tags,textile,tidy,title,upper,url, _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.
limit="number"v4.8.8+- The maximum number of items to display per page in lists.
- Values: Any integer.
- Default: unset (see limit cross-reference).
not="boolean"- Switch
parts. - Values: 0 (no) or 1 (yes).
- Default: unset (0).
offset="number"v4.8.8+- Apply the given pagination offset to the (list of) things being iterated. May be set by URL parameters.
- Values: Any integer.
- Default: 0 (see offset cross-reference).
sort="column direction"v4.8.8+- Sort the output by the given comma-separated column(s) and (optional) order direction(s).
- Values: Specify any valid column name, followed by a space and then either
ascordescto sort that column in ascending or descending order. Userand()for random sorting order. - Default: 0 (see sort cross-reference).
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.
variable="value"v4.9.0+- Assign the output of the tag to the named variable, instead of displaying it.
- Values: Any valid string to be used as a variable name.
- 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.