How to output view content as grid in custom template? I have created a view for content type xyz with fields F1, F2,F3,F4.

I open the group "advanced", clicked on "Theme: Information".

There are couple of template files, that are used by view. 

I chosen the desired template and copy it into to the template folder. 

Now, from views module, in theme folder, I opened views-view-grid.tpl.php and copy the content of this file to the file I have created in my template folder.

But output is not coming in grid format. 

Is there any way to customize the fields of view in html structure?
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.