drupal_is_front_page
function drupal_is_front_page
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.
File
- includes/path.inc, line 284
- Functions to handle paths in Drupal, including path aliasing.
Code
function drupal_is_front_page() { // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; if (!isset($drupal_static_fast)) { $drupal_static_fast['is_front_page'] = &drupal_static(__FUNCTION__); } $is_front_page = &$drupal_static_fast['is_front_page']; 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'] == variable_get('site_frontpage', 'node')); } return $is_front_page; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_is_front_page/7.x