Search code examples
phpdrupal-6

adding own library in drupal


i want to include a php file .module file like this using hook_init

function drupsocial_init() {
  require_once base_path().(drupal_get_path('module', 'drupsocial') . '/libraries/dsinvoke.php');

}

but showing this error

Fatal error: require_once() [function.require]: Failed opening required '/drupal6/trunk/sites
/all/modules/drupsocial/libraries/dsinvoke.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs
\drupal6\trunk\sites\all\modules\drupsocial\drupsocial.module on line 32

how can i include such file


Solution

  • You normally can include any file if you know the full path of the file and the file is accessible. Check the path to the library, correct it and you should not have any problem.

    Start with the full path to the file first. If that works, you can think about using a dynamic path to the file.