I would like to output the raw filefield filepath value of my uploaded file in my views-view-field--....tpl.php.
When I use $fields['field_video_fid']->content, I get the file path and unwanted html markup:
sites/default/files/videos/bars.flv
How do I get just the file path? Also, why is it using the class 'imagefield-formatter-path' instead of filefield-formatter-path'?
Thanks.
Comments
Comment #1
apersaud commentedMy unwanted html markup should have looked like this:
Comment #2
apersaud commentedI decided to get the filepath by just removing the html mark up using strip_tags().
Comment #3
dopry commentedYou can also use the file object... If you're doing custom stuff in your template try a print_r($node) or create a custom formatter...
It's probably available in node->field_name[$delta]['filepath']...
Comment #4
ArtAnna commentedYou can redefine basic output functions from ...\modules\imagecache\imagefield_formatter.inc.
1. In your case copy following function code to your template.php
2. Rename function name as:
function yourthemename_imagefield_formatter_path_plain($element)...3. Delete output in return:
return file_create_path($item['filepath']);Enjoy the silence =)
Comment #5
akahn commentedSure, there are ways around this, but if I'm asking my view to output a raw file path, shouldn't I get a file path, rather than a much less useful filepath-wrapped-in-span-tags? Dopry, what is the reason for wanting these span tags?
Comment #6
elly commentedJust ran into this as well - I'm trying to do some complex views theming and insert the filepath into some other markup, so the extra span tags are really bothersome!