current_path

Versions
7
current_path()

Return the current URL path of the page being viewed.

Examples:

This function is not available in hook_boot() so use $_GET['q'] instead. However, be careful when doing that because in the case of Example #3 $_GET['q'] will contain "path/alias". If "node/306" is needed, calling drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL) makes this function available.

Return value

The current Drupal URL path.

▾ 3 functions call current_path()

drupal_cache_system_paths in includes/path.inc
Cache system paths for a page.
drupal_lookup_path in includes/path.inc
Given an alias, return its Drupal system URL if one exists. Given a Drupal system URL return one of its aliases if such a one exists. Otherwise, return FALSE.
overlay_enable in modules/overlay/overlay.install
Implements hook_enable().

Code

includes/path.inc, line 381

<?php
function current_path() {
  return $_GET['q'];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.