Please, tell me where I can place my own PHP function? I want to use them for my snippets.
Thank you

Comments

styro’s picture

Create a directory for a module: eg /sites/all/modules/goodboy

Put a goodboy.module file in there containing your PHP functions eg:

<?php

function goodboy_function_1() {
  // do something
  return $something;
}

function goodboy_function_2() {
  // do something else
  return $something_else;
}

?>

Note: start the names of your functions with the name of your module to avoid naming conflicts with other code.

Create a goodboy.info file in the directory for the module eg:

name = Goodboy
description = "Goodboy's utility module."

Now once you've enabled that module, you should be able to use those functions anywhere in Drupal.

More details:
http://drupal.org/node/508

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

goodboy’s picture

Thanks advance! I've made my first module. I'm happy :)