Skip to content

Commit fd3f58b

Browse files
authored
Merge pull request #1074 from nep/patch-3
Adding documentation about file:XX:url and compatibility mode
2 parents 09be6d6 + e6ddf9d commit fd3f58b

File tree

5 files changed

+56
-7
lines changed

5 files changed

+56
-7
lines changed

docs/add-ons/file.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ In addition, the File module supports [Pagination](templates/pagination.md).
2323

2424
NOTE: **Note:** If you're looking for how to use file fields in your channel entries loops, you should look at [the file field variable usage documentation](fieldtypes/file.md#template-tags) in the channel fields documentation.
2525

26+
NOTE: **Note:** If you uploaded the file using the Textarea, Text Input or RTE fields, you should look at [the textarea field documentation](fieldtypes/textarea.md#filexxurl-tag--inserting-a-file).
27+
2628
The File Entries tag allows you to display files and their associated meta-data on the frontend through the use of standard ExpressionEngine tags.
2729

2830
Here is a simple example of a possible usage of this tag:
@@ -35,7 +37,7 @@ Here is a simple example of a possible usage of this tag:
3537
{/categories}
3638

3739
{if url:small}
38-
<p><a href="{id_path='gallery/comments'}"><img src="{url:small}" width="{width:small}" height="{height:small}" alt="{title}" title="{title}" /></a></p>
40+
<p><a href="{id_path='gallery/comments'}" title="{title}"><img src="{url:small}" width="{width:small}" height="{height:small}" alt="{title}" /></a></p>
3941
{/if}
4042

4143
{description}
@@ -314,7 +316,7 @@ Multiple instances of the {switch=} tag may be used and the system will intellig
314316

315317
### `{title}`
316318

317-
The title of the entry.
319+
The title of the file.
318320

319321
### `{total_results}`
320322

docs/control-panel/file-manager/file-manager.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ Tip: How to Turn off File Manager Compatibility Mode
189189
<iframe src="https://www.youtube.com/embed/V1sRqz-b83k?si=0YrmOgxxcfhbWl_L" title="Turn off File Manager Compatibility Mode in ExpressionEngine" width="1920" height="1080" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
190190
</div>
191191

192-
ExpressionEngine 7+ stores files in the database differently then previous versions (using `{file:XX:url}` format instead of `{filedir_X}filename.ext`). This enables ExpressionEngine to provide a more powerful overall experience with files, such as storing files in subfolders, moving files to different locations, and collecting file usage data.
192+
ExpressionEngine 7+ stores files in the database differently then previous versions, and references them using a `{file:XX:url}` format instead of `{filedir_X}filename.ext`). This change enables ExpressionEngine to provide a more powerful overall experience with files: you can store files in subfolders, you can move files to different locations without breaking references in content, and EE can track if and where each file is in use.
193193

