When we theming Drupal 7 for page.tpl.php, we can use followed code to get current page’s title:

<?php print drupal_get_title(); ?>

Gets the title of the current page.

The title is displayed on the page and in the title bar.

Return value

The current page’s title.

File

includes/bootstrap.inc, line 1855

Functions that need to be loaded on every Drupal request.

Code

function drupal_get_title() {
  $title = drupal_set_title();

  // During a bootstrap, menu.inc is not included and thus we cannot provide a title.
  if (!isset($title) && function_exists('menu_get_active_title')) {
    $title = check_plain(menu_get_active_title());
  }
  return $title;
}
0 Likes
684 Views

You may also like

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter message.