How to output view content as grid in custom template?
what if I want to use html and php


Ok, now that I remember there is another method.

Add the following code to the bottom of your template.php file (located in /sites/all/themes/yourtheme/ folder)

function themename_preprocess_views_view_fields($vars){

      if ($vars['view']-&gt;name == "view_name" &amp;&amp; $vars['view']-&gt;current_display == "block_1"){
        $vars['fields']['title']-&gt;content = // do php or whatever you want to it here
      }
    }



replace themename with your theme name
replace view_name with your view name
replace block_1 with your machine name


To add html, Ex:

function themename_preprocess_views_view_fields($vars){

  if ($vars['view']-&gt;name == "view_name" &amp;&amp; $vars['view']-&gt;current_display == "block_1"){
  $a = $vars['fields']['title']-&gt;content;
  $vars['fields']['title']-&gt;content = "&lt;div class='others'&gt;" . $a . "&lt;/div&gt;";
  }
}


With this method your grid should remain intact.