You are here

function page_title_page_get_title in Page Title 5

Same name and namespace in other branches
  1. 8.2 page_title.module \page_title_page_get_title()
  2. 5.2 page_title.module \page_title_page_get_title()
  3. 6.2 page_title.module \page_title_page_get_title()
  4. 6 page_title.module \page_title_page_get_title()
  5. 7.2 page_title.module \page_title_page_get_title()
  6. 7 page_title.module \page_title_page_get_title()

Determines what title should be sent to the page template.

Call this function from the page hook of function _phptemplate_variables in template.php.

Return value

string The page's title.

1 call to page_title_page_get_title()
_phptemplate_variables in ./template.php

File

./page_title.module, line 176
Enhanced control over the page title (in the head tag).

Code

function page_title_page_get_title() {
  static $title = NULL;
  if (is_null($title)) {
    $page_title_individual = variable_get('page_title_individual', '!page_title | !site_name');
    $page_title_front = variable_get('page_title_front', '!site_name | !site_slogan');

    // this is the normal title. For node pages it is $node->title
    $drupal_title = drupal_get_title();

    // this is the custom page title. For node pages it is $node->page_title.
    $page_title = page_title_set_title() ? page_title_set_title() : $drupal_title;
    $page_title = strip_tags($page_title);
    $site_name = variable_get('site_name', 'drupal');
    $site_slogan = variable_get('site_slogan', '');
    if (drupal_is_front_page() || !$drupal_title) {
      $title = t($page_title_front, array(
        '!site_name' => $site_name,
        '!site_slogan' => $site_slogan,
      ));
    }
    else {
      $title = t($page_title_individual, array(
        '!page_title' => $page_title,
        '!site_name' => $site_name,
        '!site_slogan' => $site_slogan,
      ));
    }
  }
  return $title;
}