function arg in Drupal 4
Same name and namespace in other branches
- 5 includes/path.inc \arg()
- 6 includes/path.inc \arg()
- 7 includes/bootstrap.inc \arg()
Return a component of the current Drupal path.
When viewing a page at the path "admin/node/configure", for example, arg(0) would return "admin", arg(1) would return "node", and arg(2) would return "configure".
Avoid use of this function where possible, as resulting code is hard to read. Instead, attempt to use named arguments in menu callback functions. See the explanation in menu.inc for how to construct callbacks that take arguments.
Parameters
$index: The index of the component, where each component is separated by a '/' (forward-slash), and where the first component has an index of 0 (zero).
Return value
The component specified by $index, or FALSE if the specified component was not found.
75 calls to arg()
- aggregator_form_category_submit in modules/
aggregator.module - Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.
- aggregator_form_feed_submit in modules/
aggregator.module - Process aggregator_form_feed form submissions. @todo Add delete confirmation dialog.
- aggregator_menu in modules/
aggregator.module - Implementation of hook_menu().
- aggregator_page_category in modules/
aggregator.module - Menu callback; displays all the items aggregated in a particular category.
- aggregator_page_last in modules/
aggregator.module - Menu callback; displays the most recent items gathered from any feed.
File
- includes/
path.inc, line 148 - Functions to handle paths in Drupal, including path aliasing.
Code
function arg($index) {
static $arguments, $q;
if (empty($arguments) || $q != $_GET['q']) {
$arguments = explode('/', $_GET['q']);
$q = $_GET['q'];
}
if (isset($arguments[$index])) {
return $arguments[$index];
}
}