By sambojambo on
I'm sure that there's a simple way of doing this that I'm missing and I'm sure there must be a Drupal way. But where do I place variables that I want to have system wide access to? The setting.php file?
Many thanks in advance
Comments
Check out:
Check out: http://api.drupal.org/api/function/_phptemplate_variables/5 in settings.php
Returning system path?
Thanks johsw for the reply - but I don't think that's quite what I'm after. I know that this is very 'hackerish' but in Drupal 4.6 you can place a var in the settings.php file like so:
and be able to access it in any of you modules like:
I sure that there must be a tidier way of doing this. I suppose what I'm looking for is the correct way to return the 'base_path' so that I don't have to resort to the hacking above? My coding is a bit rusty at the moment - been out of it for a while :)
Returning system path? The Drupal way?
Just bumping this - as I'm sure that there's a straight forward 'Drupal way' of doing this. I need to be able to return the 'system path' so that I can map to files that my modules need. But obviously don't want to hard code this. I need away to return the system path for the machine that the site's running on?
There must be a Drupal Jedi out there to show me the way of the Drupal.
Returning a system path - the 'Drupal Way'
Bit of a self posting session here - but I hope it might be useful to some one else.
Solved the problem using drupal_get_path.
Returns the path to a system item (module, theme, etc.).
http://api.drupal.org/api/function/drupal_get_path/5