How do I create and theme an image link in Drupal 7 Views? Ok... here goes. I've had a lot of trouble trying to track down any sort of example like this, and the Drupal 7 Views documentation doesn't even document the views-view-field.tpl.php.

I'm trying to override the default display for a field inside of a view because the default field html content is not at all sufficient to my needs. I can almost do it, except that the views module likes to inexplicably wrap the field content in a  that I cannot override through the templates. Also I'm forced to hack into the field's $row variable internals directly, which does not strike me as a good long term strategy.

views-view-fields--slider.tpl.php

&lt;div class="slider-item"&gt;
  &lt;a href="&lt;?php echo $fields['field_slide_link']-&gt;content; ?&gt;"&gt;
    &lt;img src="&lt;?php echo $fields['field_slide_image']-&gt;content; ?&gt;"&gt;
  &lt;/a&gt;
&lt;/div&gt;


views-view-field--field-slide-image.tpl.php

&lt;?php echo image_style_url('slide', $row-&gt;field_field_slide_image[0]['raw']['uri']); ?&gt;


views-view-field--field-slide-link.tpl.php

&lt;?php echo $row-&gt;_field_data['nid']['entity']-&gt;field_slide_link['und'][0]['safe_value']; ?&gt;


So to summarize the two problems:


Diddling with the $row internals directly makes me quite uncomfortable. Surely there's a better and safer way of getting the not quite raw field values that I care about.
The rendered field content is always wrapped in a div.field-contain and I cannot eliminate it through the template, as I would have expected. I'm loath to call strip() to remove the html (I can think of several use cases where I might not want that wrapper).
This doesn't directly answer your two questions but should help...

The Views documentation on template overrides doesn't need to be particularly good...as those overrides are self documenting.

Open up any View for edit, open the Advanced fieldset, and click "Theme: Information" at the bottom.

You'll get something like this:



A complete list of every template file available for every field, and the view itself. From there you should be able to experiment quite quickly to find the template name you're looking for.