Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:45:21+00:00 2026-06-18T15:45:21+00:00

I have a view on a blog page in Drupal 7 that I am

  • 0

I have a view on a blog page in Drupal 7 that I am overriding using a “.tpl.php” or template file so that I can use my own custom HTML and add a title.

Normally, the title of the view can be accessed in the template file using $title or $block->subject but this is not working in my view template file.

Using drupal_get_title() simply displays “Blog” because the page itself is a page template, but I need the title of the block view that is being inserted dynamically with PHP into the page template file.

The weird part is that the title will show in the view preview along with the results of the database query (a.k.a. the fields).

So, how do you access the variable that is normally called $title in the template PHP file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:45:22+00:00Added an answer on June 18, 2026 at 3:45 pm

    First, on the view settings page go into “Theme: Information” under the “Other” section. There you find a list of the file names that can be used to override your view output.

    So, if your view is called “Test View” then you should create a file called views-view--test-view.tpl.php inside your your_theme/templates/views/ folder to override the view’s display settings.

    In that file, put the following:

    <?php if($view->human_name) print "<h2>" . $view->human_name . "</h2>"; ?>
    

    Then under “Theme: information” click the button that says “Rescan template files,” and the title should show up now wherever that view is being shown on your site.

    If that variable is coming up blank, you can get a list of guesses for what to variable to display by putting the following code in that file:

    <?php
    ?>
    <div>
        <?php $list = array_keys(get_defined_vars()); 
        foreach($list as $key => $value)
            print "$" . $value . ", ";
        die();
    
        ?>
    </div>
    

    Each of those variables might be an object or array so you may have to print their content with print_r($variable) or var_dump($variable) to get an idea what is inside of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a blog that has a sidebar with a partial view in it
I have a posts model that I use to make blog posts on a
i have blog system which is every user have their own main page like
i have view like 'home/details/5', it can be access by anonymous user. but there
I have view page with both detailview and gridview the grid view should be
I am beginner in rails. I have view that i try to print inside
I have built a blog application using Ruby on Rails. In the application I
I have created a blog application using Ruby on Rails and have just added
Basically, I have a string of functions that load a set of blog entries
I have a blog written in Django, and I started using the basic Django

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.