tags:

views:

32

answers:

3

Hi

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?

+4  A: 

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.

Fabian
+2  A: 

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.

marcvangend
A: 

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/

semperos