chris.paschen
Chris Paschen
I need to use the fileupload item to provide downloadable files.
The file needs to be displayed with just an icon and title/caption (under the icon).
I've tried all the configuration settings of the fileupload element and can't seem to (easily) make this work, short of creating a complete custom template (which is very time-consuming when I have several templates and have to modify each to handle this element.
Here's what I've already tried...
1. Access image
Changing the 'access image' setting on the Downloads tab of the element. Even though this MIGHT provide some solution (when I know the file-type of the files and they stay the same per element), clicking the icon that is displayed just links back to the same details page on the front-end (i.e. it doesn't actually provide a download link).
2. Custom template code
Here's the only way that I've been able to make it work - to completely customize each template where this element needs to be used, and by adding other elements to provide the necessary pieces of info:
[NOTE: The fileupload element is part of a repeating group, one group for each downloadable file]
Where
$filetypeiconURL is a url to the proper icon (I have a 'filetype' selector in the group to allow manually selecting the proper file type, that then provides the iconURL via a db lookup).
$fileURL is the raw URL from the fileupload element
$filename is taken from a field element (so that the 'name' can be different than the actual/real filename)
I would LOVE to know if there is a way that I can just modify the fileupload element directly, to at least be able to have the icon image automatically displayed based upon the file type.
I've seen one other thread that covers something similar here:
http://fabrikar.com/forums/index.ph...element-in-table-view-solved.5954/#post-29851
But it's quite old (and doesn't match current Fabrik file/code structures).
I need to use this functionality on at least a couple other projects soon and am willing to put in some time to hack away at this (or test other code) and share back with everyone else.
If there are docs somewhere that show how to do this, please point me there (I couldn't find them searching anywhere). I'm sure this would be a help to others (and I'm surprised if I'm the first to have this need in Fabrik).
Thanks for any help you can give!
The file needs to be displayed with just an icon and title/caption (under the icon).
I've tried all the configuration settings of the fileupload element and can't seem to (easily) make this work, short of creating a complete custom template (which is very time-consuming when I have several templates and have to modify each to handle this element.
Here's what I've already tried...
1. Access image
Changing the 'access image' setting on the Downloads tab of the element. Even though this MIGHT provide some solution (when I know the file-type of the files and they stay the same per element), clicking the icon that is displayed just links back to the same details page on the front-end (i.e. it doesn't actually provide a download link).
2. Custom template code
Here's the only way that I've been able to make it work - to completely customize each template where this element needs to be used, and by adding other elements to provide the necessary pieces of info:
PHP:
echo '<a href="'.$fileURL.'" target="_blank"> <img border="0" alt="'.$filename.'" src="'.$filetypeiconURL.'"></a>';
echo '<p class="downloadiconcaption">'.$filename.'</p>';
[NOTE: The fileupload element is part of a repeating group, one group for each downloadable file]
Where
$filetypeiconURL is a url to the proper icon (I have a 'filetype' selector in the group to allow manually selecting the proper file type, that then provides the iconURL via a db lookup).
$fileURL is the raw URL from the fileupload element
$filename is taken from a field element (so that the 'name' can be different than the actual/real filename)
I would LOVE to know if there is a way that I can just modify the fileupload element directly, to at least be able to have the icon image automatically displayed based upon the file type.
I've seen one other thread that covers something similar here:
http://fabrikar.com/forums/index.ph...element-in-table-view-solved.5954/#post-29851
But it's quite old (and doesn't match current Fabrik file/code structures).
I need to use this functionality on at least a couple other projects soon and am willing to put in some time to hack away at this (or test other code) and share back with everyone else.
If there are docs somewhere that show how to do this, please point me there (I couldn't find them searching anywhere). I'm sure this would be a help to others (and I'm surprised if I'm the first to have this need in Fabrik).
Thanks for any help you can give!