Module Name
The first step in creating a module is to choose a "short name" for it. This short name will be used in all file and function names in your module, so it must start with a letter, and it must contain only lower-case letters and underscores. For this example, we'll choose "current_posts" as the short name.
The first step in creating a module is to choose a "short name" for it. This short name will be used in all file and function names in your module, so it must start with a letter, and it must contain only lower-case letters and underscores. For this example, we'll choose "current_posts" as the short name.
Create a folder and a module file
Given that our choice of short name is "current_posts" :- Start the module by creating a folder in your Drupal installation at the path:
sites/all/modules/current_posts
- Create the PHP file for the module :
- Save it as
current_posts.modulein the directorysites/all/modules/current_posts - As of Drupal 6.x,
sites/all/modulesis the preferred place for non-core modules (andsites/all/themesfor non-core themes), because this places all site-specific files in the sites directory. This allows you to more easily update the core files and modules without erasing your customizations. Alternatively, if you have a multi-site Drupal installation and this module is for only one specific site, you can put it insites/your-site-folder/modules.
- Save it as
- Add an opening PHP tag to the module :
<?php- Module files begin with the opening PHP tag. Do not place the CVS ID tag in your module. It is no longer needed with drupal.org's conversion to Git. If the coder module gives you error messages about it, then that module has not yet been updated to drupal.org's Git conventions.
No comments:
Post a Comment