For one of my content types (event) I've created a node--event.tpl.php file.
I've added a bunch of fields, most are text, so to display the fields values I do:
print $content['field_event_web_site']['#items']['0']['value'];
(Hopefully that's the best way to do that?)
But some of those fields are the field type IMAGE, so I can't just do
print $content['field_event_image']['#items']['0']['value'];
I can see there's a field_data_field_event_image table that stores things like field_event_image_alt that I'll need, but the path to the image and the file name are stored in the file_managed table.

So how do I get the fields I need out of file_managed like URI and FILENAME?
Is there a good resource somewhere I missed that explains all this better?

Comments

Blakesterz’s picture

So This Comment started me off, and I found another thread with a suggestion to use the DEVEL and the RENDER module to see what was going on in there. I could see that the field_event_web_site was an array, and the render module did a good job of showing just where the path showed up. So I ended up with this:
src="/sites/default/files/files/events/event_images/<?print $content['field_event_image']['#items']['0']['filename'];

liuwei0514’s picture

print render($content['field_photos']);

axiom3279’s picture

I have the same issue as this, however my array is a bit more nested than the original poster's. Nowhere in the $content array do I see the 'field_photos' element.