Same name and namespace in other branches
  1. 4.6.x includes/menu.inc \menu_set_active_item()
  2. 4.7.x includes/menu.inc \menu_set_active_item()
  3. 5.x includes/menu.inc \menu_set_active_item()
  4. 6.x includes/menu.inc \menu_set_active_item()

Sets the active path, which determines which page is loaded.

Note that this may not have the desired effect unless invoked very early in the page load, such as during hook_boot(), or unless you call menu_execute_active_handler() to generate your page output.

Parameters

$path: A Drupal path - not a path alias.

Related topics

2 calls to menu_set_active_item()
drupal_deliver_html_page in includes/common.inc
Packages and sends the result of a page callback to the browser as HTML.
user_page in modules/user/user.pages.inc
Page callback: Displays the user page.

File

includes/menu.inc, line 2364
API for the Drupal menu system.

Code

function menu_set_active_item($path) {
  $_GET['q'] = $path;

  // Since the active item has changed, the active menu trail may also be out
  // of date.
  drupal_static_reset('menu_set_active_trail');
}