Before we get started with development, there are some terms that need to be defined. It’s important that we keep these concepts straight, because it can get pretty confusing if we don’t. So here are some terms and concepts that we’ll need to know before going any further:
Modules . . . The most fundamental concept in Drupal development is the Module. A Module, to put it simply, is a container of code that introduces some sort of behavior to the system. For example, there is a Module that handles Ad Sense publishing. There is a Module that allows you to run forums. There is a Module for blogging. Modules can be enabled and disabled (except for certain modules that are required to run the basic Drupal framework). Custom functionality is added to Drupal by way of custom Modules.
Hooks . . . In order to let Drupal know about newly added functionality, we use Hooks. If you’ve done any event-based programming in the past, you’ve probably heard of callback functions. For those new to the idea, basically what you’re doing is letting a control loop know about functions you’ve written to handle certain events. That’s what Drupal’s Hook system is all about. When you define a Hook function, you’re letting Drupal know you’ve written a function that handles a certain circumstance. I’ll get into a lot more detail in a future entry, but just know for now that Hooks are how you integrate your code with the Drupal core code.
Themes . . . When it comes to presenting information on the web, there are really two parts to the story. There’s the information you’re presenting and then there’s the format you’re presenting it in. That’s where Drupal Themes come in. Themes can be thought of as the presentation part of the system. They define, through HTML markup and CSS code, how the data is displayed on your users’ browser. Again, more detail to come, but know that you should have a good working knowledge of HTML, CSS, and PHP in order to effectively work with Drupal Themes.
Nodes . . . If Modules contain code for dealing with events, hooks define those events, and Themes define presentation, then Nodes define the actual types of content Drupal can deal with. I know this can be a little confusing, and you’re probably wondering why the designers of Drupal would take this approach. Basically, it allows content types to exist independently of functionality, and allows you to apply any functionality to any content you like. Believe me, it’s very cool, and after you get past any confusion, you’ll really like it.
Blocks . . . So how do you take all that great information in your Nodes, press it through the code in your Modules, and display it on the screen? Through Blocks, of course! Well, maybe it’s not that obvious, but that’s how it’s done. Blocks are regions where information is displayed. An example of a block from the Drupal Core would be the Login Block, where you enter your login information. The Block displays a login prompt when no-one is logged in, then displays a menu of options that is dependent on your level of access.
No comments:
Post a Comment