Custom template file field output I have a Netrunner Card content type. (It's a card game I play.) I have a "field_card" field that holds the card image.
In the node--netrunner-card--Runner_Identity_Card--full.tpl.php file, I am trying to control the output of each field. Instead, I seem to just be dumping the same fields on the screen.

I tried using the following code.

&lt;img src="&lt;?php print render($content['field_card'])?&gt;" /&gt;


It scattered the HTML, because the output of render() is the HTML.
What is the standard practice for doing what I am trying to do?

I'm trying to theme the output of each card to make it look like I want it to be, and to learn the theming engine for Drupal.
Typically, to control the output of your field you'd just print out all your fields in your template files by doing precisely what you have up there:

&lt;?php print render($content['your_field_name']); ?&gt;


You can have as much html in your template file in addition to these rendered fields and then style them with css!  So you can have

&lt;div id="some_field_grouping"&gt;
  &lt;?php print render($content['field_1']); ?&gt;
  &lt;?php print render($content['field_2']); ?&gt;
&lt;/div&gt;


And then theme this with css using any of the ids and classes you get and whatever the fields themselves render.

If you really need to modify the field's output more precisely and the standard output from print render doesn't work for you, you could certainly look into the field structure itself and grab the individual field parts you need.  I'd only do this if you absolutely need to...

To start peering into the exact structure of the fields, I'd


Install and enable the devel module... You can just enable the 'Devel' module that comes with it for this purpose
In your template file, put a 

&lt;?php dsm($content['your_field']); ?&gt; 


statement somewhere.  That function is only available if you have the devel module enabled, and it will print out the field array for you to inspect in detail.  Here is an example of the dsm output:

Once you can look into the structure of that array, you can take any pieces of the field you need, if you don't want to render it in the default way.


So, you can do something like getting only the uri of your image...

&lt;img src="&lt;?php print $content['field_image'][0]['#item']['uri']; ?&gt;" &gt;


Anyway, hope this helps!