These are the global variables that Drupal uses.
Globals
| Name | Description |
|---|---|
| $base_path | The base path of the Drupal installation. |
| $base_root | The root URL of the host, excluding the path. |
| $base_theme_info | An array of objects that represent the base theme. |
| $base_url | The base URL of the Drupal installation. |
| $channel | An associative array containing title, link, description and other keys. |
| $conf | Array of persistent variables stored in 'variable' table. |
| $cookie_domain | The domain to be used for session cookies. |
| $databases | Array of database connections. |
| $element | Structured array describing the data to be rendered. |
| $forum_topic_list_header | An array of forum topic header information. |
| $image | Current image tag used by aggregator parsing. |
| $installed_profile | The name of the profile that has just been installed. |
| $item | General string or array. |
| $items | Array of items used by aggregator. |
| $language | An object containing the information for the active interface language. |
| $language_content | An object containing the information for the active content language. |
| $language_url | An object containing the information for the active URL language. |
| $menu_admin | Boolean indicating that a menu administrator is running a menu access check. |
| $multibyte | The current multibyte mode. |
| $pager_limits | Array of the number of items per page for each pager. |
| $pager_page_array | Array of current page numbers for each pager. |
| $pager_total | Array of the total number of pages for each pager. |
| $pager_total_items | Array of the total number of items for each pager. |
| $tag | Active tag name. |
| $theme | Name of the active theme. |
| $theme_engine | The theme engine related to the active theme. |
| $theme_info | Active theme object. |
| $theme_key | Name of the active theme. |
| $theme_path | The path to the active theme. |
| $timers | Timers that have been created by timer_start(). |
| $update_free_access | Allows the update.php script to be run when not logged in as administrator. |
| $user | An object representing the currently logged-in user. |
View source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
Comments
If you are searching for the
If you are searching for the root path of your drupal installation as a filesystem path, you will not find the variable here.
Instead just use:
DRUPAL_ROOT
I searched for quite some time for it and had expected that to find it here, so I am adding this as a comment for others to find.
A $debug variable would be nice
It would be nice to have a $debug variable for modules (and core) to add "verbose"-type information whenever they're experiencing something that may contribute to errors. When site builders are experiencing errors, they could first raise an internal debug verbosity level, and then go look at this array. Module developers would have a place to put such information - including warnings of suspicious or unexpected input values - without having to resort to filling up the error log with details that could be trivial compared to other, more important information.
It could be an array something like this:
$debug[0] = array('time' => time(),
'importance' => int 1-10,
'module name' => ...,
'message' => 'Got a string here when expecting an array - outputting the string instead of #markup - possible conflict with the xyz_module',
'tags' => pipe-delineated list of tags
);
A firebug-like client could sort these according to runtime, importance, module, tags etc., or you could just put print_r($debug) at the bottom of your theme.
No database table is needed - simply a convention to follow for module developers.
Also: In cases where you are taking over a Drupal site someone else developed - and can't figure out which hook or module is responsible for putting various things on the page, rewriting queries, etc. etc., modules would have the opportunity (at some debug level) of telling you what they're doing as they do them. "Inserting WidgetX below page" etc. etc.. This would make runtime execution a lot more transparent and shorten code discovery time.