Displaying an icon showing the file type.

Permalink
Hi,
I am building a site for a choir. In the intranet, the director will place different files on pages, with the usual procedure to add a block file.

I thought that copying the concrete>blocks>file>view.php into the the blocks>file>view.php would allow me to manage a way to display a class, something like:

$fvID = $f->getFileID();
   $fv = $f->getVersion($fvID)
   $fType = $fv->getType();
?>
<a class="<?php echo $fType; ?>" href="<?php echo  View::url('/download_file', $controller->getFileID(),$cID) ?>"><?php echo  stripslashes($controller->getLinkText()) ?></a>


But this is not working, this code is note fired. What am I doing wrong?

GuyVerville
 
JohntheFish replied on at Permalink Reply
JohntheFish
Have a look at the "list files from set" addon and the separate templates addon for it.
http://www.concrete5.org/marketplace/addons/list-files-from-set/...
http://www.concrete5.org/marketplace/addons/image-list-templates/...

If you take out the restriction to images, I think the thumbnailer will display the fireset default image (could be wrong on that without checking the detail).

You could also attach an icon/image attribute to a file and display that.

It won't be a solution, but I expect contains enough clues that you can work out what you need to finish your own solution.
GuyVerville replied on at Permalink Reply
GuyVerville
Thank you, but I have a just found this answer here. I should have been more patient before posting :-)

http://www.concrete5.org/documentation/how-tos/developers/file-bloc...