0% found this document useful (0 votes)
35 views3 pages

Drupal Chapter 6 Modules

Uploaded by

William Ko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Drupal Chapter 6 Modules

Uploaded by

William Ko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 6

Modules

T
he other main customization for sites is the addi-
enabled Nam» Vorslon Deso-tptim
tion of modules. In Drupal, a module is an exten- Aggreoator 6.0 Aggregates syndicated content (RSS, HOP, and Atom feciis).
sion that provides a specific additional functionality r Bios 6.0 ErtaWcs k e c p ^ e a ^ and reotdarty updated user web pages or bio^s.

for your site. For example the Poll module adds a new r Blog API 6.0
Atioiiv; users to pott content usino apptkat^ftnt that tvfparX XML>FtPC b'oQ
APIs.
content type called "poll." It also provides additional sup- r Book 6.0 Atiows users to structure Site p a g u in a hierarchy or outi^c.

port for the use of polls on your site, including ways to Cotw 6.0 Alioivs the user to chanfic the coior scheme of certain themes.

display polls and security permissions for polls. One of F Comment 6.0
Atlauis users to comment an and dixcum pubUshcd content.

the aspects that makes Drupal such a powerful content r Contact 6.0 Ensbles tJie uie of batfi pcrsontil snd tile-viide contact Fomvs,

Content
management framework is the ease of installing and using r translation
6.0
A)!o««s coMcnt to be trantlsted Into different lanouases-

additional modules. There are a wealth of user-created F


Database
6.0 Logs and records system events to the dataNise.

modules to do all the extra things that you wish the core
r Forum 6.0
Cn&bles threaded tilscusfions about sener&l topics.

Drupal did.
F Help 6.0 Manages the diit^sy of oi^ne help.
When you visit the Modules area on the DrupaLorg Adds languaoc handling functionality and enables the tran^aUon of the user
r Locato 6.0 tnteiface to languages otlier than English,
Web site, you will quickly realize that there are almost too
many modules. This can make it very difficult to find the F Hanu 6.0 Atlows ttdmiftistrators to customiie the f&a navigation tnenu.

right modules to do what you want. Fortunately, there is a


Figure 15
good sense of cooperation in the Drupal community, and
List of Drupal modules.
it is considered good form to avoid duplicating functional-
ity between modules. This means that you will only rarely
have to decide between two modules that do the same m
•a
thing. Oftentimes, so much effort is put into not duplicat- you have all shapes and sizes, and your challenge is to o
ing work that modules are designed to be so flexible that piece them together in the right pattern to match your
you might not realize how useful they really can be for desired functionality. For example, if you wanted to cre-
your particular problem (see figure 15). ate a social bookmarking site, you could go to the Drupal
site only to discover that there is no module called "Social
Bookmarking." This does not mean that Drupal cannot
Building Modules provide this functionality; it just means that you need to
understand which Drupal core functionality needs to be
Modules are usually built and named specific to their func- extended, then find the building blocks that can be used
tional use in context to Drupal and not necessarily in rela- to construct the feature.
tion to the ultimate functionality that they offer the user. Drupal already lets users add content (nodes) to 01
><
Many times, it will take a combination of modules to piece the site and gives the site administrator tools to man-
together what the user will think of as a single feature on age that content. So to start creating social bookmarking,
the Web site. Drupal modules are like building blocks: you would just need a new content type that lets users
enter a URL to a node. Luckily, this has already been
built: the Link module lets you add a link field to a node. DrupaLorg Success Stories
Del.icio.us and other social bookmarking sites provide http://drupal.org/success-stories
their users with a helpful bookmarklet that facilitates the
quick addition of bookmarks from the original Web site. Drupal.org Showcase Forum
To replicate this, you can install the Prepopulate module, http://drupal.org/forum/25
which lets administrators create a JavaScript bookmarklet
that your users can use from the sites they're bookmark-
ing to prepopulate the Link node. To more fully extend
this example, you could also install the VotingAPl and Don't Hack Core
Fivestar modules so your users can vote on each other's Using Drupal, you can generally build a full-featured Web
bookmarks. Finally, you can use Drupal's core taxonomy site to fit most of your needs without writing any code.
functions to let users tag their bookmarks. Now your There will be times, however, when you will find little
Drupal site has all the basic functionality that you need things that you want to tweak or add to your site. This
for your social bookmarking site. section is not meant to prepare you to become a Drupal
Almost all Drupal modules will extend Drupal core coder, but is meant to give you a head start and point you
features like nodes, users, blocks, search, taxonomy in lieu in the right direction on some of the most basic ideas and
of introducing something completely new. In the previous uses of modules. There is, however, one rule of coding
example, we could have coded a new custom module to that must be shared at this time.
handle all of the social bookmarking requirements. We Don't Hack Core. Never, ever, not for any reason, even
could have also coded pages to display these links, as well if it is the only way you can make something work, should
as our own system for allowing users to tag these links. you contemplate modifying the core code that makes up
This, however, would have been a very inefficient use of Drupal. We write this from having made this mistake on a
Drupal. Instead of investing our limited development time regular basis in our early usage. Though it is fairly easy to
in building a module from scratch, it is much better to find where Drupal is rendering the HTML for your page
use pre-existing modules that work to extend the core or making a query, you must resist modifying core code or
system. The more you understand the core set of Drupal contributed modules. If you change the code, you can no
tools, the easier it will be to understand the contributed longer rely on the Drupal community's updates and bug
modules and how they can be combined to create the fixes. While upgrading either modules or the whole core
kind of functionality that you and your users want from system is normally quite easy, any modifications made to
a library Web site. that code will result in upgrade errors or a broken site
after patches are applied. If you find a bug or need an
^ extension to a module's capabilities, it is much better to
Oti Using Modules submit a report or a request on the DrupaLorg site.
CM
There has been a push on DrupaLorg to get users to
1 contribute the stories of buiiding their sites, inciuded in
these stories are the process users went through and the
chailenges they taced, as weil as the moduies they used and
how they pieced them together. The best of these success
stories have been compiied at Drupai.org's Success Stories
page. More stories can be found in the Showcase forum,
where users are encouraged to post their sites.

gi

You might also like