added in views header section is automatically closed: How do I avoid it? I have added a div in views header (Custom text) section like this

 &lt;div class="something"&gt;  


This div's closing tag is added in views footer section. There are some rows  in field section as well. The Display output: template is as below

&lt;?php 
  print $header;
  print $rows; 
  print $footer;
 ?&gt;


So I am expecting the the result as 

&lt;div class="something"&gt;  /* header*/
    &lt;div&gt;row1&lt;/div&gt;      /* In fields */
    &lt;div&gt;row2&lt;/div&gt;      /* In fields */
 &lt;/div&gt;                  /* In Footer*/


But what I am getting is 

 &lt;div class="something"&gt;&lt;/div&gt;
       &lt;div&gt;row1&lt;/div&gt;
       &lt;div&gt;row2&lt;/div&gt;


The div in header is automatically closed by drupal 7. How can i avoid that
Method 1: Unfiltered text

When setting up the header and footer in your view, select Global: Unfiltered text. For the header enter &lt;div class="something"&gt; and for the footer type in &lt;/div&gt;.

If you then override the default views-view.tpl.php, stripping out everything except

&lt;?php print $header; ?&gt;
&lt;?php print $rows; ?&gt;
&lt;?php print $footer; ?&gt;


... you should achieve output similar to:

&lt;div class="something"&gt;        
  &lt;div class="views-row views-row-1"&gt;&lt;/div&gt;
  &lt;div class="views-row views-row-2"&gt;&lt;/div&gt;
&lt;/div&gt; 


Method 2: Use attachments

This might be ideal if editing the header and footer through the Views UI isn't important, but you want some flexibility in the output that wraps around your rows; for example, if you wanted it to be dynamic.

Override the default views-view.tpl.php so that it looks like this:

&lt;?php print $attachment_before; ?&gt;
&lt;?php print $rows; ?&gt;
&lt;?php print $attachment_after; ?&gt;


In a custom module you would then implement hook_views_pre_render():

function MODULENAME_views_pre_render(&amp;$view) {
  $header_str = '&lt;div class="something"&gt;';
  $footer_str = '&lt;/div&gt;';

  if ($view-&gt;name == 'your_view_name' &amp;&amp; $view-&gt;current_display == 'your_display_name') {
    $view-&gt;attachment_before = $header_str;
    $view-&gt;attachment_after = $footer_str;
  }
}


(Remember to clear the cache after adding the function.)

Method 3: Simple template override (simplest but least flexible)

Override the default views-view.tpl.php and simply replace all of the mark-up with

&lt;div class="something"&gt;
&lt;?php print $rows; ?&gt;
&lt;/div&gt;


Hope that helps!

A couple of links that might be useful:


Views template files
Drupal API hook_views_pre_render()