globals.php

  1. 7.x documentation/developer/globals.php
  2. 6.x documentation/developer/globals.php

These are the global variables that Drupal uses.

Globals

Namesort descending 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.
$is_https Boolean indicating whether or not the current request is secured by HTTPS.
$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 user currently visiting the site.

File

documentation/developer/globals.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * These are the global variables that Drupal uses.
  5. */
  6. /**
  7. * Timers that have been created by timer_start().
  8. *
  9. * @see timer_start()
  10. * @see timer_read()
  11. * @see timer_stop()
  12. */
  13. global $timers;
  14. /**
  15. * The base URL of the Drupal installation.
  16. *
  17. * @see drupal_settings_initialize()
  18. */
  19. global $base_url;
  20. /**
  21. * The base path of the Drupal installation.
  22. *
  23. * This will at least default to '/'.
  24. *
  25. * @see drupal_settings_initialize()
  26. */
  27. global $base_path;
  28. /**
  29. * The root URL of the host, excluding the path.
  30. *
  31. * @see drupal_settings_initialize()
  32. */
  33. global $base_root;
  34. /**
  35. * Array of database connections.
  36. *
  37. * @see default.settings.php
  38. */
  39. global $databases;
  40. /**
  41. * The domain to be used for session cookies.
  42. *
  43. * Cookie domains must contain at least one dot other than the first (RFC 2109).
  44. * For hosts such as 'localhost' or an IP Addresses the cookie domain will not
  45. * be set.
  46. *
  47. * @see default.settings.php
  48. */
  49. global $cookie_domain;
  50. /**
  51. * Array of persistent variables stored in 'variable' table.
  52. *
  53. * @see variable_get()
  54. * @see variable_set()
  55. * @see variable_del()
  56. */
  57. global $conf;
  58. /**
  59. * The name of the profile that has just been installed.
  60. */
  61. global $installed_profile;
  62. /**
  63. * Allows the update.php script to be run when not logged in as administrator.
  64. *
  65. * @see default.settings.php
  66. */
  67. global $update_free_access;
  68. /**
  69. * An object representing the user currently visiting the site.
  70. *
  71. * Contains preferences and other account information for logged-in users. When
  72. * a user is not logged-in, the $user->uid property is set to 0.
  73. */
  74. global $user;
  75. /**
  76. * An object containing the information for the active interface language.
  77. *
  78. * It represents the language the user interface textual elements such as
  79. * titles, labels or messages, are to be displayed in.
  80. *
  81. * Example values:
  82. * - 'language' => 'en',
  83. * - 'name' => 'English',
  84. * - 'native' => 'English',
  85. * - 'direction' => 0,
  86. * - 'enabled' => 1,
  87. * - 'plurals' => 0,
  88. * - 'formula' => '',
  89. * - 'domain' => '',
  90. * - 'prefix' => '',
  91. * - 'weight' => 0,
  92. * - 'javascript' => ''
  93. *
  94. * @see LANGUAGE_TYPE_INTERFACE
  95. * @see drupal_language_initialize()
  96. */
  97. global $language;
  98. /**
  99. * An object containing the information for the active content language.
  100. *
  101. * It is used by the Field API as a default value when no language is specified
  102. * to select the field translation to be displayed.
  103. *
  104. * @see LANGUAGE_TYPE_CONTENT
  105. * @see drupal_language_initialize()
  106. */
  107. global $language_content;
  108. /**
  109. * An object containing the information for the active URL language.
  110. *
  111. * It is used as a default value by URL-related functions such as l() when no
  112. * language is explicitly specified.
  113. *
  114. * @see LANGUAGE_TYPE_URL
  115. * @see drupal_language_initialize()
  116. */
  117. global $language_url;
  118. /**
  119. * Array of current page numbers for each pager.
  120. *
  121. * @see PagerDefault
  122. */
  123. global $pager_page_array;
  124. /**
  125. * Array of the total number of pages for each pager.
  126. *
  127. * The array index is the pager element index (0 by default).
  128. *
  129. * @see PagerDefault
  130. */
  131. global $pager_total;
  132. /**
  133. * Array of the total number of items for each pager.
  134. *
  135. * The array index is the pager element index (0 by default).
  136. *
  137. * @see PagerDefault
  138. */
  139. global $pager_total_items;
  140. /**
  141. * Array of the number of items per page for each pager.
  142. *
  143. * The array index is the pager element index (0 by default).
  144. *
  145. * @see PagerDefault
  146. */
  147. global $pager_limits;
  148. /**
  149. * Name of the active theme.
  150. */
  151. global $theme;
  152. /**
  153. * Name of the active theme.
  154. *
  155. * @see init_theme()
  156. */
  157. global $theme_key;
  158. /**
  159. * Active theme object.
  160. *
  161. * @see _drupal_theme_initialize()
  162. */
  163. global $theme_info;
  164. /**
  165. * An array of objects that represent the base theme.
  166. *
  167. * @see _drupal_theme_initialize()
  168. */
  169. global $base_theme_info;
  170. /**
  171. * The theme engine related to the active theme.
  172. */
  173. global $theme_engine;
  174. /**
  175. * The path to the active theme.
  176. */
  177. global $theme_path;
  178. /**
  179. * The current multibyte mode.
  180. *
  181. * Possible values: UNICODE_ERROR, UNICODE_SINGLEBYTE, UNICODE_MULTIBYTE.
  182. */
  183. global $multibyte;
  184. /**
  185. * General string or array.
  186. *
  187. * @see aggregator_element_start()
  188. */
  189. global $item;
  190. /**
  191. * Structured array describing the data to be rendered.
  192. *
  193. * @see aggregator_element_start()
  194. */
  195. global $element;
  196. /**
  197. * Active tag name.
  198. *
  199. * @see aggregator_element_start()
  200. */
  201. global $tag;
  202. /**
  203. * Array of items used by aggregator.
  204. *
  205. * @see aggregator_element_start()
  206. */
  207. global $items;
  208. /**
  209. * An associative array containing title, link, description and other keys.
  210. *
  211. * The link should be an absolute URL.
  212. *
  213. * @see aggregator_element_start()
  214. */
  215. global $channel;
  216. /**
  217. * Current image tag used by aggregator parsing.
  218. *
  219. * @see aggregator_aggregator_parse()
  220. */
  221. global $image;
  222. /**
  223. * An array of forum topic header information.
  224. */
  225. global $forum_topic_list_header;
  226. /**
  227. * Boolean indicating that a menu administrator is running a menu access check.
  228. */
  229. global $menu_admin;
  230. /**
  231. * Boolean indicating whether or not the current request is secured by HTTPS.
  232. */
  233. global $is_https;