Link to file in Fluid – how to specify storage?
Asked Answered
A

4

7

As far as I know, there's no such thing as an f:link.file or v:link.file viewhelper.

There used to be a solution using file.originalResource.publicUrl as the value to point the link to, as in

<f:link.page pageUid="{file.originalResource.publicUrl}" target="_blank">

Am I right that this is no longer necessary? I got this (using ext:mask):

<f:link.page pageUid="{file.identifier}" target="_blank">

returning the same value, while originalResource.publicUrl would not even show up in f:debug.

BUT in file.identifier the storage path, e.g. fileadmin, is not present. How do I add it to the viewhelper?

Or, what is the currently recommended solution for a link to a file in TYPO3 7.6?

Adler answered 2/11, 2016 at 19:48 Comment(1)
See below at https://mcmap.net/q/1408724/-link-to-file-in-fluid-how-to-specify-storage – now there is a VH for TYPO3 11Adler
L
4

TYPO3 11 introduced a new ViewHelper for this

<f:link.file file="{file}" target="_blank">Download</f:link.file>

https://docs.typo3.org/other/typo3/view-helper-reference/11.5/en-us/typo3/fluid/latest/Link/File.html

Lavinalavine answered 13/10, 2021 at 8:17 Comment(0)
F
12

Just use <a href="{file.publicUrl}">{file.name}</a>. When absolute URL or some special configuration is needed use <f:link.typolink parameter="{file.publicUrl}">{file.name}</f:link.typolink>.

Felixfeliza answered 4/11, 2016 at 18:7 Comment(1)
yess, thanks! Why don't I get that property with <f:debug>{file}</f:debug>? It only gives me propertiesOfFileReference, name, mergedProperties, uidOfFileReference, originalFileAdler
L
4

TYPO3 11 introduced a new ViewHelper for this

<f:link.file file="{file}" target="_blank">Download</f:link.file>

https://docs.typo3.org/other/typo3/view-helper-reference/11.5/en-us/typo3/fluid/latest/Link/File.html

Lavinalavine answered 13/10, 2021 at 8:17 Comment(0)
T
2

For me, @minifranske’s solution worked only as a hint: I needed to use {file.originalResource.publicUrl} instead:

<f:link.typolink parameter="{file.originalResource.publicUrl}">{file.originalResource.title}</f:link.typolink>

also available:

{file.originalResource.name}
{file.originalResource.description}
{file.originalResource.alternative}

Nevertheless, if anybody knows a proper core solution which resembles that of the Rich Text Editor, I’d be happy to hear about it:

<a href="t3://file?uid=123">file link</a>
<a href="t3://page?uid=123">page link</a>
Tress answered 6/10, 2020 at 11:25 Comment(0)
E
1

<f:uri.image image="{imageObject}" /> produces the path + filename for your FAL object.

Escobedo answered 2/11, 2016 at 22:44 Comment(1)
This produces the path to a rendered image of my PDF file – I just want a link to itAdler

© 2022 - 2024 — McMap. All rights reserved.