How to Customize View Output I'm working on some views and I came across a requirement I'm not sure how to handle. 

I need the title for each returned item to link to a specific URL. However, if another field (a link field) isn't empty, link to that link instead. I believe I need to edit the view template files but I'm not sure how to get started. 


In my view, I've found the "Theme: Information" section and am able to get template files working for my view. However, it's listing display, style, row, and field templates. Where would I incorporate the logic I described above for the title field? 
Once in a template file I am unsure of what variables are available to me. Is there a list or a way to discover these?
Views is rendered by some of *.tpl.php files, they are:


views-view.tpl.php. Main view template.
views-view-unformatted.tpl.php. Default simple view template to display a list of rows.
views-view-fields.tpl.php. Default simple view template to all the fields as a row.
views.view-field.tpl.php. This template is used to print a single field in a view.


If you want to use two different fields from one view in one file, I recommend to use views-view-fields.tpl.php where you can manipulate of all fields which you assign to view.

The views-view-fields.tpl.php has three variables to use: $view, $fields and $row. I suggest to use only $fields.

Then, if you have field named field_image you can render its using $fields['field_image']-&gt;content or $fields['field_image']-&gt;raw. 

Also, I recommend to read more about it: Views template files