I’ve built a view using the views module in Drupal to display a grid of thumbnail images (field_image) that are linked to a full size image for use with Lightbox.
I’ve got that part working but I also display caption text beneath the thumbnail image. I want to append this caption text to the A tag like: <a href="image/photo.jpg" title="My Image Caption">...</a>
I looked at overriding the views-view-field.tpl.php template but this is no HTML in this template it just prints $output;
I’m assuming that some PHP function somewhere in the views module is generating the actual HTML code for the link but I don’t know where and how to override it in my theme.
Any help would be appreciated.
The $output for
views-view-field.tpl.phpis generated by default in the views field handler itself. You can set aside the $output variable, and use the template variables mentioned in the comments at the start of the file to build your own output.I install the devel module, then using
dpm($row)(etc) to see what values are available. All fields your View is pulling are available in the template. This includes fields for which you check on the “Exclude” option.In building your link, I suggest you use the Drupal API functions, that way the link will be properly modified by other Drupal functions.