In view, $content is null when show: fields I'm trying to customize the row style template for one of my views. The settings are


Format: HTML List
Show: Fields


With these settings, $content is null in my .tpl.php file. I know about $fields, and I can see my values in there when I var_dump. However, the values are buried SO DEEP in there that I'm having trouble getting at them. I'm sure I must be doing something wrong.

How do I access my fields in a custom tpl for a view?
It is possible that you don't override the correct template. For the reference see here: Views template files.

There are several different approaches possible, depending of your requirements.


The usual way is to change the output of each field individually, using the field specific override. Access to the raw value and the already rendered content is straight forward using the provided variables. It's very difficult to break something here.
Another way is to use a row specific override. Following this approach it is your responsible to assure to output all fields in the result set for each row. In exchange this can be much more flexible regarding the created markup structure, because it's entirely up to you,


You could go even higher up the abstraction road, but the use cases for that are becoming incredibly scarce. So the odds are your simply in the wrong template.

Also, just in case you don't know that, there is an overview for the available and the used template files in the Views UI. In Drupal 7 and Views 3 it is in the outer right block the last link on the bottom: