Let's break this down into a few easy steps.
http://www.coderintherye.com/creating-a-new-custom-module-in-drupal-6
http://www.semicolon.co.za/php/hello-world-module-in-drupal-6-part-1.html
- Know where custom modules go, not in /modules but in /sites/all/modules
- Create a new folder there, e.g., new.
- Open a text editor and create a file named new.info
- In new.info add the following lines:; $Idname = Newdescription = A new module for testingpackage = Othercore = 6.x
-
Create another file named new.module
-
In new.module add the following lines:
<?php
/**
* Implementation of hook_block().
* Adds a block that has new text.
*/
function new_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('New Module');
return $blocks;
case 'view':
$block[0]['subject'] = t('New Module');
$block[0]['content'] = t('Hi from your custom block and your first new module');
return $block[$delta];
}
} -
Make sure both files are saved and then in Drupal go to Site Building -> Modules. Look under the other category and you should see your new module listed. Just check the box for it and submit.
-
You now have a new module which creates a custom block, you can go to Site Building -> Blocks and you should see your new module block. You can select to enable it and add it your pages.
-
The possibilities with modules are nearly endless, I recommend you pick up Pro Drupal Development for more instructions.
http://www.coderintherye.com/creating-a-new-custom-module-in-drupal-6
http://www.semicolon.co.za/php/hello-world-module-in-drupal-6-part-1.html
No comments:
Post a Comment