By ToshoFreny on
Hello Everyone,
This is a very basic question but maybe it needs some explanation from long time drupalers to make me understand.
How does page request that goes to index.php is handled for all pages in drupal?
Here http://drupal.org/node/270000 I see an explanation of how node works. But my question is how drupal knows from index.php a specific page request?
Suppose I navigate to drupal.org/project/themes, index.php is called right? If so, i understand that this code
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
loads all basic functions, enabled modules, logging etc. Rest I don't know.
I'm posting the short index.php code here for some ningas to explain the code.
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$return = menu_execute_active_handler();
// Menu status constants are integers; page content is a string.
if (is_int($return)) {
switch ($return) {
case MENU_NOT_FOUND:
drupal_not_found();
break;
case MENU_ACCESS_DENIED:
drupal_access_denied();
break;
case MENU_SITE_OFFLINE:
drupal_site_offline();
break;
}
}
elseif (isset($return)) {
// Print any value (including an empty string) except NULL or undefined:
print theme('page', $return);
}
drupal_page_footer();
Comments
If you look at a typical
If you look at a typical unaliased path for Drupal it is of the form http://www.example.com/index.php?q=some_internal_path, with clean urls on it looks like http://www.example.com/some_internal_path. The 'q=' path of the url is what Drupal uses to determine the specific page request. menu_execute_active_handler() uses this to find the appropriate menu callback.
What's the parameter?
Thank you nevets. But can you explain me more on this, please?
Doesn't this function need to take the path as parameter? How come the function called without parameter picks the url related page?
Loving Life,
Tosho Freny,
No parameter is needed see
No parameter is needed see http://api.drupal.org/api/function/menu_execute_active_handler/5 in the api documentation. Linked page includes the function code and shows how it used $_GET to get the path.