current_path

7 path.inc current_path()
8 path.inc 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.

See also

request_path()

11 calls to current_path()

File

includes/path.inc, line 354
Functions to handle paths in Drupal, including path aliasing.

Code

function current_path() {
  return $_GET['q'];
}

Comments

without language prefix

Will also return URLs without the language prefix.

Login or register to post comments