How to get only field value in View template How can I access/print the raw value of a date field? (or any field for that matter). I am working in a View template and I typically use $fields['field_myfield']-&gt;content. But that gives me the HTML not just the value.

My template.php file:

 function mytheme_preprocess_views_view_fields(&amp;$variables)
{
    $view = $variables['view'];
    if($view-&gt;name == "news_main_list")
    {
          $variables['news_date'] = $variables['fields']['field_news_date_text']-&gt;content;
          $variables['news_type'] = $variables['fields']['field_news_type']-&gt;content;
          $variables['theme_hook_suggestions'][]='views_view_fields__news_main_list__block_1'; 
     }
 }


My views-view-fields--news-main-list--block-1.tpl.php file:

  &lt;?php if (!empty($field-&gt;separator)): ?&gt;
&lt;?php print $field-&gt;separator; ?&gt;


  

  &lt;?php print $field-&gt;wrapper_prefix; ?&gt;
&lt;?php print $field-&gt;label_html; ?&gt;

&lt;p class="newsTitle"&gt;&lt;?php print $fields['title']-&gt;content; ?&gt;&lt;/p&gt;
&lt;p class="dateByLine"&gt;
    &lt;?php print $news_date; ?&gt; | &lt;?php print $news_type; ?&gt;
    &lt;?php if ($news_type == "event") : ?&gt;
        &lt;?php print 'hello'; ?&gt;
    &lt;?php endif; ?&gt;
&lt;/p&gt;

  &lt;?php print $field-&gt;wrapper_suffix; ?&gt;
You must specify which one of Views template files you are working on, If it is views-view-fields.tpl.php then $fields variable is availabe but if it is not views-view-fields.tpl.php then $view object is available. use kpr($variable) to get the $variable available properties. 

You can also use hook_preprocess_views_view_fields(&amp;$var) to set the values of fields in $var array then retrieve them in fields template file



UPDATE:

First define the following function in your template.php file

    function THEME_preprocess_views_view_fields(&amp;$variables)
    {
        $view = $variables['view'];
        if($view-&gt;name == "THE_VIEW_NAME")
        {
              $variables['my_field'] =strip_tags( $variables['fields']['field_myfield']-&gt;content);
              $variables['title'] =strip_tags( $variables['fields']['title']-&gt;content);
              $variables['theme_hook_suggestions'][]='views_view_fields__SOMETHING'; 
         }
     }


By this function the $my_field and $title variables are available in the views-view-fields--SOMETHING.tpl.php file. You have to create views-view-fields--SOMETHING.tpl.php file in your theme directory and use above variables in it. views-view-fields--SOMETHING.tpl.php file is created to theme every output (record or row of columns) of your View. Make sure you are using - instead of _ when creating views-view-fields--SOMETHING.tpl.php file.

$view variable is a variable that contains every detail of the current View. you can use kpr($view) to see its results.