194-
ExpressionEngine will still parse the `{filedir_X}` tags in templates or channel entries. However, third-party add-ons that parse file data on their own may not be compatible with the `{file:XX:url}` syntax, causing issues. In order to prevent a bad user experience, users can enable Compatibility Mode for the sites that are upgraded from earlier versions. If you know all installed add-ons are compatible with the new file format, you can run the Update File Usage (found in Tools-> Utilities-> Update File Usage) and then disable Compatibility Mode from the [Content & Design settings](/control-panel/settings/content-design.md#run-file-manager-in-compatibility-mode).
194+
However, third-party add-ons that parse file data on their own may not be compatible with the `{file:XX:url}` syntax, causing issues. In order to prevent a bad user experience, users can enable Compatibility Mode for the sites that are upgraded from earlier versions, though for a modern site, it is recommended to leave compatibility mode off.
195+
196+
If you know all installed add-ons are compatible with the new file format, you can run the Update File Usage (found in Tools-> Utilities-> Update File Usage), which will also convert all old file references to the new format. Then disable Compatibility Mode from the [Content & Design settings](/control-panel/settings/content-design.md#run-file-manager-in-compatibility-mode).
197+
198+
Regardless of mode status, ExpressionEngine will still parse the `{filedir_X}` tags in channel entry fields.

docs/fieldtypes/file.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ This variable simply displays the content from the "Descriptive name of upload d
119119

120120
The file's extension, if it has one.
121121

122+
### `{file:XX:url}`
123+
124+
This is not actually a template tag. It appears in the contents of an entry's field to reference a file. See [Textarea Fieldtype](/fieldtypes/textarea.md#filexxurl-tag--inserting-a-file).
125+
122126
### `{file_id}`
123127

124128
The unique id of the file.

docs/fieldtypes/text.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@ Text Input is a single-lined free-form writing space where you can enter text or
1717

1818
### Maximum Characters
1919

20-
The maximum number of characters this field should allow.
20+
The maximum number of characters this field should allow. This will not affect existing entries, but the limit will be in effect when you try to edit them.
2121

2222
### Text Formatting
2323

24-
Specifies how the entered-text will be formatted when rendered on the front-end. Choices include replacing each linebreak with a `BR` tag, automatically surrounding paragraphs with `P` tags, or Markdown processing. [Additional plugins](development/text-formatting.md) may be installed to provide more text formatting options.
24+
Specifies how the entered text will be formatted when rendered on the front-end. Choices include:
25+
26+
* **None** - content will be output exactly as entered
27+
* [**Auto line break**](/general/text-formatting.html#auto-br) - simply replaces each linebreak with a `<br>` tag
28+
* [**Markdown**](/general/text-formatting.html#markdown) - processes content as Markdown and outputs HTML
29+
* **XML Encode** - content is formatted and escaped for safe use in an XML document like an RSS feed
30+
* [**XHTML**](/general/text-formatting.html#auto-xhtml) - Encloses paragraphs with `<p>` tags, adds curly quotes, and does other more advanced processing to make plain text into proper HTML while leaving any HTML intact.
31+
32+
For a text input field, the output may not seem to vary too much. [Additional plugins](development/plugins.md) may be installed to provide more text formatting options.
33+
34+
NOTE: **Note:** To see the Markdown or XML Encode options, those add-ons on must be installed.
2535

2636
### Allow Override?
2737

docs/fieldtypes/textarea.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ Height of the editor in rows of text.
2323

2424
### Text Formatting
2525

26-
Specifies how the entered-text will be formatted when rendered on the front-end. Choices include replacing each linebreak with a `BR` tag, automatically surrounding paragraphs with `P` tags, or Markdown processing. [Additional plugins](development/text-formatting.md) may be installed to provide more text formatting options.
26+
Specifies how the entered text will be formatted when rendered on the front-end. Choices include:
27+
28+
* **None** - content will be output exactly as entered
29+
* [**Auto line break**](/general/text-formatting.html#auto-br) - simply replaces each linebreak with a `<br>` tag
30+
* [**Markdown**](/general/text-formatting.html#markdown) - processes content as Markdown and outputs HTML
31+
* **XML Encode** - content is formatted and escaped for safe use in an XML document like an RSS feed
32+
* [**XHTML**](/general/text-formatting.html#auto-xhtml) - Encloses paragraphs with `<p>` tags, adds curly quotes, and does other more advanced processing to make plain text into proper HTML while leaving any HTML intact.
33+
34+
XHTML is an original EE formatting option and it is a good default for plain text that needs to be output as nice HTML, especially for text that contains some HTML as well. [Additional plugins](development/plugins.md) may be installed to provide more text formatting options.
35+
36+
NOTE: **Note:** To see the Markdown or XML Encode options, those add-ons on must be installed.
2737

2838
### Allow Override?
2939

@@ -37,6 +47,25 @@ Either left-to-right, or right-to-left.
3747

3848
Show formatting buttons to make writing markup easier, show a smiley chooser, or show a file chooser button to easily insert images or links to files.
3949

50+
## {file:XX:url} Tag / Inserting a File
51+
52+
In a textarea field, when you add a file using the field tools, EE will insert code like this:
53+
54+
Images
55+
56+
<img src="{file:XX:url}" alt="" height="200" width="200">
57+
58+
Other Files
59+
60+
<a href="{file:xx:url}">other-file.pdf</a>
61+
62+
When the field is output, EE will replace `{file:XX:url}` with the file's URL.
63+
64+
With that tag in the content of the field, EE will also track the file as being used in this entry. This information is updated whenever an entry is saved with a field containing `{file:XX:url}`. If you reference an uploaded file directly by URL, EE will not track that the file is in use in that entry. This tracking is true for other field types as well, but those other field types often do not display the tag directly as `{file:XX:url}`.
65+
66+
If your site is set to [Compatibility Mode](/control-panel/file-manager/file-manager.md#compatibility-mode) for backwards compatibility with older add-ons, file references will instead look like `{filedir_X}filename.ext` and usage will not be tracked.
67+
68+
4069
## Parsing File Tags
4170

4271
The Textarea fieldtype supports the use of file tags in the format `{file:XX:field}` where `XX` is the file ID and `field` is any field associated with that file, such as `url`, `filename`, `title`, etc.

0 commit comments

Comments
 (0)