$fields is undefined - custom theme creation I'm attempting to create a custom template for a view. The template file I'm creating is being loaded (if I add some static html it renders).

I'm having trouble accessing values from the view. The tutorial I'm using advises using 

dpm($fields);


To output the available fields.
This is coming up as an undefined variable.

Googling suggests using $rows instead of fields but this was also undefined in this case.
The $fields variable will be available for theming only if you have selected to display fields  instead of content, check under format section of view.    

Secondly, the $fields variable is not available if your template file is views-view.tpl.php, you have to use views-view-field.tpl.php or if you want theme only a specific field, you can use views-view-field--fieldname.tpl. php.