I am using Templavoilà Plus and I have one field which the user complete with a title called field_title
.
I use this field to create an URL/HTML for other fields of my FCE, using Typoscript Object Path.
Constants:
file = fileadmin/datasheets/|.pdf
Setup:
lib.field_datasheet = TEXT
lib.field_datasheet {
field = field_title
wrap = <a href="{$file}"></a>
}
The problem is that I want to do that only if the file/URL exists. First, I thought of checking if the URL I create didn't link to a 404 page. Then I thought it would be easier to check if the file size wasn't 0. After working on that for two days, and after looking everywhere, I realized neither of these solutions were easy…
I think I have bits of answers, using stdWrap.rawUrlEncode
, file:current:size
, if.isTrue.data
, FILE
, etc… but obviously, Typoscript isn't made for beginners, and I can't seem to find how to put everything in the right order, and how to use all this properly.
I think I could manage the condition using something like :
if.isTrue < .10 #.10 containing the size of the file
if.value = 0
But the part which really is difficult is getting the file size from a URL I created using Typoscript. I'm pretty there must be a way to do that only with Typoscript since I know one can get the size of a file from its uid…
Or maybe I should just stick to checking if that URL don't lead to a 404 page. Or maybe there is a simpler solution I didn't think about!
Any help would be greatly appreciated, sorry if that problem is too easy to solve, and thank you very much already for reading this post ! =)
EDIT : I'm using Typo3 7.6