Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a newbie to Drupal, and have used CakePHP and Codeigniter frameworks earlier. In Codeigniter, a URL such as /users/show/1 would be interpreted as it invoking the show() method of the Users class, passing 1 as user ID. Can we interpret a Drupal URL in this way?

If we have a URL similar to /admin/xyz?u=1, where in the admin module can I find this?

Also, I know Drupal uses a good bit of path alias. Would that affect this in a big way?

share|improve this question

If your looking at code, all the hook_menu function calls is how the non alias paths get created. Things like users and nodes use a % in the path creation; this turns into the argument for the page callback function. Read more about this here: Wildcard Loader Arguments.

function node_menu() {
  $items['node/%node'] = array(
    'title callback' => 'node_page_title', 
    'title arguments' => array(1), 
    'page callback' => 'node_page_view', 
    'page arguments' => array(1), 
    'access callback' => 'node_access', 
    'access arguments' => array('view', 1), 
    'type' => MENU_CALLBACK,


function user_menu() {
  $items['user/%user_uid_optional'] = array(
    'title' => 'My account', 
    'title callback' => 'user_page_title', 
    'title arguments' => array(1), 
    'page callback' => 'user_view', 
    'page arguments' => array(1), 
    'access callback' => 'user_view_access', 
    'access arguments' => array(1), 
    'parent' => '', 
    'file' => 'user.pages.inc',

The function that handles this menu information is menu_execute_active_handler().
Aliases happen as the 2nd to last part of the bootstrap in the drupal_init_path function. It converts /about-us into node/4 for internal use.

For more in depth information check out this link: Drupal menu system (Drupal 6.x)

share|improve this answer

The answer given by mikeytown2 is correct, but it doesn't report what happens before the implementation of hook_menu() made from the modules are invoked.

If you have clear paths enabled in your Drupal site, a URL like example.com/node/1 is converted from the .htaccess file used by Drupal in example.com/index.php?q=node/1. The content of the index.php file is the following one (for Drupal 7):

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';

It is menu_get_active_handler() that, through menu_get_item(), finds which callback outputs the content of the required page (in the example, node/1). Drupal allows the modules to define the paths they are able to handle through wildcards, such as in node/%node, or with plain paths, such as admin/config/search/path; the difference is that in the first case the module is able to handle paths such as node/1, node/2, node/444 while in the second case the module report the exact path it is able to handle.
The modules implement hook_menu() that allows them to define which page callback they assign to the path; that callback is the function that outputs the content that is shown when that path is required.

share|improve this answer

Drupal relies on several basic URLs such node/# or user/#. No further direction is taken from the base URL name. Path alias's can be used to hide the base URL, but its structure is up to the user. Certain modules such as views or panels will read the urls and are capable of using the alias information to perform contextual filtering or create custom displays.

share|improve this answer

I have a cakephp background too and I got what you want to know:

In Drupal a url like /admin/xyz does not necessarily mean that it is generated by a class called admin or by admin module (In fact there's no admin module).

If you want to know which function (controller action) responsible of generating the content in Drupal, let's check the following:

in cakephp

   class MyModuleController extends ApplicationController{
       public function hello_world($arg) {
          return 'Hello World';

So the url will be my_module/hello_world/*

let's take a look at the following drupal module:

    function mymodule_menu() {
        $items = array();
       // in the first line after this comment my_module/hello_world is the non aliased url 
       // like the whole posts/view part
       // which can be your_module/admin/hello_george this can help in placing your menu item
       // in the right hierarchy globally
        $items['my_module/hello_world'] = array( //the url my_module/hellow_world
            'title' => 'Hello World Test',
            'page callback' => 'say_hello_world', //the function called
            'page arguments' => array(''), // the arguments like 123 in posts/view/123
            'access arguments' => array('access content'), //permission
            'type' => MENU_CALLBACK,
        return $items;

    function say_hello_world() {
        return 'Hello World!';

again the url will be my_module/hello_world. Which in the case of Drupal can be anything. So, to answer your question... you cannot know "where in the admin module can I find this?" but you can use some tools like devel module for example or anyway its not that hard to get used to Drupal way.

so, if you are on a user page for example or on a page that you know it is generated by a specific module just open the *.module file and check the menu modulename_menu function.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.