- "Ask the Expert" or Advice Column
- "Must Have" Modules
- A Challenge
- Books Overview
- Changing Garland - A Practical Example
- Comparison of Links and Web Links modules
- Create Simple Tables
- Creating a "Biographies" page
- Developing a Module on a Windows System
- Generic Table Display
- How to page a custom DB query
- List Users From a Single Role in a Block
- My Modules
- SBS Web Site Notes
- Searching for a New Hosting Company
- Taxonomy Tidbits
- Theming a Specific Content Type
Z. Some Simple Techniques
Submitted on Wed, 10/31/2007 - 00:07.
This may not belong with the rest of this...
Develop on a Page
If I'm adding something very new to my moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP., I often develop it first in a PHPRecursive acronym for "PHP: Hypertext Preprocessor" - is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. page on one of my test sites - it's just easier and potentially less disruptive. I still follow the same development "rules" - only the environment is different. If it doesn't work out, it's much easier, emotionally, to throw away a single page than stuff that's already in a moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP..
Package
In the early stages of development, I find it useful to include a line in the ".info" file that reads:
package = zzz
This puts my moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP. at the very end of the modules list where I can reach it quickly (CTRL+END) to enable/disable it.
Hook_enable / Hook_disable
These hooks are often overlooked but I find them useful:
- Set/reset all your variables to their defaults in this function for an easy way back to an almost-virgin state and to make sure the defaults only have to be correct in one place.
- Provide a message that will direct your users to the settings page.
- Log the userid of the enabling/disabling user.
Hook_help
It's always a good idea to help the end-user, so I at least start with a skeleton hook_help. It can be filled in more completely as you go along.
Hook_menu
It's a rare moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP. that doesn't have at least one menu item, so go ahead and start with a skeleton for this.
Hook_uninstall
Even if you didn't create any tables or content types that should be cleaned up, I can pretty much guarantee that you used some variables (i.e. variable_get, variable_set). Delete them. If you created blocks, it's a good idea to clean those up too. Don't forget to test it.
ToDo
Invariably you will think of something that needs to be done sooner or later. Put a small comment section at the top of your moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP. for including these notes.



Recent comments
1 week 5 days ago
6 weeks 4 days ago
6 weeks 4 days ago
7 weeks 3 days ago
7 weeks 4 days ago
8 weeks 5 days ago
8 weeks 6 days ago
9 weeks 2 days ago
9 weeks 3 days ago
9 weeks 3 days ago