[TYPO3-mvc] Fluid : file download, icon, size
Bastian Waidelich
bastian at typo3.org
Wed Jun 29 17:45:44 CEST 2011
"Ismaël Bidau" worte:
Hi,
> [...] I would like to have the link, the icon before and the file size
> after.
The DDD way to do this would be to have a model that represents a file with
methods like getPathAndFilename(), getSize() getIcon() etc..
Then you could use it like
<a href="{file.pathAndFilename}">{file.name} ({file.size})</a>
> Is there a viewHelper somewhere ?
Not provided with Fluid, you can have a look at this one though:
http://forge.typo3.org/issues/8779
But it expects the size as bytes, so you need to have that available in the
template. You could also write a ViewHelper for that.. But a ViewHelper
calculating the size of a file would violate its responsibility IMO. Instead
you should calculate the size in the Model or a dedicated Service.
HTH
Bastian
More information about the TYPO3-project-typo3v4mvc
mailing list