drupal_is_front_page
- Versions
- 4.7 – 7
drupal_is_front_page()
Check if the current page is the front page.
Return value
Boolean value: TRUE if the current page is the front page; FALSE if otherwise.
Code
includes/path.inc, line 325
<?php
function drupal_is_front_page() {
// Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static = array();
isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
$is_front_page = &$drupal_static[__FUNCTION__];
if (!isset($is_front_page)) {
// As drupal_path_initialize updates $_GET['q'] with the 'site_frontpage' path,
// we can check it against the 'site_frontpage' variable.
$is_front_page = ($_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')));
}
return $is_front_page;
}
?>Login or register to post comments 