arg

Versions
4.6 – 5
arg($index)
6 – 7
arg($index = NULL, $path = NULL)

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 functions call 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.
aggregator_page_rss in modules/aggregator.module
Menu callback; generate an RSS 0.92 feed of aggregator items or categories.
aggregator_page_source in modules/aggregator.module
Menu callback; displays all the items captured from a particular feed.
archive_calendar in modules/archive.module
Generates a monthly calendar, for display in the archive block.
block_admin_display in modules/block.module
Generate main block administration form.
blogapi_blogapi in modules/blogapi.module
blog_link in modules/blog.module
Implementation of hook_link().
book_admin_edit_submit in modules/book.module
book_block in modules/book.module
Implementation of hook_block().
book_form in modules/book.module
Implementation of hook_form().
book_help in modules/book.module
Implementation of hook_help().
book_menu in modules/book.module
Implementation of hook_menu().
comment_admin_overview in modules/comment.module
Menu callback; present an administrative comment listing.
comment_menu in modules/comment.module
Implementation of hook_menu().
comment_node_url in modules/comment.module
contact_admin_delete_submit in modules/contact.module
Process category delete form submission.
contact_admin_edit in modules/contact.module
Category edit page.
contact_admin_edit_submit in modules/contact.module
Process the contact category edit page form submission.
contact_mail_user in modules/contact.module
Personal contact page.
contact_mail_user_submit in modules/contact.module
Process the personal contact page form submission.
contact_menu in modules/contact.module
Implementation of hook_menu().
filter_admin_configure in modules/filter.module
Menu callback; display settings defined by filters.
filter_admin_delete in modules/filter.module
Menu callback; confirm deletion of a format.
filter_help in modules/filter.module
Implementation of hook_help().
filter_menu in modules/filter.module
Implementation of hook_menu().
filter_tips_long in modules/filter.module
Menu callback; show a page with long filter tips.
forum_menu in modules/forum.module
Implementation of hook_menu().
forum_prepare in modules/forum.module
Implementation of hook_prepare; assign forum taxonomy when adding a topic from within a forum.
help_page in modules/help.module
Menu callback; prints a page listing general help for all modules.
legacy_menu in modules/legacy.module
Implementation of hook_menu().
locale_admin_manage_delete_form in modules/locale.module
User interface for the language deletion confirmation screen.
locale_menu in modules/locale.module
Implementation of hook_menu().
menu_edit_item_form in modules/menu.module
Present the menu item editing form.
menu_edit_menu_form in modules/menu.module
Menu callback; handle the adding/editing of a new menu.
node_delete_confirm in modules/node.module
Menu callback -- ask for confirmation of node deletion
node_form_alter in modules/node.module
Implementation of hook_form_alter().
node_help in modules/node.module
Implementation of hook_help().
node_menu in modules/node.module
Implementation of hook_menu().
node_page in modules/node.module
Menu callback; dispatches control to the appropriate operation handler.
node_revisions in modules/node.module
Menu callback for revisions related activities.
phptemplate_page in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_page function to be passed into a pluggable template engine.
poll_menu in modules/poll.module
Implementation of hook_menu().
poll_results in modules/poll.module
Callback for the 'results' tab for polls you can vote on
poll_view in modules/poll.module
Implementation of hook_view().
poll_vote in modules/poll.module
Callback for processing a vote
profile_block in modules/profile.module
Implementation of hook_block().
profile_browse in modules/profile.module
Menu callback; display a list of user information.
profile_field_form in modules/profile.module
Menu callback: Generate a form to add/edit a user profile field.
profile_form_profile in modules/profile.module
profile_save_profile in modules/profile.module
profile_validate_profile in modules/profile.module
search_menu in modules/search.module
Implementation of hook_menu().
search_view in modules/search.module
Menu callback; presents the search form and/or search results.
statistics_exit in modules/statistics.module
Implementation of hook_exit().
statistics_menu in modules/statistics.module
Implementation of hook_menu().
statistics_node_tracker in modules/statistics.module
statistics_user_tracker in modules/statistics.module
system_help in modules/system.module
Implementation of hook_help().
taxonomy_form_term in modules/taxonomy.module
taxonomy_menu in modules/taxonomy.module
Implementation of hook_menu().
theme_book_admin_table in modules/book.module
tracker_menu in modules/tracker.module
Implementation of hook_menu().
tracker_track_user in modules/tracker.module
Menu callback. Prints a listing of active nodes on the site.
user_admin in modules/user.module
user_admin_role in modules/user.module
Menu callback: administer roles.
user_block in modules/user.module
Implementation of hook_block().
user_edit in modules/user.module
user_menu in modules/user.module
Implementation of hook_menu().
user_user in modules/user.module
Implementation of hook_user().
_aggregator_page_list in modules/aggregator.module
Prints an aggregator page listing a number of feed items. Various menu callbacks use this function to print their feeds.
_user_edit_validate in modules/user.module

Code

includes/path.inc, line 148

<?php
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];
  }
}
?>
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.