function page_title_page_get_title in Page Title 6
Same name and namespace in other branches
- 8.2 page_title.module \page_title_page_get_title()
- 5.2 page_title.module \page_title_page_get_title()
- 5 page_title.module \page_title_page_get_title()
- 6.2 page_title.module \page_title_page_get_title()
- 7.2 page_title.module \page_title_page_get_title()
- 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()
File
- ./
page_title.module, line 282 - Enhanced control over the page title (in the head tag).
Code
function page_title_page_get_title() {
static $title = NULL;
if (is_null($title)) {
// If frontpage, then use the frontpage pattern and set the title.
if (drupal_is_front_page()) {
$page_title_pattern = variable_get('page_title_front', '[site-name] | [site-slogan]');
$title = token_replace($page_title_pattern);
}
else {
//Get the node for this page
$node = arg(0) == 'node' && is_numeric(arg(1)) ? node_load(arg(1)) : NULL;
//Get the pattern for the node type. If no node type available, assume blank
$page_title_pattern = variable_get('page_title_type_' . (isset($node->type) ? $node->type : ''), '');
//If pattern is emtpy (either if the type is not overridable or simply not set) fallback to the default pattern
if (empty($page_title_pattern)) {
$page_title_pattern = variable_get('page_title_default', '[page-title] | [site-name]');
}
// Return the title using the node scope if node is set, otherwise default to global scope.
if (isset($node)) {
$title = token_replace($page_title_pattern, 'node', $node);
}
else {
$title = token_replace($page_title_pattern);
}
}
}
return $title;
}