views:

25

answers:

2

Hi,

I want to write a utility function so my Drupal project knows if it's running on the development, staging or live server.

Something like:

function mymodule_is_development() {  
    return (//some condition) ? TRUE : FALSE;  
}

Does anyone know how to do this the Drupal way? Drupal's multisite functionality should be leveraged I think...

+2  A: 

Take a look at Environment Indicator and how it works. You can use the settings.php to set a variable, or store one in the database with variable_set.

googletorp
settings.php! Of course! Thanks for the link to the project too. It looks interesting.
Rimian
A: 

See also:

global $base_url;

Rimian

related questions