drupal_load

Definition

drupal_load($type, $name)
includes/bootstrap.inc, line 330

Description

Includes a file with the provided type and name. This prevents including a theme, engine, module, etc., more than once.

Parameters

$type The type of item to load (i.e. theme, theme_engine, module).

$name The name of the item to load.

Return value

TRUE if the item is loaded or has already been loaded.

Code

<?php
function drupal_load($type, $name) {
  // print $name. '<br />';
  static $files = array();

  if ($files[$type][$name]) {
    return TRUE;
  }

  $filename = drupal_get_filename($type, $name);

  if ($filename) {
    include_once($filename);
    $files[$type][$name] = TRUE;

    return TRUE;
  }

  return FALSE;
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.