Why isn't my view title displaying? I have a view, displaying in a block, with a views-view--VIEWNAME--block-1.tpl.php:

&lt;div class="X"&gt;
    &lt;h2&gt;
    &lt;?php 
        print render($title_prefix);
        if ($title): print $title; endif;
        print render($title_suffix); 
    ?&gt;
    &lt;/h2&gt;
    ...some view content...
&lt;/div&gt;


Most of the content in this template has been copied straight from the template given by theme => information => display template in the view settings.

This displays (with some whitespace differences):

&lt;section id="block-views-VIEWNAME-block-1" class="block block-views"&gt;
    &lt;h2&gt;BLOCK TITLE&lt;/h2&gt;
    &lt;div class="content"&gt;
        &lt;div class="X"&gt;
        &lt;h2&gt;&lt;/h2&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    ...some view content...
&lt;/section&gt;


Why is the view not displaying the view title inside the &lt;h2&gt;? The title is definitely set for the view.

I've put the following code in the view template:

print print_r(array_keys(get_defined_vars()), 1);


And the result (including "title" at index 30) is:

Array
(
    [0] =&gt; template_file
    [1] =&gt; variables
    [2] =&gt; view
    [3] =&gt; view_array
    [4] =&gt; theme_hook_suggestion
    [5] =&gt; theme_hook_suggestions
    [6] =&gt; zebra
    [7] =&gt; id
    [8] =&gt; directory
    [9] =&gt; classes_array
    [10] =&gt; attributes_array
    [11] =&gt; title_attributes_array
    [12] =&gt; content_attributes_array
    [13] =&gt; title_prefix
    [14] =&gt; title_suffix
    [15] =&gt; user
    [16] =&gt; db_is_active
    [17] =&gt; is_admin
    [18] =&gt; logged_in
    [19] =&gt; is_front
    [20] =&gt; rows
    [21] =&gt; css_name
    [22] =&gt; name
    [23] =&gt; display_id
    [24] =&gt; header
    [25] =&gt; footer
    [26] =&gt; exposed
    [27] =&gt; more
    [28] =&gt; feed_icon
    [29] =&gt; pager
    [30] =&gt; title
    [31] =&gt; attachment_before
    [32] =&gt; attachment_after
    [33] =&gt; dom_id
    [34] =&gt; classes
    [35] =&gt; attributes
    [36] =&gt; title_attributes
    [37] =&gt; content_attributes
)
Just had the same problem on another site: for some reason the view title ($handler-&gt;display-&gt;display_options['title'] = 'Blogs';) was coming out in the page.tpl.php template $title, but not in the views-view.tpl.php $title (despite the default template for that page suggesting that it should). Possibly the variable gets undefined after it's used in an "earlier" template? Or maybe the title variable is only set for the view template if the view is being rendered as a block, on the assumption that the page template has already printed the title for the page?

Anyway, the solution is just to do the printing in the page.tpl.php right before rendering the page content (which will likely come from either the node template or a view depending on the page):

&lt;h1&gt;&lt;?php print $title; ?&gt;&lt;/h1&gt; &lt;!-- either our view title or our node title --&gt;
&lt;?php print render($page['content']); ?&gt;


Of course if you're doing this you need to make sure not to print the $title variable out in the node template because if you do that you'll have the title printing twice.