Reputation: 9165
Iam a php developer, and iam new to drupal.I have installed a drupal site.
For normal php sites. we can find the file name from the browser path, for modification for eg:
browser url : www.mysite.com/test/upload.php
File path :test/upload.php.
for drupal:http://localhost/mydreamhouse/article/557 what is file path?
for drupal :http://localhost/mydreamhouse/newslist what is file path?
Is there any common way to find the file path in drupal?or can any one describe the flow of pages?
Upvotes: 1
Views: 4178
Reputation: 6694
getcwd() . base_path() . $file->filepath
getcwd()
- server path to webroot
base_path()
- path to drupal app (if app in root it will be /)
$file->filepath
- any file path (for example sites/all/default/files/...)
Upvotes: 2
Reputation: 3127
// path to Drupal dir - don't use $_SERVER['DOCUMENT_ROOT'] - drush commands will fail
getcwd()
// path to config folder - e.g. /sites/default/settings.php
getcwd() . conf_path(); // see conf_path() for details
// path to config file in module folder
getcwd() . drupal_get_path('module','configure') . '/config.yaml'
Upvotes: 0
Reputation: 4724
As mentioned in other answers, there are no files or flow of pages. index.php
takes the values of $_GET['q']
and calls the appropriate functions to dynamically generate pages.
You can use $_GET['q']
to access those "file path" portions of the URL, but the more Drupal way is to use arg()
, for example, with a path of http://localhost/node/5
, you could access node
with a call to arg(0)
and the 5
with a call to arg(1)
. This is the Drupaly way to access those parts of the URL.
Drupal also provides utility functions for getting at the base path. The L function l()
formats links and takes care of base path for you as well (you just write relative links, it appends base path as necessary); base_path()
will return the global of the same name; drupal_get_path()
takes some extra Drupal-specific arguments and will generate paths to things like modules and themes with the base path taken care of as well.
Were you looking for more information? Refine your question based on these answers, and check out Drupal's API documentation: http://api.drupal.org/
Upvotes: 0
Reputation: 5642
The file path is always index.php (except for a few exceptions like install.php and cron.php). You can disable the clean urls setting to better understand the path you're looking at. With clean urls enabled, there is some rewriting going on to create nice looking url's.
In your case, http://localhost/mydreamhouse/article/557
is in fact http://localhost/mydreamhouse/index.php?q=article/557
. In other words, the index.php script is called, which will in its turn interpret the $_GET['q']
variable to serve the proper page.
Upvotes: 2
Reputation: 18553
A Drupal URL does not have to correspond to a file, most of them are dynamically created from information in the database. See Understanding Drupal paths for more information.
Upvotes: 5