You are on page 1of 455

Drupal Handbook: 20 April 2005 1

Drupal handbook
This document offers a complete reference for those interested in
Drupal, both novice and eperienced Drupal administrators, Drupal
users and Drupal developers!
Taken from the Drupal Handbook on drupal!or" on 20 April 2005
Drupal Handbook: 20 April 2005 2
Table of Contents
Drupal handbook!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1
#eneral information about Drupal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 12
$!% roadmap!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15
Aims!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&
'se (ases and Tar"et 'sers!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&
)rinciples!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&
(ase studies!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20
*uccess stories!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 21
contaire!com + A (orporate ,ebsite -ased .n Drupal!!!!!!!!!!!!!!!!!!!!!!! 21
,h/ 0inu 1ournal converted to Drupal and ho2 it 2ent!!!!!!!!!!!!!!!!!!! 25
(ommunit/: structure and roles!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&
The Drupal (ore!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&
(ontributions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&
Documentation and *upport!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 23
'sers!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 23
Do2nload Drupal, modules, themes and translations!!!!!!!!!!!!!!!!!!!!!!!!! 23
Druplicon 4the lo"o5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 23
6eature overvie2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 70
Hostin" and services!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 70
.pen*ourceHost!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 71
(ascadeHostin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 71
#rafi8 9nternet -!:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 71
;orri!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 72
<oshe ,eit=man!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 72
Teled/namics (ommunications!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75
2ebschuur!com!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75
*teven ,ittens!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75
#erhard >illesreiter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%
Trae <c(ombs and >/le *mith!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%
He/don (onsultin" + #ordon He/don!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?
<att ,est"ate!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?
>@Arol/ ;@B"/esi!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&
2bits!com!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&
)resentations and articles!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&
Collin" /our o2n s/stem vs usin" Drupal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73
*ites that use Drupal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $2
,here does the name DDrupalD come fromE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $2
Donatin" to the Drupal proFect!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $7
'serDs "uide!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $?
-asic concepts!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $?
Ce"isterin" and lo""in" in!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $&
Drupal Handbook: 20 April 2005 7
(han"in" /our account settin"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $3
Account *ettin"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $3
Additional 9nformation!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 50
(reatin" ne2 content!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 50
(reatin" comments!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 51
Addin" GnodesG 4stories, forum topics, etc!5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 52
(reatin" a stor/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 57
Alternative 2a/s to enter content!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 55
)ostin" and editin" content 2ith 2!blo""ar!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5%
Hditin" and deletin" content!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5%
AdministratorDs "uide!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5?
Drupal terminolo"/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5?
#eneral terms!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5?
;ode t/pes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 53
9nstallation!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %0
*/stem reIuirements!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %0
9nstallin" ne2 modules!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %1
9nstallation process!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %7
#eneral 9nstructions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %3
Ho2 to install Drupal for ne2bies usin" ,indo2s, 6T) and
php</Admin!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?0
'pload the database!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?1
#et Drupal read/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?1
(han"e GJtmpG on /our drupal site!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?2
KouDre doneL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?2
9nstallin" Drupal in a subdirector/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?2
0inu specific "uidelines!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?7
9nstallin" )H), </*M0 and Apache under 0inu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?7
<ovin" Kour Drupal 9nstallation To A ;e2 Director/!!!!!!!!!!!!!!!!!!!!!!!! ?$
<* *M0 *erver #uidelines!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?$
.*8 *pecific #uidelines!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?5
)ost"re*M0 specific "uidelines!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?%
9nstallin" )ost"re*M0 on ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ??
,indo2s specific "uidelines!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ??
9nstallin" Apache 42ith )H)5 on ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ??
9nstallin" </*M0 on ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?3
9nstallin" )H)$ on ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ?3
'ntar!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! &0
'sin" (lean 'C0s 2ith 99*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! &0
9nstallin" Drupal on ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! &2
9nstallin" Drupal on ,indo2s Ht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! &2
9nstallin" Drupal on ,indo2s Ht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3%
,indo2s 8) 99* development test s/stem "uidelines!!!!!!!!!!!!!!!!!!!!!!! 103
Drupal Handbook: 20 April 2005 $
9nstallin" ne2 themes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 117
<i"ratin" from other 2eblo" soft2are to Drupal!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 11$
<i"ratin" from e=)ublish!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 11$
<ove e=p database content to drupal database!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 115
)arse e=ml 4in perl, 2ith 0,)::'serA"ent5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 120
#et e=publish user real names for drupal profile!module!!!!!!!!!!!!!!!!! 121
<i"ratin" from #eeklo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 122
<i"ratin" from 0ive1ournal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 12$
9mport /our 01 throu"h an 96CA<H held in a -ook )a"e or similar! 12$
'sin" provided 9mport <odule!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 125
'se the 0iveFournal <odule to import the ra2 data into Drupal!!!!!! 125
<i"ratin" from <ovable T/pe!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 12%
Htract <ovable T/pe content as ml!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 12?
<ovin" /our <T st/les and templates!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 12?
Template for <T entr/ and comment eport and Drupal import!!!!!! 170
)arse ml into sIl insert statements!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 177
9nsert content into drupal nodes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 17%
*ettin" terms for inserted nodes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 17?
<i"ratin" from )H);uke!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 17?
<i"ratin" themes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 17?
<i"ratin" users!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 17&
<i"ratin" from )ost;uke!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 17&
(onfi"urin" modNre2rite in !htaccess for ); le"ac/ 'C0s in!!!!!!!!!! 17&
*earch Hn"ine 6riendl/ <i"ration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 173
<ore than one drupal site on one machine!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$1
Drupal 9Ds!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$2
<ultiple directories!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$2
<ultiple domains or vhosts!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$7
<ultiple domains or vhosts usin" different databases!!!!!!!!!!!!!!!!!!!!!! 1$7
<ultiple domains usin" the same database!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$$
Tunin" /our server for optimal Drupal performance!!!!!!!!!!!!!!!!!!!!!!!! 1$$
Tunin" )H)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$$
)H) (aches!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$5
Turck <<(ache!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$5
(onfi"uration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$&
9nitial confi"uration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$&
(han"in" DrupalDs basic settin"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$&
*ee the links belo2 for further "uidance!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$&
Anon/mous user!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$3
Default front pa"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1$3
Hamples:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 150
(lean 'C0s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 150
Hrror handlin" and reportin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 151
Drupal Handbook: 20 April 2005 5
Hrror pa"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 151
Hrror reportin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 151
(ache support!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 152
Ho2 DrupalDs cache 2orks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 152
6ile s/stem settin"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 152
)ath settin"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 157
Do2nload method!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 157
Dealin" 2ith error messa"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 157
Date and time settin"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15$
(ustomi=in" the interface!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15$
(ustomi=in" user lo"in!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 155
Disable 0o"in -lock!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 155
(on"estion control: tunin" the auto+throttle!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15%
Addin" s/ndicated content 4ne2sfeeds, C**5 to /our site!!!!!!!!!!!!!!!! 1%7
Database table prefi 4and sharin" tables across instances5!!!!!!!!!!!! 1%5
*imple usa"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%5
Advanced usa"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%5
*uper advanced usa"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%%
Tables that should not be shared!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%%
*earch en"ine friendl/ and robots!tt!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%?
The tolerant -ase 'C0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%3
,arnin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%3
-locks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1%3
-lock :isibilit/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?0
,ei"ht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?0
(ustom Administrator Defined -locks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?1
;ote about -lock Titles!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?2
(ustom -locks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?2
*ho2 block to certain users onl/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?2
Ho2 to sho2 a block onl/ to lo""ed+in users!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?2
Ho2 to sho2 a block onl/ to anon/mous users!!!!!!!!!!!!!!!!!!!!!!!!! 1?7
Ho2 to sho2 a block onl/ to certain users!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?7
Debu""in" the )ath!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?$
(ustom lo"in!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?$
All published content in a list!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?5
-lo" (ate"ories!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?5
-lo"centric Candom 9ma"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?%
(omment Approval (ount -lock!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1??
(ounter 4 da/s before J past!!!5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1??
Hits b/ <onth!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?&
0atest stories block!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?&
)a/pal blocks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1?3
)ull Do2n Top 0evel (ate"or/ 0inks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&0
Drupal Handbook: 20 April 2005 %
Candom ima"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&2
Candom ima"e displa/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&2
*ho2 hi"hest contributers to a site!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&2
*ubmission Iueue block!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&7
Top users b/ comment number!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&7
'ptime and load on 'ni s/stems!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&$
Drupal modules and features!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&5
A blo" for ever/ Drupal user!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&5
(onfi"urin" 'ser -lo"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&5
<akin" 'ser -lo"s <ore Accessible!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&%
Additional features!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&?
(ollaborative book or documentation 2ritin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&?
<aintainin" a 6AM usin" a collaborative book!!!!!!!!!!!!!!!!!!!!!!!!!! 1&&
)rintin" )H) :ariables from #HT or ).*T 6orms!!!!!!!!!!!!!!!!!!!!!!!!!!! 1&3
(omment s/stem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 130
'ser control of comment displa/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 130
Additional comment confi"urations!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 130
;otification of ne2 comments!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 131
(omment moderation!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 131
(ron s/stem and crontab!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 137
(ron!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 137
Director/ *erver 4Drupal *ites5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13$
Discussion forums!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 135
Drupal as a ne2s a""re"ator!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 135
,hat do 9 need to subscribe to a feedE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13%
(onfi"urin" ne2s feeds!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13%
(reatin" (ate"ories in the A""re"ator!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13?
Ta""in" 9ndividual 9tems in the A""re"ator!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13&
'sin" the ;e2s A""re"ator!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13&
C** feed blocks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 133
Htendin" user information 4profiles5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 133
0ocale or internationali=ation support!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 200
Ho2 to interface translation 2orks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 201
<oderation, collaborative ratin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 201
<oderation Iueue!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 202
(omment ratin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 202
)olls or enIuetes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 202
)ost content usin" the -lo""er A)9!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 207
)uttin" blocks 2ith content in the sidebars!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 207
Administrator defined blocks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20$
*earch confi"uration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20$
*tatistics, top nodes and access lo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 205
9ntroduction!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 205
Drupal Handbook: 20 April 2005 ?
(onfi"urin" the statistics module!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20%
)opular content block!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20%
*upport for static pa"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20%
Taonom/ 4alias sections and cate"ories5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20?
:ocabularies and Terms!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20?
'sin" :ocabularies: Displa/in" ;odes b/ Terms!!!!!!!!!!!!!!!!!!!!!! 210
<ore about Taonom/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 212
(reatin" a -lock 2ith links belon"in" to certain taonom/ terms!!! 212
Tracker!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 217
'C0 aliasin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 21$
-ack"round!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 21$
)ermissions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 215
<ass 'C0 aliasin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 215
,atchdo"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 21%
,eblo"s!com, technorati!com and blo!"s notification!!!!!!!!!!!!!!!!!!!!!!!21%
'ser mana"ement s/stem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 21%
<ana"in" access control 2ith permissions and user roles!!!!!!! 21?
'ser authentication !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 213
'ser preferences and profiles !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 213
'sin" distributed authentication!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 220
Distributed authentication!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 220
'p"radin" from previous versions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 221
'p"radin" from Drupal 2!00 to 7!00!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 221
'p"radin" from Drupal 7!00 to $!00 and later versions!!!!!!!!!!!!!!!!!!! 222
-ackups!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 222
-est practices "uidelines!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 227
-ackin" 'p Kour Drupal *ite!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 227
Test *ites!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22$
6ile J director/ mana"ement!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22$
Accounts and roles!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 225
Troubleshootin" 6AM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 225
9nstallation J (onfi"uration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 225
Gheaders alread/ sentG error!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 225
G0.(> TA-0H* seIuences ,C9THG Hrror!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22%
Gmethod ).*T is not allo2ed for the 'C0 Jinde!htmG Hrror!!!!!!!!!!! 22?
!htaccess pa"e forbidden!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22?
H+<ail from Drupal is -ouncin" or not bein" *ent!!!!!!!!!!!!!!!!!!!!!!!!!!! 22?
6ile permissions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22&
*olution 1 4recommended5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22&
*olution 2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 223
Ho2 can 9 adminstrate m/ navi"ation on m/ drupal siteE!!!!!!!!!!!!!!!! 223
Ho2 do 9 unset the clean urlsE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 271
no content on main pa"e for non admin users!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 272
Drupal Handbook: 20 April 2005 &
)H) *afe <ode 9ssue!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 272
,hat is the minimum version of )H)E!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 277
Ho2 can 9 install modulesE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 277
;odes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 277
cant create static php pa"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 277
)H) content 2onDt parse!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27$
*chedule and Hpire ;odes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27$
*earch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27$
*earch inde db empt/ J incomplete!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27$
search multib/tes lan"ua"e!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 275
)olls!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 275
Are polls supported in DrupalE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 275
(an a user vote more than once in a pollE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 275
<iscellaneous!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 275
Do2nload offline cop/ of drupaldocs!or" + stuck 2ithout net access!!!!!!
275
Ho2 can 9 chan"e DrupalDs character encodin"E 4'T6+& and 'nicode5!
27%
Ho2 do 9 report a bu" in (ontributed modules!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27%
<akin" a custom script 2ork 4independentl/5 alon" 2ith a Drupal
setup!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27%
<ove eistin" site to ne2 server!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27?
<ovin" /our site to another url!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27?
</ 'C0 is 2ron" in the list of Drupal *ites!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27&
truncated fields J unable to lo"in J php $!2!7 bu"!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 27&
Ho2 to install a )atchE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 273
(ontributorDs "uide!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$0
(ontributin" to Drupal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$0
-u" reports!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$2
6eature su""estions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$2
Task 0ist!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$7
The revision process!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$7
(riteria for evaluatin" proposed chan"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$5
Tips for contributin" to the core!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$%
<ailin" lists!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$?
Accessin" the Drupal mailin" lists usin" a ne2s server!!!!!!!!!!!!!!!!!!! 2$&
<ailin" of proFect issues!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$&
(odin" standards!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$&
Drupal (odin" *tandards!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2$&
6unctions and <ethods!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 252
(onstants!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 252
#lobal :ariables!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 252
6ilenames!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 257
Drupal Handbook: 20 April 2005 3
(omments!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 257
9ndentin"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 257
)H) (ode ta"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 257
*M0 namin" conventions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25$
6unctions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 255
(onstants!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 255
(ontrol structures!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 255
Header comment blocks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25%
(:* repositories!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25%
Additional references!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25?
Drupal (:* repositories!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25?
<ain repositor/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25?
(ontributions repositor/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25&
Addin" a file to the (:* repositor/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 253
(:* front ends for ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 253
Tortoise(:*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 253
,in(:*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%1
(:* on <ac .* 8!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%1
(oncepts of (:*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%1
Cepositor/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%1
-ranch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%2
Head!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%2
,orkin" cop/ J ,ork area!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%2
)roFect!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%2
)atch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%7
*ettin" up!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%7
)reparin" a proFect!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%%
(ommittin" a proFect!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%?
(:*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%?
)roFect!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%?
)romotin" a proFect to be an official release!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%&
Appl/ for contributions (:* access!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%&
'sin" (:* 2ith branches and ta"s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2%&
Trackin" Drupal source 2ith (:*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?0
An Hample!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?1
'pdatin" the vendor branch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?2
*ummar/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?7
Additional Cesources!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?$
*andbo maintenance rules!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?$
)H) Debu""er!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?5
A)9s and functions 4Do/"en5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?5
Do/"en 6ormattin" (onventions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?%
(reatin" and sendin" /our patches!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2?&
Drupal Handbook: 20 April 2005 10
Diff and patch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&0
Diff and patch on ,indo2s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&1
diff!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&1
patch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&$
diff and patch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&$
Cules of revie2in" patches!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&5
<aintainin" a proFect on drupal!or"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&%
(reatin" a proFect!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&%
Do2loads and packa"in"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&%
<ana"in" releases!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&%
.rphaned proFects!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&?
Drupal!or" site maintainers!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&?
Drupal test suite!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&&
<odule developerDs "uide!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&3
9ntroduction to Drupal modules!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2&3
DrupalDs pa"e servin" mechanism!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 230
Tips for database compatibilit/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 23&
'pdatin" /our modules!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 233
(onvertin" 7!0 modules to $!0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 233
CeIuired chan"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 233
(onvertin" $!0 modules to $!1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 700
CeIuired chan"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 700
Drupal $!0:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 700
Drupal $!1:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 700
Drupal $!0:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 701
Drupal $!1:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 701
.ptional chan"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 701
(onvertin" $!1 modules to $!2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 701
(onvertin" $!2 modules to $!7!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 707
(reatin" modules: $!7!1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 703
(onvertin" $!7 modules to $!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 72?
(onvertin" $!$ modules to $!5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 775
(heckNoutput45 chan"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 773
6ilter hook!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7$0
6ilter tips!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7$1
(reatin" <odules for $!5!O!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7$2
(onvertin" $!5 modules to $!%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75&
-lock s/stem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75&
*earch s/stem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 753
<odule paths!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 753
Database backend!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%0
Theme s/stem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%0
,atchdo" messa"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%0
Drupal Handbook: 20 April 2005 11
;ode markers!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%0
(ontrol over destination pa"e after form processin"!!!!!!!!!!!!!!!! 7%1
(onfirmation messa"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%1
9nter module calls!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%1
;ode Iueries!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%1
Tet output!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%7
,ritin" a node module!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%$
,ritin" efficient database 1.9;s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%$
(onnectin" to multiple databases 2ithin Drupal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%5
DrupalDs menu buildin" mechanism!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7%%
DrupalDs node buildin" mechanism!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?0
Ho2 Drupal handles access!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?7
D*tatusD field values for nodes and comments!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?$
,ritin" themable modules!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?$
Theme developerDs "uide!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?5
Themin" overvie2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?5
)H)Template theme en"ine!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7??
9nstallin" )H)Template!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?&
(reatin" a ne2 )H)Template!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?&
-lock!tpl!php!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7?3
-o!tpl!php!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&0
(omment!tpl!php!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&0
;ode!tpl!php!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&1
)a"e!tpl!php!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&2
Alternative templates for different node t/pes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&%
<akin" additional variables available to /our templates!!!!!!!!!!!!!!!!! 7&?
.verridin" other theme functions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7&&
A -H6.CH and A6THC eample of .verridin" the 'ser )rofile )a"es
usin" )H)Template!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 730
)rotectin" content from non+lo""ed in users 2hen usin" phptemplate
overrides!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 730
Theme *nippets Cepositor/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 732
(ustom 0o"in!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 732
Themein" 6leinode 4eample5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 737
The Muick :ersion!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 737
The 0on" :ersion!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73$
Hample 6iles!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73%
8Template theme en"ine!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73?
(reatin" a ne2 8Template!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73&
Template -asics!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 733
Header *ection!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $00
PsearchNurlQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0$
PsearchNdescriptionQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0$
Drupal Handbook: 20 April 2005 12
PsearchNbuttonNtetQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0$
PmissionQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0$
PtitleQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $05
PtabsQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $05
PhelpQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $05
Pmessa"eQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0%
;ode *ection!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0%
PlinkQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0?
PtitleQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0?
PsubmittedQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0?
Ptaonom/Q!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0&
PlinksQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0&
(omment!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $0&
PlinkQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $03
PtitleQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $10
PsubmittedQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $10
Pne2Q!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $10
PcontentQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $10
PlinksQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $11
-locks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $11
The *ection!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $11
6ooter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $12
PfooterNmessa"eQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $12
PfooterQ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $12
Hditin" ,ith #olive!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $17
)lain )H) themes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $1$
*u""estions for theme codin" st/le!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $15
Tips for desi"nin" themes in Dream2eaver, #o0ive etc!!!!!!!!!!!!!!!!!!! $1?
Dream2eaver!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $1?
'pdatin" /our themes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $1&
(onvertin" 7!0 themes to $!0!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $1&
CeIuired chan"es!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $1&
General information about Drupal
A d/namic 2eb site platform 2hich allo2s an individual or
communit/ of users to publish, mana"e and or"ani=e a variet/ of
content, Drupal inte"rates man/ popular features of content
mana"ement s/stems, 2eblo"s, collaborative tools and
discussion+based communit/ soft2are into one eas/+to+use
packa"e!
Drupal Handbook: 20 April 2005 17
As an open source soft2are proFect maintained and developed
b/ a communit/, Drupal is free to do2nload and use! 9f /ou like
2hat /ou learn here, please 2ork 2ith us to epand and refine
Drupal to suit /our needs!
A wide range of site configurations
-/ enablin" and confi"urin" individual modules, an
administrator can desi"n a uniIue site, one 2hich can be used
for a combination of kno2led"e mana"ement, 2eb publishin"
and communit/ interaction purposes! *o that /ou can better
understand the man/ possibilities, the follo2in" list of features
have been or"ani=ed b/ common 2eb platform characteristics:
Content management! :ia a simple, bro2ser+based
interface, members can publish to a number of available
content modules: stories, blo"s, polls, ima"es, forums,
do2nloads, etc! Administrators can choose from multiple
theme templates or create their o2n to "ive the site a
sin"ular look and feel! The fleible classification s/stem
allo2s hierarchical classifications, cross+indein" of posts
and multiple cate"or/ sets for most content t/pes! Access
to content is controlled throu"h administrator+defined user
permission roles! *ite pa"es can displa/ posts b/ module
t/pe or cate"ori=ed content, 2ith separate C** feeds
available for each displa/ t/pe! 'sers can also ke/2ord
search the entire site!
Weblog! A sin"le installation can be confi"ured as an
individual personal 2eblo" site or multiple individual
2eblo"s! Drupal supports the -lo""er A)9, provides C**
feeds for each individual blo" and can be set to pin"
2eblo" directories such as blo!"s and 2eblo"s!com 2hen
ne2 content is posted on the home pa"e!
Discussion-based community! A Drupal site can act as a
*lashdot+like ne2s site andJor make use of a traditional
discussion forum! (omment boards, attached to most
content t/pes, make it simple for members to discuss ne2
posts! Administrators can control 2hether content and
comments are posted 2ithout approval, 2ith administrator
approval or throu"h communit/ moderation! ,ith the
built+in ne2s a""re"ator, communities can subscribe to
and then discuss content from other sites!
Collaboration. 'sed for mana"in" the construction of
Drupal, the proFect module is suitable for supportin" other
open source soft2are proFects! The 2iki+like collaborative
Drupal Handbook: 20 April 2005 1$
book module includes versionin" control, makin" it simple
for a "roup to create, revise and maintain documentation
or an/ other t/pe of tet!
6or a more comprehensive feature list, consult our feature
overvie2! 6or live eamples of possible site implementations,
see the featured sites included 2ith the Drupal case studies! .r
visit some of the man/ sites that use Drupal!
Basic installation requirements and initial configuration
The Drupal core platform, additional plu"+in modules, and man/
theme templates are freel/ available for do2nload under the
#;' #)0! Drupal, 2ritten in )H) and usin" either </*M0 or
)ost"re*M0 as the database backend, can run on man/
platforms, includin" Apache or <icrosoft 99* 2eb servers!
<ore complete information and specific instructions about
s/stem reIuirements, installation and confi"uration are
available in the administratorDs "uide!
The Drupal community: deelopment and support
As a communication center and proFect mana"ement space,
drupal!or" includes members 2ho use Drupal as a personal
2ebsite solutionR 9T professionals implementin" Drupal for
clientsR and pro"rammers, 2riters and others contributin" to the
"ro2th of the Drupal open source proFect! <embers 2ork
to"ether to maintain etensive development and support
resources on site:
!upport! 'sers eperiencin" difficulties installin" and
confi"urin" Drupal should first consult the administratorDs
"uide, much of 2hich is also available throu"h help in the
administration section of ever/ Drupal installation! 9n
cases 2here documentation fails to provide a solution,
search the support forum and drupal+support mailin" list
archives! 9f the solution is not available, please 2rite a
detailed description of the problem, include the Drupal
version number, and post it to either venue! ;ote: all
support is provided on a volunteer basis and is dependent
on the "ood 2ill of communit/ membersR please be patient
2ith an/ support reIuests!
Deelopment! The Drupal developerDs "uide contains
information on Drupal architecture, A)9 specifications,
"uides for theme and module developers, and instructions
for contributin" /our code to the proFect! The -u" tracker
Drupal Handbook: 20 April 2005 15
s/stem should be used to submit bu"s, ideas for ne2
features, su""estions for improvin" drupal!or", and
contributin" ideas for usabilit/ and documentation! Those
seriousl/ interested in contributin" to development should
also consider Foinin" the drupal+devel list!
"earn more
*ee the links belo2, the other sections of The Drupal Handbook,
and the man/ discussions in the forums for more information!
4.6 roadmap
This is a table that sho2s G2ho is doin" 2hatG on our road to
$!%!
'sin" this table, 2e can "roup our efforts, and others can track
2hat 2e are doin" and ho2 far 2e are!
)lease tr/ and keep this pa"e up to date as much as possible! 9f
/ou Foin or leave a team, edit this pa"e! 9f a status chan"es,
please edit this pa"e too! 9f /ou have lon" descriptions and
documents /ou 2ould like to add, please add book pa"es under
this chapter!
Tas#
$odules%Area
s
Team of
oluntee
rs
statu
s
Theme improvements
<ore information in the
civicspacelabs
theme s/stemR
block s/stem
;eil
Drumm
(hris
<essina
Halfelven
*tefan
;a"te"aa
l
,9)
Drupal Handbook: 20 April 2005 1%
Tas#
$odules%Area
s
Team of
oluntee
rs
statu
s
Desi"n themes
Desi"n a total of ten 10 themes, templates or
st/les, of 2hich at least 5 are templates or
themes!
themes
Adrinu
-@Sr
>essels
<e"a
#runt
sepeck
*tefan
;a"te"aa
l
*teven
,ittens
,9)
Hnd+user documentation
drupal!or"R
help hooks
-ert
-oerland
-r/"ht
Done
9nternationalisation i1&n i1&nR locales
1ose A
Ce/ero
>@Arol/
;@B"/es
i
(arl
<cDade
-@Sr
>essels
Adrian
Cossou2
,9)
Translate interface
Have a total of ? translations released for $!5
localeR po files
-@Sr
>essels
#erhard
>illesreit
er
*tefan
;a"te"aa
l
Done
Drupal Handbook: 20 April 2005 1?
Tas#
$odules%Area
s
Team of
oluntee
rs
statu
s
(ontent (onstruction >it J metadata
more information
fleinodeR node
1onathan
(haffer
-@Sr
>essels
1ohn
:anD/k
;eil
Drumm
<att
,est"ate
,9)
*earch improvements 6i the search,
accordin" to
search hooksR
search module
*teven
,ittens
Done
9nstall s/stem 9ntroduce an install 2i=ard
s/stem
coreR modules
Adrian
Cossou2
,9)
<ove to business area
<ake Drupal able to act as backend for
GleafletG sites, purel/ corporate and mostl/
simple 2ebsites
coreR modules
4drupal(.<5
1ose A
Ce/ero
-@Sr
>essels
T.D
.
<ove to proFect area
<ake Drupal able to act as a "roup2are and
proFect mana"ement tool
proFect
modules,
"roup2are
'2e
Hermann
dikini
T.D
.
9mprove content or"ani=ation
9ntroduce and improve modules to or"anise
and mana"e content
mindmap!modu
le book!module
#erhard
>illesreit
er
<a"ico
T.D
.
9mprove menu s/stem
menu!incR
menu!module
1onathan
(haffer
,9)
9mprove and fine "rain permission s/stem
addin" custom items to menus that are onl/
visible to certain users!
menu s/stemR
coreR
1onathan
(haffer
,9)
9mprove block administration
block!module
theme s/stem
;eil
Drumm
sandip
Done
6und+raisin" and marketin" drupal!or"
0apurd
-r/"ht
-ert
-oerland
Done
Drupal Handbook: 20 April 2005 1&
Tas#
$odules%Area
s
Team of
oluntee
rs
statu
s
Taonom/ s/stem improvements
Taonom/: standardi=e vocabular/ metadataR
openJclosed vocabulariesR interface to
vocabularies in 2a/s other than simpl/ a
selectbo )ublishJ*ubscribe: share and
a""re"ate vocabularies amon" Drupal sites
taonom/
s/stem
1ohn
:anD/k
<athias
T.D
.
C** improvements
s/ndication
s/stem and A)9
;eil
Drumm
rkendall
Done
9ma"e module improvements
ima"e module,
file!inc
Hric
*couten
1ames
,alker
,9)
Aims
<ission: -uildin" on and reali=in" relevant standards and open
source technolo"ies, Drupal supports and enhances the potential
of the internet as a medium 2here diverse and "eo"raphicall/+
separated individuals and "roups can come to"ether and
collectivel/ produce and share rich bases of information and
epression!
Use Cases and Target Users
Drupal is desi"ned to be fleible and po2erful enou"h to meet a
broad ran"e of 2eb technolo"/ needs, from simple informational
postin"s to lar"e or"ani=ational sites and collaborative proFects!
This said, there is acentral interest in and focus on communities
and collaboration! Drupal aims to enable the collaborative
production of online information s/stems and communities!
Principles
(ollaboration! Drupal development supports open,
collaborative information sharin" s/stems and approaches
4includin" s/stems such as communit/ moderation of
posts5!
*tandards+based! Drupal supports established and
emer"in" standards! *pecific tar"et standards include
Drupal Handbook: 20 April 2005 13
8HT<0 and (**!
.pen source! Drupal is based on the open source
philosoph/ of collaborative free soft2are development!
Drupal is itself open source and builds on and supports
other open source proFects! *pecificall/, Drupal is coded
in the open source scriptin" lan"ua"e )H) and supports
as primar/ data sources the open source database formats
</*M0 and )ost"resIl!
Mualit/ codin"! Hi"h Iualit/, ele"ant, documented code is
a priorit/ over rou"hed+in functionalit/!
Hase of use! Drupal aims for a hi"h standard of usabilit/
for developers, administrators, and users!
<odular and etensible! Drupal aims to provide a slim,
po2erful core that can be readil/ etended throu"h
custom modules!
0o2 resource demands! To ensure ecellent performance,
Drupal puts a premium on lo2+profile codin" 4for eample,
minimi=in" database Iueries5! Drupal should also have
minimal, 2idel/+available server+side soft2are
reIuirements! *pecificall/, Drupal should be full/
operational on a server 2ith Apache 2eb server, )H), and
either </*M0 or )ost"resIl!
Usability Aims
6or developers Drupal aims for a development s/stem that is:
2ell+tooled 2ith a s/stem of hooks that provide read/
means to accomplish most foreseeable codin" aims that
involve interaction 2ith core elements
6or administrators, Drupal aims to provide solutions that are:
eas/ to install and set up so that there is a
minimalreIuirement for specific technical epertise
intuitive and self+eplanator/ so that administrators
caneasil/ find the confi"uration options the/ need
hi"hl/ confi"urable so that site administrators can
presentFust the interface the/ 2ish
6or users, all elements of the Drupal user interface should be:
intuitive and self+eplanator/ so that users 2ith minimal
prior eperience caneasil/ discover, navi"ate, and use
functionalit/
uncluttered so that users are not faces 2ith a difficult task
Drupal Handbook: 20 April 2005 20
of sortin" the essential from the non+essential
Case studies
Drupal meets the needs of different t/pes of 2eb sites:
Community Portal ites
9f /ou 2ant a ne2s 2eb site 2here the stories are provided b/
the audience, Drupal suits /our needs 2ell! 9ncomin" stories are
automaticall/ voted upon b/ the audience and the best stories
bubble up to the home pa"e! -ad stories and comments are
automaticall/ hidden after enou"h ne"ative votes!
Hamples: Debian )lanet T >erneltrap
Personal !eb ites
Drupal is "reat for the user 2ho Fust 2ants a personal 2eb site
2here she can keep a blo", publish some photos, and ma/be
keep an or"ani=ed collection of links!
Hamples: url"re/hot T 0an"emarks (afe
Aficionado ites
Drupal flourishes 2hen it po2ers a portal 2eb site 2here one
person shares their epertise and enthusiasm for a topic!
Hamples: iaJ T Dirtbike
"ntranet#Corporate !eb ites
(ompanies maintain their internal and eternal 2eb sites in
Drupal! Drupal 2orks 2ell for these uses because of its fleible
permissions s/stem, and its eas/ 2eb based publishin"! ;o
lon"er do /ou have to 2ait for a 2ebmaster to "et the 2ord out
about /our latest proFect!
Hamples: *udden Thou"hts T Tipic
$esource Directories
9f /ou 2ant a central director/ for a "iven topic, Drupal suits
/our needs 2ell! 'sers can re"ister and su""est ne2 resources
Drupal Handbook: 20 April 2005 21
2hile editors can screen their submissions!
Hample: Hntomolo"/ 9nde
"nternational ites
,hen /ou be"in usin" Drupal, /ou Foin a lar"e international
communit/ of users and developers! Thanks to the locali=ation
features 2ithin Drupal, there are man/ Drupal sites
implemented in a 2ide ran"e of lan"ua"es!
Hample: )unt-arra T cialo"
uccess stories
This part is dedicated to real+life eamples of ho2 drupal can
help to solve /our business problems! )lease share the success
of /our drupal implementation!
contaire.com % A Corporate !ebsite &ased 'n
Drupal
Drupal is 2ell suited for communit/ plumbin", alri"ht! -ut 2hat
if /ou 2ant to appl/ its po2er, ele"ance, and simplicit/ to /our
corporate 2ebsiteE 9n this article, 2e eplain our approach to
creatin" a corporate 2ebsite 2ith Drupal, sho2 /ou ho2 to
create /our templates and arran"e /our content! *o 2h/ 2ould
/ou 2ant to enter into such a formidable endeavorE
;ote: the ori"inal article is on contaire!comDs site, and contains
additional screenshots and illustrations!
-oth the la/out and the underl/in" HT<0 of our old
2ebsite needed a face lift!
,e speciali=e in sophisticated content mana"ement
solutions, /et our 2ebsite consisted of static HT<0 pa"es
2ith an absolute minimum of )H) code to avoid the 2orst
code duplication! ,e kne2 2e could do better!
At times 2e 2ere slo2 to post updates of our site! The
process of doin" so should be more strai"ht for2ard!
'ur re(uirements
.ur reIuirements 2ere Iuickl/ set:
The site la/out should remain lar"el/ as is, 2ith t2o thirds
Drupal Handbook: 20 April 2005 22
for the main content area and a column of ne2s headlines
on the ri"ht!
There is a flat list of sections 2ith articles, some of 2hich
arran"e the teasers in t2o, others in a sin"le column!
The sections can be accessed b/ a d/namical list of tabs at
the top of the pa"e!
*ections should have simple 'C0s, 2ith some other
articles havin" intuitive 'C0s as 2ell!
The pa"e structure is such that the front pa"e features
article or section teasers!
9nitiall/, there 2ill be no communit/ features like
comments!
(ontent should be editable throu"h its front end vie2!
The site should validate as 8HT<0, and should further
follo2 the "uidelines for barrier free 2eb sites!
Tet formattin" should be usin" Tetile markup!
Technicall/, there should be as little as possible soft2are
development on top of stock Drupal! Ho2ever, 2e 2anted
to develop templates usin" the )H)TA0 en"ine and kne2
2e 2ould have to transform one of the standard Drupal
templates to this notation first!
The ingredients
,e started development 2ith the follo2in" in"redients:
GDrupal $!5!1G:http:JJdrupal!or"JfilesJproFectsJdrupal+
$!5!1!tar!"=
The contributed modules collimator!module
4http:JJdrupal!or"JfilesJproFectsJcollimator+$!5!0!tar!"=5,
ima"e!module 4http:JJdrupal!or"JfilesJproFectsJima"e+
$!5!0!tar!"=5, ima"eNfilter!module
4http:JJdrupal!or"JfilesJproFectsJima"eNfilter+$!5!0!tar!"=5,
and tetile!module 4http:JJdrupal!or"JfilesJproFectsJtetile+
$!5!0!tar!"=5
.ur o2n contributed theme en"ine phptal!en"ine
4http:JJdrupal!or"JfilesJproFectsJphptal+cvs!tar!"=5
The stock <arvin theme
A dynamic hori)ontal tab menu
The most prominent feature here is the hori=ontal navi"ation
tabs! This has become a popular arran"ement recentl/, ver/
often enhanced 2ith drop+do2n menus! 9n our case, there are no
Drupal Handbook: 20 April 2005 27
drop+do2n menus! The underl/in" implementation, ho2ever,
should be easil/ etended to host these as 2ell!
Three standard features of Drupal, a )H) theme function and a
little (** ma"ic are used to implement the hori=ontal tab menu!
The features are
Taonomies! ,e use a separate vocabular/ G*ectionsG to
or"ani=e content!
The menu is not linked directl/ to this vocabular/ as 2ould
the Drupal module taonom/Nmenu!module do, but rather
is created throu"h a customi=ed menu!
This allo2s to link menu entries to taonom/ pa"es,
individual nodes or t2o column pa"es "enerated b/ the
collimator!module!
6inall/, links in the menu are cleaned b/ assi"nin" 'C0
aliases to menu entries!
6or eample, the entr/ GpartnerG links to GpartnerG:Jpartner
2hich is an alias for GcollimatorJ$G:JcollimatorJ$, i!e! the t2o
column listin" of teasers for topic $ 4G0ebendi"es ;et=2erkG5!
,hat remains is a function that renders the menu:
<?php
function _contaire_menu($pid = 1) {
$menu = menu_get_menu();
$entries = array();
if (isset($menu['visi!e'"[$pid") ## $menu['visi!e'"
[$pid"['chi!dren'")
{
foreach ($menu['visi!e'"[$pid"['chi!dren'" as
$mid) {
$sty!e = (count($menu['visi!e'"[$mid"
['chi!dren'")
? (menu_in_active_trai!($mid)
? 'e$panded' % 'co!!apsed')
% '!eaf');
$entry = array('sty!e' =& $sty!e' '!in(' =& theme
('menu_item'' $mid));
$entry['(ids'" = _contaire_menu($mid);
$entries[" = $entry;
)
)
return $entries;
)
function contaire_menu($pid = 1) {
return _phpta!_ca!!ac(('_menu''
array('pid' =& $pid' 'entries' =& _contaire_menu
Drupal Handbook: 20 April 2005 2$
($pid)));
)
?&
9n the )H)TA0 theme en"ine 2e use, this function can be
2ritten into the Utemplate!phpU file of our theme and be called
from the file Upa"e!talU as
<div id=*header*&
+++
<div ta!%content=*php%contaire_menu(,-)* .&
<.div&
Here 2% is the menu entr/ for our custom menu!
A ne* teaser.module
Hcept for the hori=ontal navi"ation, the front pa"e looks like
standard Drupal, but lookin" more closel/, even here there are
interestin" details:
Hach teaser has a picture associated 2ith it!
The teaser pictures float automaticall/ to the left and
ri"ht!
The G2eiterG links are placed behind, not belo2 the teaser
tets!
There is one feature not visible on the site as presented to the
public that are little edit buttons placed to the ri"ht of the
headlines! These become necessar/ because 2e havenDt linked
our headlines to a detail vie2 2ith tabbed local tasks, and
the G2eiterG link ma/ link to an arbitrar/ 'C0!
,e have created Ga small Drupal
moduleG:http:JJdrupal!or"JnodeJ1$320 to provide these features!
T*o columns+ but sorted+ please
)ortin" our ori"inal content 2e needed a 2a/ to la/out some
pa"es in t2o columns! .ne eample is our partners pa"e
4http:JJcontaire!comJpartner5 2here in addition to the t2o
columns 2e have an introductor/ tet at the top! ,e Iuickl/
settled on the contributed collimator!module but had to patch it
to "ive us control over the 2a/ it sorts articles! The collimator
offers the standard modes b/+date and b/+title to sort! ,e
2anted to control sortin" eplicitl/ and abused a ne2 node field
Drupal Handbook: 20 April 2005 25
NteaserN2ei"htN for this! The NabuseN here is that actuall/ this
field should be a propert/ of the table termNdata but there is no
eas/ 2a/ to add this 2ithout patchin" the taonom/!module! ,e
provided our chan"es as a patch 4http:JJdrupal!or"JnodeJ152$05
to the collimator!module!
The sin"le column tet at the pa"e top is simpl/ the description
of the pa"eDs taonom/ term, fed throu"h Tetile!
Conclusion
,e Fust love our ne2 pa"eL .nce 2e decided on the selection of
modules and eactl/ for 2hich features 2e 2ould have to 2rite
some code the actual effort 2as 2ell 2orth it! The phptal!en"ine
has had its first live test and proved fun to 2ork 2ith!
All in all, Drupal a"ain sho2ed its "reatness and that + 2ith a
little thou"ht and plannin" + it can be used for man/ a corporate
2ebsite!
!hy ,inu- .ournal con/erted to Drupal and ho*
it *ent.
,e had been lookin" for a G(ontent <ana"ement */stemG for
Iuite a 2hile, and one of our emplo/ees discovered Drupal 2hile
researchin" (<* soft2are on the 2eb! Drupal appeared to be
much more fleible than )H) ;uke, 2hich 2e 2ere usin", and
the more 2e looked at it the more impressed 2e became! At that
time all of the features 2e thou"ht 2e 2ould need, ecept one,
2hich 2e decided to 2rite a module to provide, 2ere on the
table to be implemented in the net Drupal release!
,e decided to convert 0inu #a=ette to Drupal in order to
become familiar 2ith Drupal under real life hi"h usa"e
conditions and to setup Doc *earlsD 9T #ara"e to eperiment
2ith DrupalDs blo""in" and other interactive abilities! After 2e
2ere satisfied 2ith DrupalDs abilit/ to handle the traffic at 0inu
#a=ette as 2ell as its interactive abilities at Doc *earlsD 9T
#ara"e and had set up and tested DrupalDs fleibilit/ b/ creatin"
several sites for internal corporate use, 2e decided to create a
Drupal site to replace the 0inu 1ournal )H) ;uke site that 2e
2ere usin" for 0inu 1ournal! ,e started out 2ith version $!7 of
Drupal but b/ the time 2e decided to convert 0inu 1ournal to
Drupal, version $!$ 2as out so 2e started buildin" our ne2 site
usin" that version! There 2ere not an/ maFor problems, Fust the
Drupal Handbook: 20 April 2005 2%
t/pical learnin" curve reIuirin" ne2 2a/s of lookin" at
problems, nothin" 2e could see that 2ould prevent us from
usin" Drupal for the ne2 site! <ost of our time 2as devoted to
developin" methods to convert the old articles and content of
0inu 1ournal ma"a=ine to the ne2 format reIuired in the ne2
site!
.ne thin" that Drupal did not provide 2as a method that 2e
could use to displa/ static content in the main center section
2ithout the other content that Drupal normall/ puts there! ,e
2anted to be able to link to static html and tet files and have
onl/ that file be displa/ed in the center section! To do that <itch
6ra=ier created a module he called static!module! The static
module allo2s /ou to define one or more base directories that
can be used for storin" HT<0 files, )H) files, tet files, and
ima"e files! ,hen the static module is used in the 'C0, the
ar"ument to it is interpreted as a file path name! This file path
name is searched for relative to all each of the predefined
static directories! The file t/pe etensions are appended
automaticall/! 9f the file is found its contents are displa/ed in
the main 4center5 section of the Drupal pa"e! 9f the file is a php
file it is first evaluated and the result is displa/ed! This allo2ed
us to create an/thin" 2e 2anted in the center, 2ithout havin" to
create a node, 2hile maintainin" a consistent Drupal GlookG 2ith
the siteDs header, sidebars, and footer intact! The static module
"ave us a "reat 2a/ to separate all information that is not
editorial content from the marketin" and business oriented
pa"es as 2ell as providin" us 2ith a simple 2a/ to Iuickl/
inte"rate eistin" HT<0 files into the site!
After convertin" 10 /ears of articles and "ettin" the Glook and
feelG 2e 2anted, 2e decided to do the roll over from )H) ;uke
to Drupal at &am on ;ov! 1st! 'nfortunatel/ on the evenin" of
.ct! 70, 2hile doin" the final move of the articles to the ne2
site, 2e discovered that Anon/mous users could not leave their
name or email address 2hen makin" comments! This 2as a
feature 2e GhadG to have and 2as onl/ available on version $!5!
.n earlier versions of Drupal /ou had to have an account before
/our name 2ould appear 2ith /our comment! This 2as a Gsho2
stopperG and even thou"h 2e had less than $& hours to do it in,
2e decided to install a ne2 $!5 site and brin" over the blocks,
theme and other chan"es 2e created for the earlier version!
<itch 6ra=ier had it 2orkin" in 2$ hours and 2e spent the rest
of the time before the roll out testin" and doin" minor cleanup!
Drupal Handbook: 20 April 2005 2?
The ne2 site has been 2ell received b/ 0inu 1ournal
subscribers and 222!linuFournal!com readers! 0ots of helpful
su""estions have been made and ne2 features implemented
because of them! -ecause of this 2arm reception, 2hen 2e
decided to create a publication called T'8, 2hich is primaril/
for the ne2 0inu user, 2e decided to use Drupal for its 2eb
site! *ince 2e 2ere short of time, 2e simpl/ cloned the 0inu
1ournal site! ,e then made cosmetic chan"es and cleaned up
the database! This allo2ed us to have a 2orkin" site 2hile 2e
2orked on a completel/ ne2 la/out and desi"n! The ne2 T'8
la/out and desi"n has been finished and is no2 in place! *teven
,ittens, one of the core Drupal developers helped us 2ith the
look and feel of the ne2 T'8 site 2hich is based on the
phptemplate theme!
.n the 0inu 1ournal site, Drupal version $!5 is handlin"
$00,000 hits per da/, and </*M0 is handlin" the stora"e and
the searches for 5,000 articles and over 1$,000 comments! ,e
are currentl/ usin" these contributed modulesR print, spam,
subscriptions and themedev on both the 0inu 1ournal and T'8
sites! ,e are also considerin" usin" 2eblink, userpost and
2ebforms as 2ell! ,e are ver/ pleased 2ith the po2er and
stabilit/ of Drupal and because of this are creatin" internal
Drupal sites to be used for information dispersal and
coordination bet2een emplo/ees and departments! ,e are
considerin" usin" a node level permission module that <att
,est"ate is developin" to control access to information in these
internal sites! ,e are constantl/ ama=ed at ho2 versatile and
po2erful Drupal is and at the ne2 uses 2e find for it!
The Drupal (ommunit/ has been a "reat help in ans2erin"
Iuestions and makin" su""estions that allo2ed us to create,
desi"n and convert our eistin" 2eb site to Drupal as 2ell as
create ne2 ones! To return the favor 2e are plannin" on
releasin" the static module that <itch 6ra=ier created, some
time after the first of the /ear! <itch is also 2orkin" on a fe2
other ne2 ideas and 2e 2ill be releasin" them after the/ are
full/ developed and researched!
<an/ thanks to the Drupal (ommunit/ from the staff of 0inu
1ournal, T'8, Doc *earlsD 9T #ara"e and 0inu #a=ette!
++ >eith Daniels ,eb (oordinator **( )ublications, 9nc!
)ublishers of: 0inu 1ournal T'8 Doc *earlsD 9T #ara"e 0inu
#a=ette A$2 #roups of 0inu 'sers Hver/2here
Drupal Handbook: 20 April 2005 2&
Community0 structure and roles
This pa"e presents the structure and decision+makin" in Drupal!
There are various roles and responsibilities that people can
assume in the Drupal proFect!
The Drupal Core
6ounder and 0ead Developer! Drupal 2as founded b/
Dries -u/taert, 2ho retains primar/ control over the
soft2are and makes most decisions on proposed chan"es!
9n approvin" or reFectin" proposals and patches, he "ives
special 2ei"ht to comments made b/ individuals 2hom he
trusts and respects based on their past contributions to
Drupal!
(:* revie2 team! A small team that revie2s proposed
chan"es and maintains code! The/ are the onl/ ones 2ho
have 2rite access to the core (:* repositor/! (urrent (:*
revie2 team members are Dries, >Fartan and *teven!
<aintainer! ,hile not directl/ makin" decisions,
maintainers have informal responsibilit/ for a desi"nated
portion of the core 4e!"!, a particular core module5!
9ndividual areas of responsibilit/ are listed in the file
<A9;TA9;HC*!tt! <aintainers are appointed b/ Dries!
(ore contributors 2ho have made substantive
contributions 4particularl/ to a core component not
individuall/ maintained5 ma/ appl/ for <aintainer status
b/ 2ritin" to DriesR Dries ma/ also individuall/ invite
them!
(ore contributor! (ore contributors are those 2ho
contribute code patches or documentation for the Drupal
core, contributions that are peer revie2ed and then
decided on b/ Dries or other members of the (:* revie2
team!
Contributions
(ontributions repositor/ mana"er! The (:* repositor/ of
Drupal non+core GcontributionsG 4mainl/, modules and
themes5 has a maintainer, 2ho revie2s and approves
applications for (:* access, and one or more other team
members 2ho fill in 2hen the <aintainer is unavailable or
other2ise occupied!
Drupal Handbook: 20 April 2005 23
G(ontributionsG contributor! G(ontributionsG contributors
develop and maintain GcontributedG code packa"es that
are hosted on the Drupal site but not part of the Drupal
core! A contributions contributor has applied for and
received 2rite access to the GcontributionsG (:*
repositor/! (ontributions contributors are improvin" the
overall reach of Drupal b/ producin" and sharin"
enhancements that can be used b/ others! (ontributions
contributors are "enerall/ listed in the CHAD<H or
(CHD9T* files included in module and theme do2nloads!
Documentation and upport
Documentation and support is collaborativel/ delivered b/
people in all Drupal roles, mainl/ throu"h drupal!or" and
the development and documentation mailin" list! *ome
drupal!or" members have been "ranted ri"hts to post and
edit content and so directl/ author documentation like the
Drupal Handbook!
Users
'ser! 'sers are the people 2ho use Drupal! 'sers arenDt
contributin" code but ma/ be submittin" bu" reports or
feature reIuests throu"h the issues s/stem and
participatin" in the drupal!or" forums!
Do*nload Drupal+ modules+ themes and
translations
VEphp print proFectNreleaseNovervie245R
Druplicon 1the logo2
After Drupal had been created, an obvious matter 2as the
choice and creation of a lo"o! .f course it 2ould have to do
somethin" 2ith a drop!!! or 2ater!
The inital idea 2as simple: a drop in a circle! ! 9t 2as featured as
an G.G in a liIuidish GDropG!
,hen the communit/ "re2, the idea came up of a cartoon/ drop
2ith a face! *teven ,ittens 4'n(oneD5 created a 7D drop, but
the idea didnDt "et too far mainl/ because 7D is hard to print,
Drupal Handbook: 20 April 2005 70
hard to edit, etc!
,hen the lo"o+issue had come up a"ain, >ristFan 1ansen 4>ika5
came up 2ith idea of puttin" t2o side+2a/ drops to"ether to
form an infinit/+si"n! ,hen put into a filled circle, it resembled a
face! After some more 2ork b/ *teven ,ittens, the Druplicon
2as created: a st/lised drop 2ith the infinit/ e/es, a round nose
and a mischievous smile!
ThatDs the Dstor/D behind it!!! 9 like the idea that the infinit/+e/es
s/mbolise the infinite possibilities that Drupal offers :5
*ee more versions of the lo"o in the marketin" section!
3eature o/er/ie*
VEphp print featureNlistin"45R
4osting and ser/ices
This pa"e hi"hli"hts people and or"ani=ations 2ho offer
services related to Drupal!
9nstructions for bein" listed on this pa"e are at the
bottom!
.utsite of this pa"e, an/ user on Drupal!or" can mark
themselves as providin" Drupal+related services! ,e
provide a list of these people!
Table of contents
Hostin"
.pen*ourceHost
(ascadeHostin"
#rafi 9nternet -! :!
;orri
*ervices
<oshe ,eit=man
Teled/namics (ommunications
2ebschuur!com
*teven ,ittens
#erhard >illesreiter
#otnerdE
He/don (onsultin" + #ordon He/don
<att ,est"ate
>@Arol/ ;@B"/esi
Drupal Handbook: 20 April 2005 71
2bits
Drupal 4osting
The follo2in" companies offer a 2eb hostin" platform suitable
for runnin" a Drupal site! 6or more information on DrupalDs
s/stem reIuirements, consult the s/stem reIuirements pa"e in
the Drupal handbook! >no2n hostin" companies include:
'penource4ost
.pen*ourceHost is a speciali=ed 2eb hostin" compan/ focusin"
on providin" Iualit/ 2eb space and support for open source
content mana"ement s/stems, as 2ell as other open source
soft2are s/stems! 6or Drupal hostin", 2e provide "raphical
installation instructions, and if /ou take advanta"e of our special
offer at http:JJdrupal!opensourcehost!comJ /ou 2ill receive an
additional 100 me"s of space and 1 "i" of band2idth added to
the hostin" packa"e of /our choice!
Cascade4osting
A small 2ebhostin" compan/ run from )ortland .re"on,
(ascadeHostin" offers cheap 2eb hostin" 4W33J/ear includes
free domain re"istration5 and 2eb pro"rammin" contract
services! ,eDll setup Drupal for free as part of our W33J/ear
account, and ans2er an/ drupal related Iuestions at
drupalUcascadehostin"!com! 6or more information, check their
Drupal pa"e!
Grafi5 "nternet &.6.
#rafi8 9nternet -!:! provides transit, co+location, and dedicated
servers in Amsterdam and Cotterdam, The ;etherlands! ,e are
most proud to be the dedicated server provider of choice for
222!drupal!or", as 2ell as some offsprin" proFects such as
222!drupaldevs!or"!
,e believe in Dmedieval marketin"D, and thus our 2eb presence
4222!"rafi!nl5 is fairl/ humble! ,e strive to make our
combination of service and support le"endar/, and our name to
pass mouth to mouth, spread 2ide and far b/ our man/ satisfied
customers!
9t 2ould honor us if /ou 2ill consider #rafi8 9nternet -!:! as a
Drupal Handbook: 20 April 2005 72
service provider for /our drupal+based deplo/mentL (ontact us
at salesU"rafi!nl or b/ phone at X71+4051&0 + $501?0
,e can offer:
*erver co+location startin" from 53 YJmonth 4.ur net2ork,
/our hard2are5!
Dedicated *ervers startin" from 200 YJmonth 4.ur
net2ork, our hard2are5!
Ca2 or mana"ed transit capacit/ startin" from 1 <bps to
"i"abits per second!
Cack 4cabinet5 space startin" from 1J7 rack and up to
entire datacenter ca"es!
;et2ork, operatin" s/stem, and securit/ consultanc/!
7orri-
;orri has launched their hostin" service for Drupal! ,hat this
means is 2e 2ill manuall/ install Drupal for /ou, unlike other
hostin" companies! ,e 2ill even help /ou "et started on it, if its
the first time /ou are usin" it! ,e 2ill also update the soft2are
for /ou, free of charge, 2hen a ne2 version is released!
This is 2hat /ou "et for &'( per month:
0atest Drupal 9nstallation
700 <- of 2ebspace X 5#- Data Transfer per month
5 Hmail accounts
2 Databases
2 <ailin" list
And loads more!!!
6or more information /ou can mail us at solutionsZdot[norri
Zdot[com! Also check the our 2eb hostin" pa"e!
,hat more if /ou select us 2e 2ill donate up to )(* of the
profit to the development of Drupal! 9n this 2a/ /ou also help
the evolution of the soft2are and support the developers!
Drupal er/ices
The follo2in" people or or"ani=ations provide services related
to Drupal!
8oshe !eit)man
2eit=man U teFasa!com
Drupal Handbook: 20 April 2005 77
-oston, <A '*A!
er/ices
(onsultin" on Drupal installation, trainin", and support! (ustom
Drupal soft2are development also provided!
9ualifications
9 am intimate 2ith DrupalDs inner 2orkin"s, and can complete
custom proFects 2ith speed and Iualit/! 9 have authored much of
the
Distributed Authentication
e+mail handlin"
official <aintainer of DrupalDs user s/stem
Hooks such as Nhead45, Neit45, and Ns/ndication45!
"lossar/ module
s/ndication module
taonom/Ndhtml module
folksonom/ module
poor mans cron
cookin" recipe
scheduler
or"anic "roups
si"nificant s/stem documentation
8oshe:s $ecent Clients
)iel2orks is deplo/in" Drupal in their intranet! The/
contracted 2ith me to 2rite an 0DA) module, and an
events module! Thanks )iel2orks!
<oodcenter!or" is deplo/in" a portal site 2here patients
complete surve/s and receive instant "raphical feedback
about their mood state over time! This portal reIuires
inte"ration 2ith a surve/ en"ine, statistics application,
and )H) "raphin" utilities!
<arlboro (olle"e is inte"ratin" the Drupal authentication
s/stem 2ith their o2n 0DA) based director/! The Drupal
ldapNinte"ration!module is po2erin" that inte"ration!
;ational *ociet/ of Hispanic )rofessionals is relaunchin"
their 2eb site usin" Drupal as a (ontent <ana"ement
*/stem and communit/ en"ine! *pecial planned
enhancements include a po2erful ne2 calendar 2ith deep
Drupal Handbook: 20 April 2005 7$
taonom/ inte"ration!
<usic 6or America based their ambitious site on Drupal,
and asked <oshe to develop modules for trackin" their
artists, venues, contacts, and more! <oshe delivered a
fleible node module 2hich could serve all these purposes
at once! This module 2as incorporated into the (ivicspace
proFect! )lanned enhancements include affiliate trackin"
and enhanced subscription features!
'niversit/ of :ienna is no2 runnin" one of the most
advanced Drupal pods in the 2orld Zsta"in" site[! The/
maintain one Drupal site for man/ courses in their catalo",
2hile maintainin" a sin"le user account across all sites!
The/ also share lan"ua"e translations across sites!
<osheDs desi"n notes for this implementation are
documented in this email 4note: the stumblin" block 2as
solved5!
Co2land 9nstitute at Harvard uses Drupal as an intranet
for their communit/ of scientists and technicians! <oshe
delivered installation and 2ebmaster trainin" to Co2land,
alon" 2ith on"oin" support!
(ode.ran"e is a thrivin" communit/ site based loosel/ on
current ne2s! <oshe developed the ;ode <oderation
module 2hich promotes the best nodes to the home pa"e
ever/ da/ based on moderation ratin"s submitted b/ the
communit/! Additionall/, <oshe is currentl/ 2orkin" on
enhancin" DrupalDs moderation s/stems in order to
hi"hli"ht stron" posts, and hide troll posts!
*hare;e2Kork is a communit/ 2eb site built around le"al
online sharin" of music! 9t is a marketplace 2here users
ma/ upload son"s and then receive commissions based on
ho2 man/ users do2nload and purchase these son"s! 9t is
an innovative business model in a sector 2hich has sho2n
promise, but never made much mone/! <oshe is deliverin"
custom modules for uploadJdo2nload, automatic <)7 data
etraction, 6T) inte"ration, ecommerce and )a/)al
inte"ration, and more!
6innish -roadcastin" (ompan/ enables their users to
create and "ro2 or"anic "roups! These "roups are similar
to Kahoo #roups, 2here an/one can create a public or
private "roup, and users post messa"es to their "roup
home pa"e! 6-H has also sponsored <oshe to build photo
"aller/ functionalit/ based on a ta""in" s/stem like 6lickr
and Del!icio!us! This 2ork is bein" released back to the
Drupal Handbook: 20 April 2005 75
Drupal communit/! Thanks 6-H!
Teledynamics Communications
Teled/namics (ommunications 9nc is an internet and
opensource consultin" compan/ based in *auble -each, .ntario
(anada! Hstablished in 13&7, T(9 has been involved in lar"e+
scale 9nternet portal research for over 10 /ears! .ur portfolio
includes communit/ sites for militar/, manufacturin" and
emer"enc/ response applications, */mpatico+0/cos and the
(anadian -roadcastin" (orporation! 6or more information, visit
Teled/namics (ommunicationsD Drupal services pa"e or check
their Drupal related information!
*ebschuur.com
2ebschuur!com is a small scaled compan/ that builds content
mana"ement s/stem 4(<*5 driven 2ebsites! ,e can provide the
help and advice to create a d/namic 2ebsite, from scratch or
from an eistin" site! ,hether /ou are lookin" for cuttin" ed"e
technolo"/ for /our or"ani=ations 2eb+based communication, or
for solid solutions for /our companies 2eb+presence: 2e can
offer itL
6or more details please do not hesitate to "et in touch 2ith us!
-\r >essels 4berU2ebschuur!com5
Turnhoutsebaan 7$J7
21$0 Ant2erpen
-el"i]
Telephone XX72 4057 %%72232
222!2ebschuur!com
te/en !ittens
stevenUacko!net
-onheidenJ0euven, -el"ium
!erices: (ustom Drupal development 4modules5 and desi"n
4templates and themes5! (ontact me 2ith /our needs and
specifics and 2e can 2ork somethin" out!
+ualifications: 9 am a lon"+time Drupal core developer, so 9
have intimate kno2led"e of the code and its features!
*pecificall/, 9 have authored most of the filter s/stem 42hich
handles transformin" the user+supplied tet into HT<05, several
Drupal Handbook: 20 April 2005 7%
filterin" modules 4HT<0 (orrector, *mile/s, 'C0filter5 and
coreDs )oll module! 9Dve also 2orked on makin" sure Drupal 2as
'nicodeJ'T6+& compatible! 6or Drupal $!% 9 have 2orked on
improvin" the search!module!
9 created t2o of the ori"inal Drupal themes! 9 run m/ o2n
Drupal site, 2hich has a full/ validatin" and accessible
8HT<0J(** theme! 9 also desi"ned the theme for the
Drupal!or" 2ebsite 4-luebeach5!
Gerhard ;illesreiter
killesUdrupaldevs!or"
6reibur", #erman/
#erhard is a freelance Drupal 9T consultant, he has closel/
follo2ed and participated in DrupalDs development for about
three /ears!
!erices: (onsultin" on Drupal setup and trainin", custom
etensions to eistin" and development of ne2 modules
accordin" to the clientDs specifications!
+ualifications: Durin" m/ 2ork 2ith Drupal 9 have
implemented solutions for a variet/ of problems includin" + but
not limited to + an access control module, a remindme etension
for the event module, 2hich 9 also maintain, and the listhandler
module! 9n the past 9 mana"ed to reduce DrupalDs eecution
time b/ improvements to the database Iueries! Cecentl/ 9 have
been successfull/ tr/in" to decrease DrupalDs pa"e eecution
time even further b/ cachin" some data structures! 9 have also
been successfull in "ettin" a si"nificantl/ improved
locale!module into the Drupal core for the $!5 release and 2ill
2ork on achievin" )H) 5 compatibilit/!
Trae 8cCombs and ;yle mith
tmccombsU"otnerd!com, ksmithU"otnerd!com
Atlanta, #eor"ia '*A J Ceno, ;evada '*A
"otnerdE is a ,eb Desi"n ^ Development J Technolo"/ *ervices
compan/ that uses Drupal eclusivel/!
!erices: ,e provide a one stop shop for all of /our ,eb
Development needs! (onsultin", setup, trainin", custom
etensions to eistin" and development of ne2 modules
accordin" to the clientDs specifications are but a fe2 of the
thin"s 2e can do!
Drupal Handbook: 20 April 2005 7?
+ualifications: ,e have built several bi" name 2ebsites: T2o
of them bein" 0inu!com and themes!or"! *hould /ou be
interested in seein" an/ of our 2ork, or perhaps revie2in" a
Iuote from some of our clients, simpl/ visit our 2ebsite:
http:JJ"otnerd!comJ
4eydon Consulting % Gordon 4eydon
"ordonUhe/don!com!au
<elbourne, Australia
!erices: (onsultin", Drupal implementation, (ustomisation of
modules and core to allo2 for a best inter"ration into /our
business! The creation of plu"ins for HT<0area module to allo2
for better inter"ration, and not to disadvanta"e uses 2ho are
not usin" HT<0Area!
+ualifications: #ordon has been an active member of the
Drupal communit/ since 2001, b/ first maintainin" and
contributin" to eistin" modules! 0ater developin" several
modules such as the HT<0Area inter"ration module 2hich
allo2s for Vtetarea J_ ta"s to be converted into a ,K*9,K#!
editor! .ther contributed modules include the filestore2 module
and an etensive modification to the ima"e module! 9n addition
to the contributed modules, their has also been a number of
contributions to core in the form of ne2 A)9s and etensions of
eistin" functionalit/!
He/don (onsultin" is dedicated to the on"oin" development of
drupal, and 2orkin" 2ith customers to create a (<* that 2ill fit
/our needs no2 and into the future!
6or more information see
http:JJ222!he/don!com!auJEI`consultin"
8att !estgate
(ontact <att
Ames, 9o2a
!erices: (ustom Drupal development and proFect consultin"!
+ualifications: 0on"time core developer 2ho authored the
'C0 aliasin" feature! .ther contributions include the
ecommerce packa"e, an eas/ 2a/ insert ima"es into content,
Tin/<(H rich+tet editor inte"ration and a role+based node
permissions module! :isit m/ portfolio to vie2 more eamples of
Drupal Handbook: 20 April 2005 7&
m/ 2ork!
;<=roly 7<>gyesi
(ontact >@Arol/
-udapest, Hun"ar/
!erices: ever/thin" )H), mostl/ module and theme
pro"rammin"!
+ualifications: 9 kno2 Drupal core Iuite 2ell and 9 have
submitted a patch in the be"innin" of 2005 2hich helped some
Drupal pa"es to be up to 50a faster in a default+install scenario!
9 have helped creatin" i1&n module and 9 am prett/ familiar 2ith
creatin" multinational content sites! As 9 am from Hun"ar/, a
*econd ,orld countr/, m/ fees are usuall/ lo2er than those
from the 6irst ,orld countries!
?bits.com
(ontact 2bits!com
2bits!com offers 2eb development usin" the po2erful, fleible
and open Drupal (ontent <ana"ement */stem and frame2ork
for po2erful back end en"ines that are database driven!
,e offer consultin" on installation, confi"uration, customi=ation
and maintenance, as 2ell as hostin" of /our 2eb site!
,e have developed contributed modules such as 6eedback,
*tock, customerror and *ite<enu as 2ell as contributin" to
other areas 2ithin Drupal!
4o* to be listed on this page
*end an e+mail to drupal+develUdrupal!or" 2ith the appropriate
details! The current pa"e maintainer 2ill then add /our
or"ani=ation to this pa"e!
Presentations and articles
9ntranet 1ournal! Drupal: )o2erful and 6ree, -ut *ome
Assembl/ CeIuired + G,hat Drupal does provide is an
etensible frame2ork, especiall/ beneficial for use on
lar"er intranets, 2hich 2ill allo2 /ou to epand and
improve /our intranet over time! The screens for addin"
Drupal Handbook: 20 April 2005 73
ne2 articles are simple, and the administrator of the
s/stem is "iven the abilit/ to veto content submitted b/
contributin" authors! 9f /ou have the time and epertise,
itDs 2ell 2orth "ettin" to "rips 2ith the nitt/+"ritt/ of
Drupal if /ouDd like to full/ customi=e itDs operation!G Z read
more [
The 6u==/ #roup: performance of open source portal
soft2are + G9 have been a small part of the .pen *ource
communit/ since 133% and 9Dve been a re"ular 'ni user
since 13&%! These technolo"ies, 2hich "re2 up on the
9nternet, offer compellin" benefits for most or"ani=ations!
A recent eperience 2ith an .pen *ource portal
application, Drupal, pointed out to me Fust ho2 "ood the
performance of .pen *ource applications can be E 2hen it
is done correctl/!G Z read more [
Teled/namics (ommunications: communit/ plumbin" for
the 2eb + GDrupal is, as it claims, (ommunit/ )lumbin", an
infrastructure, a frame2ork for buildin" 2ebsites 2hich
serve a communit/ of interest, but itDs also more than this!
Drupal has the latent abilit/ to transform the 2eb from a
"lut of brochures to a d/namic ecolo"/ of kno2led"e, a
communit/ record as much as it is a communit/ forum!G Z
read more [
>+lo""in": supportin" >< 2ith 2eb lo"s + GThere are man/
robust 2eb lo" tools that are inepensive or even free!
)opular soft2are includes <ovableT/pe, Cadio 'serland,
an/ of the variations of *lashcode, and m/ favorite,
Drupal! The/ allo2 individuals to publish content to a 2eb
site easil/, and some packa"es even allo2 for
cate"ori=ation of entries! <ost packa"es also permit
authors to publish an 8<0 feed of content! These lo2+cost
tools help kno2led"e 2orkers 2ith t2o core concerns of
><: kno2led"e creation and kno2led"e sharin"!G
$olling your o*n system /s using Drupal
*ome of /ou mi"ht consider rollin" /our o2n s/stem instead of
usin" Drupal! As the Drupal communit/ is ver/ interested in
havin" /ou Foin us instead, 2e 2ill, for /our consideration,
present /ou 2ith some advanta"es of usin" Drupal over rollin"
/our o2n s/stem! ,e encoura"e /ou to consider the follo2in"
before settin" of on /our o2n!
Drupal Handbook: 20 April 2005 $0
The drupal path is fun and educational
As /ou stru""le to "et /our sites to fit /our needs, Drupal 2ill
stimulate /ou in a more re2ardin" 2a/ than 2ould a more lo2
level environment as a plain pro"rammin" lan"ua"e! As /ou "o
alon" /ou eperience and learn the inner 2orkin"s of a s/stem
2hich has proved ver/ po2erful and become ver/ popular! This
2ill be useful for /ou in /our later proFects!
Dealin" 2ith insi"nificant details 2hen 2ritin" a frame2ork can
be frustratin"! ,ith Drupal, the frame2ork is in place and /ou
can focus on the meat 2hich is a bi" relief! ,ith Drupal, /ou "et
the Fob done 2ith less pain!
Drupal:s user and de/eloper base
Drupal is used b/ tens of thousands of sites on the 2eb, and
more than seven hundred people are visitin" drupal!or" as 9
2rite this! This "ives /ou several advanta"es if /ou take the
Drupal path:
$odules for a wide range of needs: As /ou build /our
site, needs ma/ arise 2hich /ou didnDt predict! As users of
Drupal eperience needs, a module is often 2ritten to fill
it! 9n most cases these are contributed, so 2ith the Drupal
path /ou have the opportunit/ to do2nload modules and
easil/ plu" these into a s/stem 2hich is able to handle
them! 6urthermore, /ou have the oppertunit/ to hack the
modules to fit /our needs better as the/ are open source!
,asy to get help: As mentioned, lots of people are active
on drupal!or"! 0ettin" them kno2 of /our problems in the
forum or searchin" there 2ill often result in su""ested
solutions! ,hen rollin" /our o2n s/stem, /ou donDt have
the advanta"e of a lar"e communit/ Gspeakin" the
lan"ua"eG of /our frame2ork!
Drupal is thoroughly tested: As the compleit/ of a
s/stem "ro2s, it is likel/ to create errors or bu"s! 9t 2ill
eventuall/ be harder, if not impossible for mere humans,
to predict all eventualities! Kou can not count on /our
siteDs visitors to report errors, because instead of
reportin" the/ ma/ chose to leave!
Hver/ installed Drupal site comes 2ith a 2atchdo"
module! This module lo"s errors and report them to the
administrator 2hen she visits the administation section of
Drupal Handbook: 20 April 2005 $1
her site! 6urthermore it is important for all users of Drupal
that their sites 2ork as epected! Therefore users report
errors to the maintainers of Drupal and her modules! To
ease this process, DrupalDs maintainers have created a
s/stem 2hich keeps track of issues, sho2in" them to
interested persons able to correct them!
!ith Drupal+ you are able to create a cool
site
9Dve collected some eample sites to illustrate this point! ;otice
that the/ are Iuite different!
.ur media
:aral
Tipic
'rl"re/hot
)olitical ph/sics
-r/"ht
<ore eamples can be found in case studies and in this
comprehensive list of drupal sites!
Drupal is fle-ible
A reason for rollin" /our o2n s/stem mi"ht be to have it fit /our
needs eactl/! Ho2ever, Drupal is desi"ned to fit a ran"e of
needs, one of her ke/ features is fleibilit/! (hances are /ouDre
better off to2ards /our "oal 2ith Drupal! 9n addition to the
alread/ mentioned modules and their abilit/ to be adapted to fit
/our special needs, it is fairl/ eas/ to roll /our o2n modules!
This is t/picall/ done b/ makin" a file 2ith some functions
implementin" certain hooks in addition to other functions! The
follo2in" function implements the help hook 2hich is called b/
the Drupal core and possibl/ some other Drupal modules!
<?php
function mymodu!e_he!p($section) {
s/itch($section) {
case 'admin.he!p0!oc('%
return '1y modu!e /i!! he!p you get !aid';
rea(;
)
)
?&
Drupal Handbook: 20 April 2005 $2
This 2a/ modules and the Drupal core interact, and it has
proved ver/ po2erful! -/ usin" hooks, modules can interact 2ith
and take advanta"e of the buildin" blocks of Drupal such as her
node, cate"or/, administration and user s/stems!
@ou can gro* in the future *ith Drupal
Drupal 2ill continue to be maintained in the future! This is
important for sites adaption to the environment in 2hich the/
live, the users the/ interact 2ith and the soft2are on 2hich the/
run, as it is in constant flu! ;e2 needs 2ill probabl/ arise as
/our site "ro2s! )erhaps one da/ a ne2 protocol mi"ht be
2idel/ used, and /our site need to support it! C** support is an
eample of somethin" man/ sites have needed to implement
latel/! ,hen needs like these arise, someone probabl/ need to
dive into the code and adapt it to itDs chan"ed environment! 9f
the/ havenDt been there for a 2hile or are ne2 to the code,
thin"s t/picall/ turn out to be complicated! The fact that people
donDt like to comment their code contribute to this!
G<aintenance ni"htmareG is a phrase commonl/ used for these
kind of thin"s, as a search on "oo"le su""est!
-oweer. if you ta#e the Drupal path. chances are there
will be a solution at drupal.org!
ites that use Drupal
VEphp Wcount ` dbNresult4dbNIuer/4D*H0H(T (.';T4link5
6C.< director/D55R E_
The follo2in" list of sites is compiled d/namicall/! All Drupal
installations ma/ optionall/ pin" a Drupal director/ server via
8<0+C)(! This server collects all active installations and
displa/s them here! (urrentl/, there are VEphp print WcountR E_
Drupal sites in our database but this is onl/ a fraction of all
Drupal sites! <ore information is available on this pa"e in the
Drupal handbook!
VEphp print drupalNdirector/Npa"e4Dtimestamp DH*(D5R E_
!here does the name :Drupal: come fromA
Drupal 4droo+puhl5 is the Hn"lish pronunciation for the Dutch
2ord DdruppelD 2hich stands for DdropD! The 2ord drop 2as
chosen for the drop!or" communit/ blo" after Dries made a t/po
Drupal Handbook: 20 April 2005 $7
2hen he checked to see if dorp!or" 2as available! DDorpD is the
Dutch 2ord for villa"e! The 2ord stuck!
Donating to the Drupal proBect
Donate
Drupal currentl/ uses )a/)al for receivin" donations! (lick the
)a/pal button belo2 to donate mone/!

9f /ou are inspired to donate somethin", but do not 2ant to use
)a/)al, please see this ecellent H.,T. on donatin" to .pen
*ource proFects! 9f /ou are 2illin" to pa/ for particular
enhancements, consider contactin" someone listed on the
services pa"e!
Donors
9f /ou donate mone/ usin" )a/)al, /ou are automaticall/ added
to the list of donors! Drupal 2ill tr/ to connect /our )a/)al and
Drupal accounts usin" /our e+mail address! 9f Drupal fails to
connect both, update /our drupal!or" account so /our e+mail
address matches the one re"istered 2ith )a/pal!
The table belo2 provides an overvie2 of the people 2ho donated
mone/ to Drupal! The numbers represent the net amounts after
subtraction of transaction fees!
/ame
Amoun
t
Date
<ats *tau"aard !!!
bcd
3!2%
1 2eek
a"o
0inus 0ee
bcd
1&!&?
1 2eek
a"o
Harald ,alker *!!!
bcd
1&!3?
1 2eek
a"o
Kolanda (hiesa !!!
bcd
5!$2
1 2eek
a"o
*cott #ood2in
0!5%
'*D
2 2eeks
a"o
-rad/ 1arvis 4code0ran"e!net
proFect5
bcd
35!?5
2 2eeks
a"o
Drupal Handbook: 20 April 2005 $$
1effre/ *mith 41(*J<ono"ram
Holdin"s5
bcd
1&!&?
7 2eeks
a"o
1an :isser 4H/es.n*ales5
bcd
$?!?
7 2eeks
a"o
1effre/ *mith 41(*J<ono"ram
Holdin"s5
bcd
77!2&
7 2eeks
a"o
*cott #ood2in
0!5%
'*D
% 2eeks
a"o
>imio Kamakita bcd %!$
% 2eeks
a"o
(rai" 6ifield
bcd
$!$5
% 2eeks
a"o
A;DCH+) #A#;.;
bcd
$!$5
% 2eeks
a"o
(arlos <iranda 0ev/
bcd
27!%?
% 2eeks
a"o
Cob *tead
bcd
2&!$&
? 2eeks
a"o
.mar -ickell
bcd
3!2%
3 2eeks
a"o
-er >essels
bcd
$?!35
3 2eeks
a"o
David -artmess
bcd
3!2%
10 2eeks
a"o
1ohn Hurle/
bcd
3!2%
10 2eeks
a"o
0eonard 6eldman
bcd
?1!?2
10 2eeks
a"o
Todd (ochrane 4!!!
bcd
$?!?
11 2eeks
a"o
6erm@ *an ;icolas
bcd
27!%?
11 2eeks
a"o
<ichael >arliner
bcd
1&!&?
11 2eeks
a"o
#eoffre/ ,hite
bcd
3!2%
12 2eeks
a"o
-oris <ann bcd 750
12 2eeks
a"o
Drupal Handbook: 20 April 2005 $5
>imio Kamakita
bcd
0!57
17 2eeks
a"o
>imio Kamakita
bcd
3!2%
17 2eeks
a"o
Hasan Kalcinka/a
bcd
1&!&?
1$ 2eeks
a"o
Theodor *! ,einber"
bcd
$!$5
1$ 2eeks
a"o
1ames ,alker
bcd
$?!?
1$ 2eeks
a"o
eachar/ Cosen
bcd
27!%?
1$ 2eeks
a"o
Andre2 (ohill 4!!!
bcd
27!%?
15 2eeks
a"o
<atthe2 *ch2art= bcd 2&?
15 2eeks
a"o
>eith 9nstone bcd 35
15 2eeks
a"o
Alberto 0uis >napp -Feren bcd 35
1% 2eeks
a"o
-rad/ 1arvis bcd 35
1? 2eeks
a"o
(ommunit/ )ubli!!! bcd 77
1? 2eeks
a"o
,a/ne -artlin" bcd 1&
13 2eeks
a"o
<ichael *challa bcd 3
20 2eeks
a"o
<orrisse/+solo bcd $?
21 2eeks
a"o
-aba -uehler bcd 1&
21 2eeks
a"o
(ombonet2ork development bcd 2&
21 2eeks
a"o
(ielo */stems 9nc! bcd 1&
22 2eeks
a"o
>ath .DDonnell bcd $?
22 2eeks
a"o
Drupal Handbook: 20 April 2005 $%
<ichael Heath bcd $
22 2eeks
a"o
9smael 6anlo bcd $
22 2eeks
a"o
HvilsIuid!net ;!!! bcd 3
22 2eeks
a"o
-r/an >enned/ bcd 1%
22 2eeks
a"o
0/nn *iprelle bcd 3
22 2eeks
a"o
;ick -erendsen bcd 35
22 2eeks
a"o
1erem/ Ceichman bcd 1$
22 2eeks
a"o
Hric *couten bcd 2&
22 2eeks
a"o
<oshe ,eit=man bcd 77
22 2eeks
a"o
)ro"ression <edia bcd $
22 2eeks
a"o
>arsten <@fller bcd 1&
22 2eeks
a"o
)apasoft bcd $
22 2eeks
a"o
;eil Drumm bcd 1&
22 2eeks
a"o
-o 0aurent bcd 27
22 2eeks
a"o
0ucas >oorneef bcd 1$
22 2eeks
a"o
(hris 1ohnson bcd 27
22 2eeks
a"o
)ro"ressive :al!!! bcd 1&
22 2eeks
a"o
,ebs$!com bcd 3
22 2eeks
a"o
(harles 0o2e bcd 1&
27 2eeks
a"o
Drupal Handbook: 20 April 2005 $?
C-penses
Kour donation 2ill be used to help the Drupal proFect! 6or
eample, b/ pa/in" for:
Hostin": server and band2idth for drupal!or"
Development bounties
<arketin" material: fl/ers, posters, t+shirts, !!!
User:s guide
Desi"ned for users of Drupal sites, this non+technical "uide
offers G"ettin" startedG instructions and su""estions!
&asic concepts
!hat is Dcontent managementDA
Drupal is a Gcontent mana"ement s/stemG! This means itDs a
s/stem for mana"in" 2ebsite content++like articles, photos, or
other files! Drupal is a Gd/namicG rather than a GstaticG s/stem!
9nstead of bein" in pre+"enerated 4static5 files, content like the
tet on pa"es is stored in a database! ,hen visitors brin" up a
pa"e, a script runs on the 2eb server, Iuer/in" the database
and puttin" the content of the pa"e into a template! 4*ometimes,
to save time and resources, these scripts are run ahead of time
and the resultin" pa"es are GcachedG or stored on the server
instead of bein" "enerated afresh 2ith each visitor!5
*o to create or edit pa"es, /ou as a user donDt have to 2rite 2eb
pa"es! Kou donDt have to kno2 HT<0 4the lan"ua"e 2eb pa"es
are 2ritten in5! 9nstead, all /ou usuall/ have to do is:
re"ister 2ith a Drupal site
lo" in 4t/pe in the user name and pass2ord /ou "ot b/
re"isterin"5, and
t/pe content 4articles, etc!5 into forms that /ou submit!
This user "uide eplains the steps and "ives /ou other
back"round info!
'f /ariations and modules
Drupal is not a sin"le t/pe of 2ebsite++it is man/!
Drupal is hi"hl/ confi"urable, so the administrator of a
Drupal Handbook: 20 April 2005 $&
site can turn on and off different capabilities and make
man/ settin"s that chan"e the look and functionalit/ of a
site!
Drupal has a s/stem of privile"es that makes it possible to
create different t/pes of users + for instance, members,
staff, partners + that each can see and do different thin"s
on the site!
Drupal is desi"ned to be easil/ etended throu"h
GmodulesG++blocks of code that provide etra functionalit/
or enhancements! *ome modules come 2ith ever/ Drupal
installation 4GcoreG modules5, 2hile others can be
individuall/ do2nloaded and installed from the Drupal
2ebsite 4GcontributedG modules5!
The basic look and feel of a Drupal site can be chan"ed
throu"h different GthemesG! As 2ith modules, there are
both core and contributed themes!
All this means that 2hat /ou see on a particular Drupal site, and
2hat /ou can do there, depends to a ver/ hi"h de"ree on 2hat
the site administrator4s5 have chosen to present! *o 2e canDt
"ive /ou a definitive "uide hereL 9nstead, this user "uide
introduces some of the more common options and
functionalities! 6or more in+depth information, /ou can see the
administratorDs "uide and the Drupal forums!
$egistering and logging in
$egistering as a user
To add or edit content on a Drupal site, usuall/ /ou have to first
be re"istered as a user! 4*ometimes the site administrator has
chosen to enable Ganon/mousG posts of thin"s like comments, in
2hich case /ou can post them 2ithout re"isterin"!5
9n some cases, a site administrator 2ill add /ou as a user! 9f so,
the/ 2ill send /ou a user name and pass2ord that /ou can use
to lo" on!
.ther2ise, look for a small form called bYg'ser lo"inbY on the
main pa"e of the site /ou 2ant to re"ister 2ith 4usuall/ on the
ri"ht or the left of the pa"e5! (lick the link that sa/s G(reate
ne2 accountG!
The net pa"e that comes up 2ill "enerall/ have some
information on the siteDs policies for re"istration! After readin"
Drupal Handbook: 20 April 2005 $3
them, to re"ister, enter a user name of /our choice and an email
address to 2hich /ou have access and hit GsubmitG! Then check
/our email account! ,ithin a fe2 minutes, /ou should "et an
automaticall/+"enerated email confirmin" /our re"istration and
"ivin" /ou an initial pass2ord to use! ;o2 /ouDre read/ to lo" in!
,ogging in
-efore /ou can add or edit content, /ou usuall/ need to lo" in! 9f
/ou havenDt alread/ done so, re"ister as a user, see above 4or, if
applicable, reIuest that /our site administrator re"ister /ou5!
Then hit the main pa"e of the site /ouDre 2ishin" to use and look
for a G'ser lo"inG form! This 2ill t/picall/ be on the left or ri"ht
side of the pa"e 4it is a GblockG in Drupal talk5! Hnter /our user
name and pass2ord and hit GsubmitG!
Assumin" ever/thin"Ds 2orkin" as planned, 2hen the ne2 pa"e
loads it 2ill include a ne2 block 2ith /our user name at the top!
This is the menu /ou use to start enterin" and editin" content!
Changing your account settings
As a re"istered user, /ou can chan"e settin"s to control
information about /ourself and also /our use and eperience of a
Drupal site! To see 2hat t2eaks /ou can make to /our account,
lo" in and then follo2 the menu links: m/ account h edit account
Account ettings
Different information is available to be edited here dependin" on
2hat features /our site administrator has installed!
pass2ord
Hnter in a ne2 pass2ord in both fields to set it! Drupal
sends /ou a default pass2ord that is often hard to
remember, so it is recommended that /ou chan"e /our
pass2ord to somethin" /ou can easil/ remember!
block confi"uration
The site administrator ma/ make some blocks 4chunks of
content that are usuall/ displa/ed in a left andJor ri"ht
column5 optional! Kou can enable and disable the displa/ of
these blocks b/ checkin" and uncheckin" the boes net to
them!
si"nature
Drupal Handbook: 20 April 2005 50
9f comments are enabled, /ou 2ill be able to set a default
si"nature! This 2ill be copied into ne2 comments for /ou
automaticall/, but ma/ still be edited!
time =one
Kour site administrator ma/ allo2 users to set their time
=one! This 2ill cause all dated content on the site to displa/
in local time, accordin" to the offset /ou enter here!
theme
A GthemeG is the basic look and feel of a Drupal site!
*ometimes a particular site 2ill have more than one theme
installed! 9f the site administrator has made more than one
theme available, /ou 2ill be able to select 2hat /ou 2ould
like the default theme to be for /our account!
As mentioned at the be"innin", different features 2ill cause
different fields to displa/ on /our user account pa"e! *ee the
documentation for individual modules for instructions on ho2 to
use these additional options!
Additional "nformation
Aside from the account settin"s tab, /ou ma/ also see additional
tabs, titled accordin" to the information the/ contain! *ome
eamples mi"ht include G)ersonal 9nformationG, G,orkplaceG,
etc! These are controlled b/ the profile module, and allo2s /ou
to enter more information about /ourself! )lease see the profile
module for more information on this!
Creating ne* content
As a re"istered and lo""ed+in user, /ouDre read/ to start postin"
content!
Different types of content
There are various t/pes of content that /ou can post usin"
Drupal! <an/ of these are or"ani=ed into 2hat are called
GnodesG! -asicall/, /ou can think of a node as the content of a
pa"e! This mi"ht be, for instance, an article! (ontent is added or
updated throu"h 2eb pa"e forms! *o to add an article, /ou brin"
up a form, enter tet into it 4like the title and content of an
article5, and hit a button to submit the form!
Drupal Handbook: 20 April 2005 51
Topics#categories#terms
(ontent on Drupal 2ebsites is usuall/ or"ani=ed usin"
cate"ories throu"h a s/stem called Gtaonom/G! A taonom/ has
different GtermsG that are used as cate"ories for articles! ,hen
/ouDre addin" an article, /ou mi"ht find a drop+do2n list of
topics! -/ selectin" one, /ou choose 2here on the site to
cate"ori=e /our article! 9f this seems hard to relate to, /ou can
think of topics as bein" like folders on /our hard drive++the/ help
to or"ani=e content, so that /ou can find similar thin"s in the
same place!
Permissions
,hat t/pes of content /ou can create or edit depends on the
privile"es that have been assi"ned to the GroleG or user "roup
/ouDre a member of! 9n "eneral, to find out 2hat /ou can do:
.n /our user menu 4the collection of links that has /our
user name as a title5, look for a link that sa/s Gcreate
contentG! (lick this to "et a listin" of the t/pes of content
/ou have permission to post!
.r else on a particular pa"e, look for links at the bottom of
an article! These links sa/ thin"s like G12 commentsG 4if
there are comments that have been made on the article5
and Gread moreG 4if /ouDre lookin" at a short version of an
article5! 9f one of these links sa/ GadministerG or somethin"
like Gedit this pa"eG, /ou have permissions to edit that t/pe
of content!
ubmission (ueue
9 submitted a stor/, but it doesnDt appear an/2hereL
*ometimes a Drupal site is set up so that 2hen /ou submit a
stor/ it "oes strai"ht up on the site! .ften, thou"h, a Drupal site
is set up 2ith a Gsubmission IueueG! This means that articles
submitted are marked for evaluation! *o donDt 2orr/L ,hen a
site administrator has had a chance to look over /our
submission, the/Dll make the decision about 2hether it meets the
criteria for postin"!
Creating comments
(omments allo2 /ou as a user to interact 2ith the content on a
Drupal Handbook: 20 April 2005 52
site++to respond to an article, offerin" /our o2n ideas, additions,
or critiIue!
8aking comments
,hen /ou brin" up an article to read, look for comment+related
links at the bottom of the article! 9f /ouDre not lo""ed in, this
mi"ht read Glo"in or re"ister to post commentsG! ,hen /ou do
lo" in, /ou should see somethin" like GAdd ne2 commentG! (lick
on the link and /ouDre read/ to comment a2a/!
Cti(uette
(omments can be a "reat 2a/ of enrichin" a communit/ site++
but the/ can also lead to unfriendl/, even harassin" echan"es!
As 2ith an/ communication, itDs important to tr/ to ensure that
/our comments are respectful and constructive!
DThreadedD comments
(omments in the Drupal s/stem are GthreadedG! This means /ou
can comment directl/ on an article++or /ou can repl/ to an
eistin" comment! 9f /ou repl/, /our comment 2ill be indented
to sho2 that it is part of that discussion!
Adding DnodesD 1stories+ forum topics+ etc.2
At the top of /our personal menu, /ouDll find a link called Gcreate
contentG! (lick this and /ouDll see a list of the t/pes of content
/ou can create! This list reflects the privile"es assi"ned to /our
user account or to the "roup 4GroleG5 /our account is part of!
Preparing content
-efore postin" directl/ to a site, /ou ma/ 2ant to start in a 2ord
processin" pro"ram! )otential advanta"es include:
*avin" time online! This is a particular consideration if
/ouDre on dial+up!
Access to spell+check and other editin" features!
Dependin" on ho2 much formattin" /ou 2ish to do, /ou could
also consider usin" an HT<0 editor! These include, for instance,
the GcomposerG that comes 2ith <o=illa and ;etscape! *teps:
Drupal Handbook: 20 April 2005 57
T/pe or cop/ and paste /our tet into the HT<0 editor!
Appl/ formattin" as desired 4e!"!, bold, italics5!
-rin" up the HT<0 4encoded5 vie2 of the tet!
This HT<0 is 2hat /ouDll cop/ and paste into DrupalDs input
form, to have formatted cop/!
There are several contributed modules 2hich can assist 2ith
more comple content creation 2ithin this frame2ork, such as
spellcheckin", ima"e embeddin", and file attachment uploadin"!
Creating a story
To "et to the menu for addin" content, click Gcreate contentG on
the Admin menu!
KouDll be presented 2ith a list of t/pes of content /ou can create!
;otice that on the ri"ht+hand main pa"e space is a description
of each t/pe of content++a hand/ reference!
(lick on Gstor/G at the bottom of the Gcreate contentG menu!
KouDll "et the G*ubmit stor/G form!
6rom here, it is Fust a matter of fillin" in the form and postin" it!
Admin stuff
At the top of the form /ou ma/ see some administrative stuff! 9f
/ouDre not sure 2hat to do, Fust look at the GAllo2 user
commentsG bit! Drupal supports discussionJcomments on
postin"s++but such comments are not al2a/s appropriate! 9f
/our article is one that could be usefull/ commented on, keep
the default GCeadJ2riteG! .ther2ise, choose GDisabledG!
Title
The title is strai"htfor2ard enou"h! Tr/ to be descriptive and
catch/!
Topics
;et comes the GTopicsG pull+do2n menu! This is the section
/our article 2ill "o in++or in the technical lan"ua"e of Drupal
4Gtaonom/ termsG5! ,hat /ouDre seein" 2hen /ou pull do2n the
menu is all the sections available on the 2ebsite, 2ith their
structure! *o, choose the appropriate section for /our stor/ and
Drupal Handbook: 20 April 2005 5$
continue do2n the form!
&ody
The Gbod/G field is 2here /ou put the main content of the pa"e!
9f /ouDve t/ped this into a 2ord processor or HT<0 editor, Fust
cop/ and paste it into this field! Alternatel/ /ou can Fust t/pe
strai"ht in! 6or the most basic pa"e, Fust t/pe and include
double line returns 4hit GenterG t2ice5 at the and of each
para"raph!
Kou can optionall/ format /our entr/ in friendl/ old HT<0! -ut
he/, if /ouDre a novice, donDt 2orr/++thatDs not as difficult as it
sounds! HereDs a Iuick primer:
9f /ou 2ant somethin" to be bold, Fust enclose it in GbG or
Gstron"G ta"s, like this:
Vb_This tet is boldVJb_
Vstron"_This tet is boldVJstron"_
;ote that there is al2a/s an openin" ta" 4no for2ard slash5 and
a closin" ta" 4a for2ard slash before the ta" name, indicatin"
that /ou are turnin" it GoffG5!
To make somethin" italic, put it in GiG or GemG ta"s:
Vi_This is in italicsVJi_
Vem_This is in italicsVJem_
There is some considerable debate about the semantic nature of
the Vb_ and Vi_ ta"s versus the Vstron"_ and Vem_ ta"s!
To put thin"s nicel/ in para"raphs, enclose them in GpG ta"s!
Vp_This is a para"raph!VJp_
To make bullets, first open a list 2ith a GulG ta" 4that stands for
Gunordered listG5, then put each list item in GliG 4/es, for GlistG5
ta"s! DonDt for"et at the end to close off /our list 2ith a closin"
GulG ta"! HereDs ho2 it looks:
Vul_
Vli_This is the first bulleted itemVJli_
Vli_This is the second bulleted itemVJli_
VJul_
And to make headlines, use GhG ta"s, usin" numbers as
appropriate! That is, for a first+level headline, use Gh2G 42eDre
Drupal Handbook: 20 April 2005 55
startin" at 2 because these are reall/ sub+headlines and
shouldnDt be bi""er than the ori"inal pa"e title5! 6or a second+
level headline, use Gh7G! And so onL Hample, 2ith a para"raph
after it:
Vh2_This is the HeadlineVJh2_
Vp_And here is the para"raphVJp_
That 2asnDt too painful, 2as itE
Decide 2here /ou 2ant the GteaserG 4the part of the main tet
used in links to the article5 to end! 9f /ou do nothin", the
soft2are 2ill choose a breakin" point for /ou, like at a
para"raph return++but itDs better to decide /ourself, to make
sure the breakin" point is appropriate! Kou do this b/ t/pin" in:
VL++break++_
The GteaserG 2ill end at the point /ou put the VL++break++_!
And /ouDre setL Kou can previe2 the pa"e /ouDve prepared b/
hittin" G)revie2G 4recommended, and sometimes reIuired5 or
/ou can bravel/ or recklessl/ Fust "o ahead and publish it b/
hittin" G*ubmitG!
Alternati/e *ays to enter content
Dependin" on 2hatDs available on /our site, /ou mi"ht be able to
enter ne2 articles 2ithout ever lo""in" on to the site!
Drupal includes functionalit/ for Gblo""in"G++creatin" Gblo"sG or
2eb+based Fournals! 9f this functionalit/ is enabled on /our site,
/ou ma/ be able to input and edit content usin" one of a number
of Gblo"G soft2ares! These include pro"rams that run on /our
desktop and allo2 /ou to simpl/ t/pe in content, hit a GpostG
button, and have /our content automaticall/ loaded onto /our
site!
>eep in mind that blo""in" soft2are can be used for more than
blo"s! 9n fact, it can allo2 /ou to post content easil/ and Iuickl/
to almost an/ part of a 2ebsite usin" a simple, desktop pro"ram,
2ithout havin" to lo" on to a 2ebsite and follo2 links to brin"
up a form!
-efore tr/in" out one of the blo""in" soft2ares, /ou mi"ht 2ant
to check in 2ith an administrator on the site /ouDre 2orkin" on
to make sure it accepts blo" posts! (r/ptic Iuestion to ask: G9s
the blo""erapi enabledEG 9f the ans2er is /es, /ouDre read/ to
Drupal Handbook: 20 April 2005 5%
roll! 9f itDs no, /ou could reIuest that it be enabled to allo2 /ou
Iuick update abilities!
Posting and editing content *ith *.bloggar
2!blo""ar is a "ratis soft2are for ,indo2s desi"ned for Gblo"sG
42eb+based Fournals5!
9f /ouDve confirmed that blo" support is enabled, hereDs some
steps to "et "oin":
Do2nload the soft2are from http:JJ222!2blo""ar!comJ
and install!
*et up a ne2 account! This is eplained in the 2!blo""ar
help files!
,hen it comes time to set the G-lo" ToolG selection,
choose G<ovableT/peG 4and not GDrupalG5! This is
because 4at time of 2ritin"5 the Drupal support in
2!blo""ar is outdated!
6or GHostG put the domain of the 2ebsite /ouDre
usin", then for G)athG put the rest of the address, if
an/, follo2ed b/ GJmlrpc!phpG! *o if the address 2as
Ghttp:JJ222!"2orks!caJsiteJG /ou 2ould put
G222!"2orks!caG for host and GsiteJmlrpc!phpG for
)ath! The Gmlrpc!phpG part is the Drupal file that
handles the blo""in" input!
;o2 /ouDre read/ to start postin"! 9n doin" so, /ou can take
advanta"e of the tet formattin" functionalit/ 2!blo""ar offers!
,hen correctl/ set up, postin" a 2eb pa"e from 2!blo""ar is as
simple as openin" the pro"ram, t/pin" in some tet, selectin" a
cate"or/ 4the Gtaonom/ termG to use5 and hittin" post!
Cditing and deleting content
To edit or delete eistin" content, lo" in and then brin" up the
pa"e /ou 2ish to edit! 0ook belo2 the article 4or article
summar/5 for a link that sa/s GadministerG, or sometimes Gedit
this pa"eG! Dependin" on /our user permissions, /ou mi"ht see
this belo2 all pa"es or onl/ certain ones 4like those that /ou
/ourself submitted5!
(lickin" this link 2ill brin" up a pa"e 2ith a form for chan"in"
the pa"e! To edit the pa"e, chan"e the tet or settin"s and then
submit! 9f /ou 2ish to delete the pa"e, look for a GdeleteG button
Drupal Handbook: 20 April 2005 5?
near the bottom of the pa"e! ,hen /ou click it, /ouDll "et a
second chance to confirm that /ou 2ish to delete the pa"e++or to
chan"e /our mindL
Administrator:s guide
An administratorbYis "uide for installin" and confi"urin" a
Drupal site! This "uide includes etensive Ho2ToDs for usin" all
core modules!
Drupal terminology
As /ou start to read the Drupal documentation and learn ho2 it
2orks it 2ill help a lot if /ou kno2 2hat a fe2 2ords mean!
General terms
$odule
A module is a piece of code 2hich etends Drupal to
provide a specific piece of functionalit/! *ome modules are
part of the core Drupal s/stem 4e"! the taonom/ and blo"
modules5 and some others 4e"! the 2eblinks and ima"e
modules5! (ore modules are those included 2ith the main
do2nload of Drupal! (ontributed 4or GcontribG5 modules are
available for separate do2nload from the modules section
of do2nloads! -e sure that the version of the contrib
module /ou 2ish to use matches /our version of Drupal!
The releases section lists modules b/ Drupal version!
Theme
A )H) file of functions 2hich turn ar"uments into HT<0
markup! Drupal modules define themeable functions 2hich
can be overridden b/ the theme file! There are additional
themes available in the themes section of do2nloads!
,ngine
A special t/pe of theme that moves the HT<0 markup
"eneration to template files 4usin" an/ templatin" s/stem5!
Also tells the theme selector 2hat templates have been
defined! Additional theme en"ines 4template is the current
theme en"ine included 2ith core5 are available from the
theme en"ines section of do2nloads!
Drupal Handbook: 20 April 2005 5&
Template
A HT<0+2riter+readable file that is mostl/ HT<0 2ith
special codes to substitute in values provided b/ a en"ine!
!tyle
A (** file 4or files5 replacin" the default (** of a theme or
en"ine! Appears in the theme selection list 2ith the same
precedence as themes and templates!
/ode
;odes are probabl/ the hardest Drupal concept to "rasp
but the/ are reall/ Iuite simple! Almost all content in
Drupal is stored as a node! ,hen people refer to Ga nodeG
all the/ mean is a piece of content 2ithin Drupal, it could be
a poll, a stor/, a book pa"e an ima"e etc!
Bloc#
-locks are the navi"ational or content additions that live on
the left or ri"ht side of a pa"e 2hen /ou vie2 it in /our
bro2ser! -locks are not nodes, the/ are Fust a 2a/ of
positionin" data 2ithin a pa"e! The look of blocks can be
controlled b/ each theme b/ definin" the !oc(($su2ect'
$content' $region = *main*) method!
(onfi"urin" and <ana"in" -locks
Bo0
-o is a container for content on Drupal pa"es! Hach bo
has a title and some content! The look of boes can be
controlled b/ each theme b/ definin" the o$($su2ect'
$content' $region = *main*) method!
Ta0onomy
Taonom/ is literall/ Gthe science of classificationG! Drupal
uses taonom/ to describe the cate"or/ s/stem, 2hich /ou
can use to classif/ and or"ani=e content on /our 2eb site!
9n the Drupal menu s/stem DtaonomiesD and DcategoriesD
are s/non/mous! There is additional information on the
taonom/ s/stem in the documentation!
1ermissions
)ermissions control access to content creation, modification
and site administration! Administrators assi"n permissions
to roles, then assi"n roles to users! The first user of a
Drupal Handbook: 20 April 2005 53
Drupal site automaticall/ receives all permissions, no
matter 2hat role that user belon"s to!
2oles
Coles are "roups 2ith certain permissions that can be
applied to individual users! 'sers can belon" to more than
one role! T2o roles, authenticated user 4those users that
si"n up for an account5 and anon/mous users 4those either
2ithout an account or not lo""ed in5 are the default roles of
Drupal installations, but the/ can be confi"ured and the
first user can create additional roles!
3ilter
6rame2ork for handlin" filterin" of content!
7ode types
!ite page
*ite pa"es are static pa"es 2hich are t/picall/ 4but not
reIuired to be5 linked into the main navi"ation bar! .ne
special thin" about them is that the/ can contain
customi=ed )H) code in order to make their content
d/namic!
!tory 1age
*tor/ pa"es are the "eneric pa"e t/pe that most content
mana"ement s/stems have! *tories are "enerall/ used for
information 2hich is onl/ relevant for a period of time 4e"!
ne2s stories5 and is epected to epire off of the pa"e!
Boo# 1age
-ook pa"es are desi"ned to be part of a collaborative book!
An eample of a collaborative book is the Drupal developer
documentation! .ri"inall/ onl/ book pa"es could be a part
of a book but these da/s all node t/pes can be part of a
book! Ceall/ the onl/ special part about book pa"es these
da/s is that like static pa"es the/ can contain )H) code!
1oll
A poll is 2here a multiple choice Iuestion is asked and
users can ans2er and see other peoples ans2ers to
Iuestions!
Drupal Handbook: 20 April 2005 %0
Blog
-lo"s, or 2eblo"s, are another term for an online Fournal or
diar/! The/ are a place 2here members of the communit/
can 2rite their o2n thou"hts and not have to 2orr/ about
bein" ontopic for the site!
3orum
6orums are the same thin" as online bulletin boards! ;e2
forums can onl/ be created b/ administrators of the site
and are "enerall/ dedicated to a particular topic or
Iuestion! .nce a forum is created an/one can ask Iuestions
or comment on other peoples Iuestions!
Comment
(omments actuall/ arenDt nodes, the/ are their o2n special
content t/pe! (omments are 2hat allo2 people to add
comments to an/ other node that has been created!
"nstallation
ystem re(uirements
1! A ,eb *erver that can eecute )H) scripts
Cecommended: Apache! Development 2ith version
1!7!! *uccessfull/ tested 2ith version 2!0!!
.ptional: 99*! Drupal is bein" developed 2ith 99*
compatibili/ in mind, and 99* is reported to be
2orkin"!
2! )H)
As of Drupal $!%, the (<* reIuires )H) version
$!7!7X 4)H) 5 is supported for the $!% release5!
Drupal $!2 to $!5!2 inclusive reIuire )H) version
$!1X! .lder versions of Drupal 2ill run on )H)
$!0!%X! ,e recommend usin" the latest version of
)H) $!!
)H) 8<0 etension 4for Pblo""erapiTdrupalTFabberT
pin"Q!module5! This etension is enabled b/ default
in a standard )H) installationR the 2indo2s version
of )H) has built in support for this etension!
)H) needs the follo2in" confi"uration directives for
drupal to 2ork:
Drupal Handbook: 20 April 2005 %1
session!saveNhandler : user
9n addition, 2e recommend the follo2in"
settin"s:
session!cacheNlimiter : none
42e onl/ mention directives that differ from the
default php!ini+dist J php!ini+recommended
startin" 2ith )H) $!0!%5
These settin"s are contained in the default !htaccess
that ships 2ith drupal, so /ou shouldnDt need to set
them eplicitel/! ;ote, ho2ever, that settin" php
confi"uration options from !htaccess onl/ 2orks
2ith Apache 4or a compatible 2ebserver5,
if the !htaccess is actuall/ read, ie!
Allo2.verride is not ;one,
if php is installed as an Apache module!
*ee here for ho2 to chan"e confi"uration settin"s
for other interfaces to )H)!
'sin" a )HAC supported Database 4see belo25
reIuires 4of course5 )HAC to be installed!
7! A )H)+supported Database *erver
Cecommended: </*M0, v7!27!1? or ne2er 4for our
use of 9;;HC 1.9;Ds 2ith FoinNconditionDs5! </*M0 $
is fine!
.ptional: An/ )HAC supported Database! (urrentl/,
onl/ )ost"re*M0 is activel/ maintained and
supported, thou"h! Hperiences 2ith other
Databases are "reatl/ 2elcome!
"nstalling ne* modules
After installin" Drupal, /ou have the option of installin" etra
modules to etend or alter DrupalDs behavior!
9n brief! Do2nload the module, etract, upload the folder into
/our Drupal modules folder, run the m/sIl file if necessar/, and
enable the module in administer jh modules!
1! Do2nload the ne2 module! <ake sure the version of the
module is compatible 2ith /our version of Drupal! Also
note that modules labeled (:* are considered unstable
and should be handled 2ith care! T/picall/, (:* modules
2ork onl/ 2ith the (:* version of Drupal!
2! Htract the module! ,hen /ou first "et the module, it 2ill
probabl/ come in a compressed file format such as tar!"=!
Drupal Handbook: 20 April 2005 %2
.n ,indo2s, use a pro"ram like ,ineip to etract it! .n
the <ac, /ou can use *tuffit Hpander! To etract the file
usin" the 'ni command line:
tar 34$vf modu!ename35+6+tar+g4
Kou should see a list of files etracted in to a folder!
7! ,hen /ouDve etracted the file, upload the files via 6T) to
a folder inside the modulesJ folder of /our Drupal
installation!
$! Cead the installation file 4usuall/ 9;*TA00!tt andJor
CHAD<H!tt5! *ometimes the
installation file has no etension, so 2hen /ou tr/ to click
on it, /our computer doesnDt kno2 2hat pro"ram to use! 9n
that case, open ;otepad 4or /our favorite tet editor5 first,
and then open the file into it!
5! There are modules that modif/ the database! Kou can
"enerall/ tell if there is a modu!ename+mys7! file included
2ith the module! 9f /ou do have to modif/ the database,
see the net fe2 steps! 9f /ou do not, please skip to step ?!
%! 9f /ou have to modif/ the database to "et /our module
runnin", /ou 2ill need to add tables to the database /ou
made 2hen /ou installed Drupal!
4sing php$yAdmin:
9f /ou have phpm/admin, lo" in and "o to /our
drupal database! 9f /ou have it, but do not kno2 ho2
to access it, please contact /our host!
(lick on the tab that sa/s D*M0D
Kou should see a tet area labeled DCun *M0
Iuer/JIueries on database /ourdrupaldatabaseD!
'nderneath, it sa/s D.r 0ocation of the tetfile:D (lick
bro2se, and find the modu!ename+mys7! that came
2ith the module! (lick "o! 'nless /our instructions
for the module sa/s an/thin" else, that should be all
/ou have to do to the database!
4sing the 4ni0 command line:
Cun the follo2in" command!
mys7! 3u username 3ppass/ord dataase_name <
modu!ename+mys7!
Ceplace DusernameD 2ith /our </*M0 username,
Dpass2ordD 4but keep the +p before it5 2ith /our
</*M0 pass2ord, DdatabaseNnameD 2ith the
database Drupal uses, and Dmodulename!m/sIlD 2ith
the *M0 file that the module comes 2ith! Kou can
"enerall/ find this out from settin"s!php in either the
Drupal Handbook: 20 April 2005 %7
sitesJdefault folder or the sitesJsitedomain!com
folder, replacin" sitedomain!com for the domain that
hosts Drupal!5
?! 6or most modules, all that is left is to activate itL To
activate /our module, /ou need to click administer jh
modules, check the bo net to /our ne2 module name,
and click on D*ave confi"urationD at the end!
&! *ome modules 2ill reIuire /ou chan"e permissions or
settin"s to "et them 2orkin" as /ou like them! )ermissions
and settin"s info ma/ be in the instructions that came 2ith
the module! 9f not:
(lick administer jh access control! *croll do2n to
see if the module appears in the list and, if it does,
"ive the appropriate permissions to roles!
(lick administer jh settin"s and see if the name of
the module /ou Fust installed is in the list! 9f it is,
click the module name and confi"ure as appropriate!
3! 9f /ou still run into the problems, search the forums! 9f
/our problem hasnDt alread/ been addressed, post a ne2
post!
"nstallation process
.. $8d% 89:;<==+t$t'v 1+1> ,??6.?5.15 1>%@5%@1 dries A$p $
BC9;A9;: CD ;E8: D8=A
333333333333333333333
F Ge7uirements
F Cptiona! re7uirements
F 8nsta!!ation
3 Hrupa! administration
3 Bustomi4ing your theme(s)
F Ipgrading
F 1ore 8nformation
GAJI8GA1A9;:
333333333333
Hrupa! re7uires a /e server' KEK5 (5+@+@ or greater) or KEK6
(http%..///+php+net.) and either 1y:J= (http%..///+mys7!+com.)
or Kostgre:J= (http%..///+postgres7!+org.)+
9C;A% the <pache /e server and 1y:J= dataase are strong!y
recommended;
other /e server and dataase cominations such as 88: and
Kostgre:J=
are possi!e ut tested to a !esser e$tent+
CK;8C9<= GAJI8GA1A9;:
Drupal Handbook: 20 April 2005 %$
333333333333333333333
3 ;o use L1=3ased services such as the M!ogger <K8' Naer' G::
syndication' you /i!! need KEK's L1= e$tension+ ;his e$tension
is
ena!ed y defau!t in standard KEK5 insta!!ations+
3 8f you /ant support for c!ean IG=s' you'!! need mod_re/rite and
the ai!ity to use !oca! +htaccess fi!es+ (1ore information can
e found in the Hrupa! handoo( on drupa!+org+)
89:;<==<;8C9
333333333333
1+ HCO9=C<H HGIK<=
Pou can otain the !atest Hrupa! re!ease from
http%..drupa!+org.+
;he fi!es are in +tar+g4 format and can e e$tracted using most
compression too!s+ Cn a typica! Ini$ command !ine' use%
/get http%..drupa!+org.fi!es.pro2ect.drupa!3$+$+$+tg4
tar 34$vf drupa!3$+$+$+tg4
;his /i!! create a ne/ directory drupa!3$+$+$. containing a!!
Hrupa! fi!es and directories+ 1ove the contents of that
directory
into a directory /ithin your /e server's document root or your
pu!ic E;1= directory%
mv drupa!3$+$+$.F drupa!3$+$+$.+htaccess .var.///.htm!
,+ BGA<;A ;EA HGIK<= H<;<M<:A
;his step is on!y necessary if you don't a!ready have a
dataase
set3up (e+g+ y your host)+ 8f you contro! your dataases
through a
/e3ased contro! pane!' chec( its documentation for creating
dataases'
as the fo!!o/ing instructions are for the command3!ine on!y+
;hese instructions are for 1y:J=+ 8f you are using another
dataase'
chec( the dataase documentation+ 8n the fo!!o/ing e$amp!es'
'da_user' is an e$amp!e 1y:J= user /hich has the BGA<;A and
QG<9;
privi!eges+ Ise the appropriate user name for your system+
Dirst' you must create a ne/ dataase for your Hrupa! site
(here' 'drupa!' is the name of the ne/ dataase)%
mys7!admin 3u da_user 3p create drupa!
1y:J= /i!! prompt for the 'da_user' dataase pass/ord and then
create
the initia! dataase fi!es+ 9e$t you must !ogin and set the
access
Drupal Handbook: 20 April 2005 %5
dataase rights%
mys7! 3u da_user 3p
<gain' you /i!! e as(ed for the 'da_user' dataase pass/ord+
<t the 1y:J= prompt' enter fo!!o/ing command%
QG<9; <== KG8R8=AQA: C9 drupa!+F
;C noodyS!oca!host 8HA9;8D8AH MP 'pass/ord';
/here
'drupa!' is the name of your dataase
'noodyS!oca!host' is the username of your /eserver 1y:J=
account
'pass/ord' is the pass/ord re7uired to !og in as the 1y:J=
user
8f successfu!' 1y:J= /i!! rep!y /ith%
Juery CT' ? ro/s affected
;o activate the ne/ permissions you must enter the command%
f!ush privi!eges;
and then enter 'U7' to e$it 1y:J=+
@+ =C<H ;EA HGIK<= H<;<M<:A :BEA1A
Cnce you have a dataase' you must !oad the re7uired ta!es
into it+
8f you use a /e3ased contro! pane!' you shou!d e a!e
to up!oad the fi!e 'dataase+mys7!' from Hrupa!'s 'dataase'
directory and run it direct!y as :J= commands+
Drom the command !ine' use (again' rep!acing 'noody' and
'drupa!' /ith your 1y:J= username and name of your dataase)%
mys7! 3u noody 3p drupa! < dataase.dataase+mys7!
5+ BC99AB;89Q HGIK<=
;he defau!t configuration can e found in the
'sites.defau!t.settings+php' fi!e /ithin your Hrupa!
insta!!ation+
Mefore you can run Hrupa!' you must set the dataase IG= and
the
ase IG= to the /e site+ Cpen the configuration fi!e and edit
the
$d_ur! !ine to match the dataase defined in the previous
steps%
$d_ur! = *mys7!%..username%pass/ordS!oca!host.dataase*;
/here 'username'' 'pass/ord'' '!oca!host' and 'dataase' are
the
Drupal Handbook: 20 April 2005 %%
username' pass/ord' host and dataase name for your set up+
:et $ase_ur! to match the address to your Hrupa! site%
$ase_ur! = *http%..///+e$amp!e+com*;
8n addition' a sing!e Hrupa! insta!!ation can host severa!
Hrupa!3po/ered sites' each /ith its o/n individua!
configuration+
8f you don't need mu!tip!e Hrupa! sites' s(ip to the ne$t
section+
<dditiona! site configurations are created in sudirectories
/ithin
the 'sites' directory+ Aach sudirectory must have a
'settings+php'
fi!e /hich specifies the configuration settings+ ;he easiest
/ay to
create additiona! sites is to copy the 'defau!t' directory and
modify
the 'settings+php' fi!e as appropriate+ ;he ne/ directory name
is
constructed from the site's IG=+ ;he configuration for
///+e$amp!e+com
cou!d e in 'sites.e$amp!e+com.settings+php' (note that '///+'
shou!d
e omitted if users can access your site at
http%..e$amp!e+com.)+
:ites do not each have to have a different domain+ Pou can use
sudomains and sudirectories for Hrupa! sites a!so+ Dor
e$amp!e'
e$amp!e+com' su+e$amp!e+com' and su+e$amp!e+com.site@ can a!!
e
defined as independent Hrupa! sites+ ;he setup for a
configuration
such as this /ou!d !oo( !i(e the fo!!o/ing%
sites.defau!t.settings+php
sites.e$amp!e+com.settings+php
sites.su+e$amp!e+com.settings+php
sites.su+e$amp!e+com+site@.settings+php
Ohen searching for a site configuration (for e$amp!e
///+su+e$amp!e+com.site@)' Hrupa! /i!! search for
configuration
fi!es in the fo!!o/ing order' using the first configuration it
finds%
sites.///+su+e$amp!e+com+site@.settings+php
sites.su+e$amp!e+com+site@.settings+php
sites.e$amp!e+com+site@.settings+php
sites.///+su+e$amp!e+com.settings+php
sites.su+e$amp!e+com.settings+php
sites.e$amp!e+com.settings+php
sites.defau!t.settings+php
Aach site configuration can have its o/n site3specific modu!es
Drupal Handbook: 20 April 2005 %?
and
themes that /i!! e made avai!a!e in addition to those
insta!!ed
in the standard 'modu!es' and 'themes' directories+ ;o use
site3specific modu!es or themes' simp!y create a 'modu!es' or
'themes' directory /ithin the site configuration directory+ Dor
e$amp!e' if su+e$amp!e+dom has a custom theme and a custom
modu!e
that shou!d not e accessi!e to other sites' the setup /ou!d
!oo(
!i(e this%
sites.su+e$amp!e+com.%
settings+php
themes.custom_theme
modu!es.custom_modu!e
9C;A% for more information aout mu!tip!e virtua! hosts or the
configuration settings' consu!t the Hrupa! handoo( at
drupa!+org+
6+ BC9D8QIGA HGIK<=
Pou shou!d consider creating a *fi!es* sudirectory in your
Hrupa!
insta!!ation directory+ ;his sudirectory stores fi!es such as
custom !ogos' user avatars' and other media associated /ith
your
ne/ site+ ;he su3directory re7uires *read and /rite*
permission
y the Hrupa! server process+ Pou can change the name of this
sudirectory at *<dminister & :ettings & Di!e system settings*+
Pou can no/ !aunch your ro/ser and point it to your Hrupa!
site+
Breate an account and !ogin+ ;he first account /i!!
automatica!!y
ecome the main administrator account /ith tota! contro!+
-+ BGC9 ;<:T:
1any Hrupa! modu!es (such as the search functiona!ity) have
periodic
tas(s that must e triggered y a cron 2o+ ;o activate these
tas(s'
ca!! the cron page y visiting http%..///+e$amp!e+com.cron+php
33
this /i!! pass contro! to the modu!es and the modu!es /i!!
decide if
and /hat they must do+
1ost systems support the cronta uti!ity for schedu!ing tas(s
!i(e
this+ ;he fo!!o/ing e$amp!e cronta !ine /i!! activate the cron
tas(s automatica!!y on the hour%
? F F F F /get 3C 3 37
Drupal Handbook: 20 April 2005 %&
http%..///+e$amp!e+com.cron+php
1ore information aout the cron scripts are avai!a!e in the
admin
he!p pages and in the Hrupa! handoo( at drupa!+org+ A$amp!e
scripts can e found in the scripts. directory+
HGIK<= <H1898:;G<;8C9
333333333333333333333
Ipon a ne/ insta!!ation' your Hrupa! /esite defau!ts to a very
asic
configuration /ith on!y a fe/ active modu!es' one theme' and no
user
access rights+
Ise your administration pane! to ena!e and configure services+
Dor
e$amp!e' set some genera! settings for your site /ith *<dminister
&
:ettings*+ Ana!e modu!es via *<dminister & 1odu!es*+ Iser
permissions
can e set /ith *<dminister & Isers & Bonfigure & Kermissions*+
Dor more information on configuration options' read through the
instructions /hich accompany the different configuration settings
and
consu!t the various he!p pages avai!a!e in the administration
pane!+
Bommunity3contriuted modu!es and themes are avai!a!e at
http%..drupa!+org.+
BI:;C18V89Q PCIG ;EA1A(:)
3333333333333333333333333
9o/ that your server is running' you /i!! /ant to customi4e the
!oo(
of your site+ :evera! samp!e themes are inc!uded in the Hrupa!
insta!!ation and more can e do/n!oaded from drupa!+org+
Bustomi4ing each theme depends on the theme engine+ 8n genera!'
each theme
contains a KEK fi!e themename+theme /hich defines a function
header()
that can e changed to reference your o/n !ogos+
1ost themes a!so contain sty!esheets to tune the co!ors and
!ayouts;
chec( the themes. directory for GA<H1As descriing each a!ternate
theme+
IKQG<H89Q
333333333
1+ Mac(up your dataase and Hrupa! directory 3 especia!!y your
configuration fi!e in 'sites.defau!t.settings+php'+
Drupal Handbook: 20 April 2005 %3
,+ =og on as the user /ith user 8H 1+
@+ Gemove a!! the o!d Hrupa! fi!es then unpac( the ne/ Hrupa!
fi!es into the directory that you run Hrupa! from+
5+ 1odify the ne/ configuration fi!e to ma(e sure
it has the !atest and correct information+
6+ Gun update+php y visiting http%..///+e$amp!e+com.update+php+
1CGA 89DCG1<;8C9
3333333333333333
Dor p!atform specific configuration issues and other insta!!ation
and
administration assistance' p!ease consu!t the Hrupa! handoo( at
http%..drupa!+org.+ Pou can a!so find support at the Hrupa!
support
forum or through the Hrupa! mai!ing !ists+
General "nstructions
Here is the procedure for installin" drupal on a 0inu or 'ni
s/stem! This chapter describes the "eneric installation
procedure for drupal as 2ell as detailin" some installation
instructions for specific confi"urations!
1! Do2nload the distribution tar+ball and un=ip it into the
director/ /ou 2ant to serve 2eb files from:
tar 34$vf drupa!3$+$+$+tar+g4
2! (reate a </*M0 database for /our drupal site 4if /ou
havenDt alread/5:
mys7!admin create dataase_drupa!
7! (reate a user for /our </*M0 database and assi"n it the
proper permissions!
At the command line 4reIuires root access or
permissions to create users5 t/pe the follo2in" lines!
The first line runs </*M0, then the second line
instruct the </*M0 pro"ram to create the proper
permissions!
mys7! 3u root 3prootpass/ord dataase_drupa!
grant a!! privi!eges on dataase_drupa!+F to
usernameS!oca!host identified y
'userpass/ord';
5mportant: in the above eamples, replace
rootpass2ord 2ith the root </*M0 userDs pass2ord,
databaseNdrupal 2ith the name of the database /ou
are creatin", username the Drupal databaseDs
Drupal Handbook: 20 April 2005 ?0
username, userpass2ord 2ith the ne2 pass2ord /ou
are assi"nin" to that </*M0 user!
$! .nce /ou have a proper database, dump the reIuired
tables into /our database:
mys7! 3u username 3puserpass/ord
dataase_drupa! #!t; dataase.dataase+mys7!
5! Hdit the inc!udes.conf+php confi"uration file to set the
reIuired settin"s such as the database options and to
customi=e /our site! Kou 2ill need to kno2 /our </*M0
username, pass2ord, and database name 4see above5!
%! 0aunch /our bro2ser and point it to
http%..yourdomain+com. and create an account, lo" in!
The first user 2ill automaticall/ have all administrator
permissions! (lick m/ account to edit /our pass2ord!
?! 4.ptional5 Hdit the !htaccess file and set the values of the
)H) variables to /our likin"s: session!name,
session!cookieNlifetime, session!"cNmalifetime,
session!cacheNepire and session!saveNpath! (heck /our
)H) reference manual for the eact purpose of each
variable mentioned!
&! 4.ptional5 *etup a crontab to periodicall/ visit
http%..yourdomain+com.cron+php!
This usuall/ means editin" the .etc.cronta file and
insertin" a line like one 4but not bothL5 of the
follo2in":
?? F F F F .usr.in.!yn$ 3source
http%..yourdomain+com.cron+php
?? F F F F .usr.in./get 3C .dev.nu!!
http%..yourdomain+com.cron+php
/otes:
)H)!ini should have the follo2in" settin"s:
+ re"isterN"lobals`on
+ allo2NcallNtimeNpassNreference ` .n
4o* to install Drupal for ne*bies using
!indo*s+ 3TP and php8yAdmin
There are three thin"s to do: upload the database, "et drupal
read/ and chan"e GJtmpG on /our drupal site!
Drupal Handbook: 20 April 2005 ?1
Upload the database.
1! 0o"in to /our php</Admin 4on /our server5!
2! (lick G(reate ne2 database!G
+ name it GdrupalG 4or 2hatever /ou like5!
7! Kou should see GdrupalG at the top of the left column! (lick
Gdrupal!G
$! 9n the center column /ou should see some tabs to choose
from! (lick G*M0!G
5! At the bottom of the bo that comes up it sa/s, G0ocation
of the tetfile:G and thereDs a button that sa/s, G-ro2seG!
(lick G-ro2seG and navi"ate to the file Gdatabase!m/sIl!G
9ts on /our computer inside the folder /ou etracted,
Gdrupal!$!5!2,G inside the GdatabaseG folder! *elect
Gdatabase!m/sIlG and click Gopen!G
Get Drupal ready.
%! Do2nload Drupal !
?! Htract Drupal to /our desktop 4or 2herever /ou like on
/our computer5! Kou need to have a pro"ram like ?+=ip or
,in=ip installed first! Kou 2ill have to etract the files
t2ice!
&! Hdit conf!php! 9tDs in the drupal+$!5!2Jincludes director/
after /ou etract the files! Kou have to edit t2o lines in this
file!
To edit the file, /ou ma/ need to load /our tet editor
4,indo2s comes 2ith ;otepad and ,ordpad, either
of 2hich 2ill do fine5 first then find the file b/
clickin" the 6ile menu, then .pen!
3! (han"e: WdbNurl `
Gm/sIl:JJuser:pass2ordUlocalhostJdrupalGR
Kou must replace GuserG and Gpass2ordG 2ith /our
username and pass2ord for /our php</Admin lo"in
and GdrupalG 2ith /our databaseDs name!
10!(han"e: WbaseNurl ` Ghttp:JJ222!eample!comGR
Kou must replace Geample!comG 2ith /our domain
name!
11!)ut drupal on /our server! Kou need an 6T) pro"ram like
6ileeilla!
.pen /our 6T) pro"ram and navi"ate to the
director/ 2here /our inde!htm file 2ould normall/
"o! This is usuall/ called publicNhtmlJ or 222J This
is 2here /ou put the drupal files! The drupal files
Drupal Handbook: 20 April 2005 ?2
that "o there are the contents of drupal+$!5!2, that
/ou etracted! Kou donDt put the folder itself on the
server, Fust the contents! That means /ou are
uploadin" si folders 4database, includes, etc!5 and
ten files 4!htaaccess, cron!php, etc!5!
12!(reate a ne2 director/ on /our server!
9n /our 6T) pro"ram, ri"ht click on the server side,
select Gcreate director/G and name the ne2 director/
Gfiles!G Kou 2ant GfilesG in the main director/! After
/ou create it, /ou should see it in bet2een
GdatabaseG and Gincludes!G
17!;o2 /ou open up /our ne2 director/, Gfiles,G and create a
ne2 director/ inside called, Gtmp!G
1$!(han"e the file attributes of both GfilesG and GtmpG b/
ri"ht clickin" on them one at a time, selectin" Gfile
attributesG and enterin" G?55G in the Gnumeric valueG field
4if /ou see errors on /our drupal site later sa/in" GfilesG
and GtmpG are not 2riteable /ou have to chan"e the file
attributes to G???,G 2hich is less secure5!
Change D#tmpD on your drupal site.
15!.pen a bro2ser and "o to /our ne2 drupal site, 2hatever
its domain is!
1%!(reate a ne2 user account! Kou enter a username and
pass2ord and no2 /ou are the admin for /our ne2 site!
5mportant: the first user /ou create has access to
ever/ administration settin" on /our Drupal site!
1?!.n the left side of /our screen, there is a link,
Gadminister!G (lick Gadminister,G then Gsettin"s!G
1&!*croll do2n to G6ile s/stem settin"sG and in the
GTemporar/ director/G field /ou 2ill see GJtmp!G Cemove
the GJG from in front of Gtmp!G *o no2 in GTemporar/
director/G the field should onl/ contain Gtmp!G (lick G*ave
confi"uration,G at the bottom of the screen!
@ou:re doneE
"nstalling Drupal in a subdirectory
9f /ou install Drupal in a subdirector/, /ou need to alter the +
htaccess file in DrupalDs root!
(han"e HrrorDocument to:
Drupal Handbook: 20 April 2005 ?7
0 Bustomi4ed server error messages%
ArrorHocument 5?5 .sudirectory.inde$+php
(han"e Ce2rite-ase to:
0 1odify the Ge/riteMase if you are using Hrupa! in a
sudirectory and the
0 re/rite ru!es are not /or(ing proper!y%
Ge/riteMase .sudirectory
Cemove an/ kDs in front of the Ce2rite-ase line in case itDs
commented out!
<ake sure /our $ase_ur! in conf+php is set correctl/ as 2ell!
,inu- specific guidelines
"nstalling P4P+ 8y9, and Apache under ,inu-
9nstallin" </*M0 shouldnDt be too much of a burden, 2hen usin"
a 0inu distribution that can handle C)<s! All /ou have to do is
"rab the C)<s from the </*M0 2ebsite! )lease do note that
/ouDll also need the </*M0 client C)<, not onl/ the </*M0
server one! .nce </*M0 has been installed, do2nload Apache
and )H), and unpack them in the same director/! To install
Apache to"ether 2ith )H) and </*M0, follo2 the GIuick
installG+instructions in the 9;*TA00+file located in /our )H)
director/! ,hen confi"urin" )H) do not for"et to replace
DapacheN1!7!D 2ith /our version of Apache!
After the compilation process /ou have to set the DocumentCoot
in ApacheDs httpd!conf to the path of /our drupal+director/!
<ake sure /our Apache is setup to allo2 !htaccess files so
drupal can override Apache options from 2ithin the drupal
directories! Therefore, set Allo2.verride to GAllG instead of
G;oneG! *ome2hat do2n httpd!conf the/ ask /ou to set
Director/ to 2hatever /ou set DocumentCoot to! The last thin"
to do is to add inde!php in 9f<odule modNdir!c behind
Director/9nde! Apache 2ill then look for inde!php in the
DocumentCoot and 2ill displa/ it as its main pa"e!
Drupal Handbook: 20 April 2005 ?$
8o/ing @our Drupal "nstallation To A 7e*
Directory
9f for instance /ou need to move /our installation from
222!m/site!comJdevelopmentJ to the root director/ of
222!m/site!com, Fust follo2 these simple steps:
Copy 3iles
(op/ the files of /our Drupal installation from the old director/
to /our ne2 director/! <ake sure /ou include !htaccess!
Change Path
9n /our ne2 director/, open the file includesJconf!php
0ook for a line that be"ins 2ith GWbaseNurl ` G, update this so
that WbaseNurl eIuals the path to /our ne2 director/! *ave the
file and close it!
Kou mi"ht need to modif/ the !htaccess file as 2ell!
Update Cron
9f /ou set up (ron on /our old installation, make sure /ou
update it to point to /our ne2 installation!
Delete 'ld Directory
Test that ever/thin" is 2orkin" in /our ne2 installation! 9f so, it
is no2 safe to delete the files in /our old Drupal director/!
8 9, er/er Guidelines
'pdate: 2ith Drupal $!$, <**M0 is not supported because 2e
have no maintainer for this piece of the application! 9f /ou 2ish
to update the database!mssIl schema and "et <**M0 2orkin"
a"ain, please send a note to the drupal+devel mail list!
9n order to use <* *M0 *erver, /ou 2ill need the follo2in":
)H) 2ith the <**M0 etension active
)HAC must be installed and on /our include path! Kou can
set the include path in /our conf!php 2ith somethin"
similar to !!!
Drupal Handbook: 20 April 2005 ?5
ini_set(*inc!ude_path*' *+;c%.php.pear*);
Add the follo2in" line to /our includesJconf!php file:
ini_set(*magic_7uotes_syase*' 1);
'se Muer/ Anal/=er or Hnterprise <ana"er to do the follo2in":
(reate a database for /our site!
(reate a user 2ho has ma/ readJ2rite data, and
createJdelete tables!
.nce /ou have a proper database, dump the reIuired
tables into /our database b/ eecutin" the file
database!mssIl in /our Muer/ Anal/=er!
;ote that the bottom of the database!mssIl file contains
function4s5 2hich onl/ 2ork in *M0 2000! 9f /ou are usin"
a prior version, /ou currentl/ cannot use the forum and
tracker modules! These functions seem not to 2ork
2ithout minor modification to the Drupal source code!
*pecificall/, substitute dbo!#CHATH*T 2herever /ou find
#CHATH*T! )lease post here if /ou find a 2a/ around this!
*et the database options in includesJconf!php so Drupal
can access the database /ou have created! Hdit the
follo2in" line in includesJconf!php:
$d_ur! = *mss7!%..username%pass/ordShostname.dname*;
'5 pecific Guidelines
update: donDt miss this fine tutorial on this topic!
9nstall and confi"ure </sIl and )H)! *erver 0o"istics provides
nice pre+compiled packa"es and instructions! )H) is also
available from <arc 0i/ana"e!
The stock version of Apache should be fine!
Turn on Gpersonal 2eb sharin"G in the sharin" panel of */stem
Drupal Handbook: 20 April 2005 ?%
)references!
9n httpd!conf 4in JprivateJetcJhttpd5, locate the follo2in" section
and allo2 overrides, so that DrupalDs clean urls 2ill 2ork 4the/
depend upon re2rite rules in !htaccess5! KouDll need to be root
4or sudo5 to do this! DonDt for"et to restart apache after
modif/in" httpd!conf 4turn personal 2eb sharin" off, then back
on a"ain, or use JusrJsbinJapachectl restart5!
0
0 ;his contro!s /hich options the +htaccess fi!es in directories
can
0 override+ Ban a!so e *<!!*' or any comination of *Cptions*'
*Di!e8nfo*'
0 *<uthBonfig*' and *=imit*
0
0 <!!o/Cverride 9one
<!!o/Cverride <!!
Drupal "oes into J0ibrar/J,eb*erverJDocumentsJ, or lJ*ites!
Postgre9, specific guidelines
1! (reate a )ost"re*M0 database for /our site!
created 3I username dbname
2here username is the o2ner of the database 4this user
must have permission to create databases5 and dbname
is the name of /our database! Kou 2ill be prompted for
that userDs pass2ord! .n success, the follo2in" is
displa/ed: BGA<;A H<;<M<:A
2! .nce /ou have a proper database, dump the reIuired
tables into /our database:
ps7! 3u username dname < dataase.dataase+pgs7!
Kou 2ill be prompted for /our database pass2ord! Kou
should see a pro"ress report as the tables are
created! All has "one 2ell if there are no lines
marked GHrror:G printed to the screen!
Drupal Handbook: 20 April 2005 ??
7! *et the database options in includesJconf!php so
Drupal can access the database /ou have created! Hdit
the follo2in" line in includesJconf!php:
$d_ur! = *pgs7!%..username%pass/ordShostname.dname*;
"nstalling Postgre9, on !indo*s
)ost"res is easil/ installed and administered on ,indo2s!
*ee )ost"re*M0 on ,indo2s for the options /ou have!
As of this 2ritin", the apparentl/ easiest choice for
)ost"re*M0 on ,indo2s is G'ltra*M0 b/ )eerDirectG
mentioned at above link! 9t is available from here!
*ee the CHAD<H file enclosed in the do2nload and
9nstallin" the )eerDirect )ost"re*M0 beta for
,indo2s for more instructions! After completin"
installation, the username for /our D- is /our
2indo2s lo"in name and there is no pass2ord!
Kou mi"ht 2ant to install php)"*M0 in order to
admin /our database! 9t 2ill save /ou frustation at
the command line! A more complete list of all kno2n
)ost"re*M0 #'9 tools is available at
href`Ghttp:JJtechdocs!post"resIl!or"J"uidesJ#'9Tool
sG_)ost"re*M0 #'9Ds
#o ahead and create /our database tables via
php)"*M0 or via the command line as described
here!
!indo*s specific guidelines
*everal packa"es eist 2hich install Apache, )H), and
</*M0 in one eas/ do2nload! 9f /ou 2ant to install them
separatel/, see the "uidelines belo2! .ther2ise, have a
look at
<iniserver
6oserv
)H)Home
"nstalling Apache 1*ith P4P2 on !indo*s
The first step to "ettin" Drupal runnin" on /our ,indo2s
machine is to set up the Apache 2eb server!
Drupal Handbook: 20 April 2005 ?&
,hile /ouDre at it, itDs best to install )H) alon" the 2a/
because /ouDll be editin" the same files for both of them!
#rab the latest cop/ of Apache and )H)!
Cun the setup files and install the packa"es! 9tDs best
to do a full install!
,hen prompted for the directories to install the
pro"rams into, make sure there are no spaces in the
paths! .ddl/ enou"h, the Apache+9nstaller defaults to
C:61rogram 3iles6Apache 7roup6Apache! 9f /ou
keep this, /ou Iuite certainl/ 2ill run into problems
2ith c"i+ and php+scripts not findin" paths! (han"in"
this to somethin" like C:6progs6web6Apache and
C:6progs6web61-1 2ill do Fust fine!
#o to the folder 2here /ou have installed Apache,
and under that /ou 2ill see a folder conf! 9n there is
a file, httpd.conf, 2hich /ou have to edit net:
*earch for !ererAdmin and chan"e it to /our
e+mail address
9f /ou 2ant to do local testin" onl/, chan"e
!erer/ame to 12?!0!0!1
(han"e Directory5nde0 inde0.html to
Directory5nde0 inde0.php inde0.html
(han"e /our Documentroot value to the
folder 2here /ou un=ipped Drupal!
*earch for AddType and add the follo2in"
lines:
AddType application%0-httpd-php .
php
AddType application%0-httpd-php-
source .phps
!criptAlias %php% 8C:%php%8 2here the
path points to the folder /ou installed
)H) to! Cemember to use for2ard
slashes!
Action application%0-httpd-php
8%php%php.e0e8
6ind 9Directory and chan"e that value to
9Directory 8C:%Drupal8: 2ith the same path
as /our Documentroot value!
;et, "o to /our )H) folder and edit php.ini! 9f
there is no such file, check for a php.ini-dist and
cop/ it!
*earch for a section called ;mail function<
Drupal Handbook: 20 April 2005 ?3
and fill in /our out"oin" mailserver 4*<T)5
and email+address!
;et, "o to the section called ;!ession< and
chan"e the session.sae=path to a valid
temporar/ folder on /our harddrive 4e!"!
C:6Windows6Temp5
'se the !tart Apache as a serice icon in /our
*tart <enu! "roup!
Hver/thin" should 2ork fine no2!
"nstalling 8y9, on !indo*s
After do2nloadin" the latest stable release version
of </*M0, locate the setup!ee, and eecute it!
,hen prompted choose custom install!
(hoose a path to install it! 9 recommend keepin" to
the default, 2hich is c:mm/sIl!
*elect all components, and continue until done!
#o to the </*M0 folder, and start
2inm/sIladmin!ee
(hoose a username and pass2ord for /ourself!
9n the console, click on the m/!ini tab, and choose
Gcreate shortcut in startmenuG option!
9n the m/!ini tab, also chck that all the confi"urable
options are correct in accordance to /our computer!
(lose the admin console and restart it! 9f admin
pro"ram runs 2ith a "reen li"ht, ever/thin" fine!
"nstalling P4P4 on !indo*s
After obtainin" the latest stable release of )H),
etract the archive to c:6php or somethin" similar!
(op/ php.ini-optimi>ed to php.ini
<ake the follo2in" modifications:
(han"e include=path to 88.88
(han"e sendmail=from to
88your?email.address88
(han"e !$T1 to 8your.smtp.mail.serice8 9f
/ou donDt kno2 /our smtp server, use the same
confi"uration as /our email client uses!
(han"e session.sae=path to a temporar/
folder @88drie:pathtotemp88A and make sure
the temporar/ folder eists!
Drupal Handbook: 20 April 2005 &0
(han"e doc=root to /our preferred 2ork
folder @88drie:pathtofiles88A! <ake sure it
eists and is the same folder /our specified in
the Apache setup procedure!
*et register=globals to eIual G.nG
*ave the chan"es, and cop/ the php.ini file to /our
,indo2s director/!
(reate a basic php file, for eample test.php 2hich
contain the follo2in": 9B1-1 phpinfo@AC B: and
save it in /our 2ork folder!
.pen /our 2eb bro2ser, and t/pe in:
http:%%localhost%test.php! 9f /ou "et the )H)
information pa"e, then ever/thin" is set up correctl/!
9f not, Fust "o over the settin"s a"ain for )H) to
make sure ever/thin" is ok!
Untar
,hen /ou do2nload drupal packa"es /ou 2ill need to
decompress the files! Drupal packa"es are double
compressed DtarD and D"=D! To untar packa"es in 2indo2s
several pro"rams are recomended!
?=ip
,in=ip
,inrar
,inace
Using Clean U$,s *ith ""
Drupal can displa/ brief, prett/ 'C0s like those at
drupal!or"! 6or Apache sites, modNre2rite po2ers this
feature! 6or 99*, /ou 2ill use a custom error handler for
this! Kou probabl/ 2ant to disable lo""in" in 99*, since
ever/ pa"e vie2 is considered an error usin" this
techniIue!
make sure /our Drupal is 2orkin" 2ell 2ithout clean
urls enabled!
open /our 9nternet *ervices <ana"er or <<( and
bro2se to the root director/ of the 2eb site 2here
/ou installed Drupal! Kou cannot Fust bro2se to a
subdirector/ if /ou happenned to install to a
subdirector/!
Drupal Handbook: 20 April 2005 &1
ri"ht click and select properties +_ custom errors tab
set the HTT) Hrror $0$ and $05 lines to
<essa"eT/pe`'C0, 'C0`Jinde!php! 9f /ou are
usin" Drupal in a subdirector/, prepend /our subdir
before Jinde!php
paste the follo2in" code into the bottom of
settings+php file, 2hich is usuall/ located under
sites.defau!t.! the first t2o lines should be edited!
9f /ou arenDt usin" a subdirector/, set WsubNdirector/
to GG! then set Wactive`1 and enFo/L
<?php
.. BC9D8QIG<;8C9
$su_dir = *.51.*; .. enter a sudirectory'
if any+ other/ise' use **
$active = ?; .. set to 1 if using c!ean IG=:
/ith 88:
.. BCHA
if ($active ## strstr($_:AGRAG
[*JIAGP_:;G89Q*"' *;*)) {
$7s = e$p!ode(*;*' $_:AGRAG
[*JIAGP_:;G89Q*");
$ur! = array_pop($7s);
$parts = parse_ur!($ur!);
unset($_QA;' $_:AGRAG['JIAGP_:;G89Q'"); ..
remove cruft added y 88:
if ($su_dir) {
$parts[*path*" = sustr($parts[*path*"'
str!en($su_dir));
)
$_QA;[*7*" = trim($parts[*path*"' *.*);
$_:AGRAG[*GAJIA:;_IG8*" = $parts[*path*";
if ($parts[*7uery*") {
$_:AGRAG[*GAJIA:;_IG8*" += '?'+ $parts
[*7uery*";
$_:AGRAG[*JIAGP_:;G89Q*" = $parts
[*7uery*";
$_:AGRAG[*<GQR*" = array($parts
[*7uery*");
parse_str($parts['7uery'"' $arr);
$_QA; = array_merge($_QA;' $arr);
$_GAJIA:; = array_merge($_GAJIA:;' $arr);
)
)
?&
at this point, /ou should be able to reIuest clean url
Drupal Handbook: 20 April 2005 &2
pa"es and receive a proper pa"e in response! for
eample, reIuest the pa"e .node.1 and hopefull/
/ou 2ill see /our first node sho2n! /ou should not
use the I` s/ntaR use the clean url s/nta! if /ou
"et an 99* error, /ou have a problem! please fi redo
the above and then retest!
bro2se to inde!phpEI`adminJs/stem, enable clean
'C0*, and press *ubmit!
/ou ma/ "et a php error if /our php error reportin"
in /our php!ini file is set to hi"h! Tr/ this settin" in
/our php!ini file
errorNreportin" ` HNA00 ^ lHN;.T9(H
"nstalling Drupal on !indo*s
Zthis pa"e used to contain verbose 2indo2s installation
"uidelines! the/ "ot removed because the/ 2ere a5 Fust a
cop/ of the "eneral installation "uidelines, b5 misleadin"
4Gstart b/ etractin" the archive to the )H) 2orkin"
folderG5, and c5 2e donDt 2ant to maintain redundant
documentation! this pa"e should onl/ contain 2indo2s
specific "uidelines that differ si"nificantl/ from the
"eneral "uidelines! preferabl/, latter 2ould be put so
"enerall/ that 2e donDt need an/thin" here 4e"! donDt rel/
on G2"etG and GtarG etc!5[
"nstalling Drupal on !indo*s C-t
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Table of (ontents
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9! CeIuirements
99! 9nstallation
999! (onnectin" it All To"ether
9:! Drupal Adminstration
:! *ettin" )ermissions
:9! (ustomi=in" Themes
:99! *chedulin" Tasks
:999! .ptional (omponents
98! 'p"radin" an Histin" Drupal *ite
8! <ore 9nformation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal Handbook: 20 April 2005 &7
CeIuirements
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal reIuires a 2eb server, )H)$ 4http:JJ222!php!netJ5
and </*M0 or a database server supported b/ the )H)
)HAC A)9 4http:JJpear!php!netJ5!
;.TH: The Apache 2eb server and </*M0 database are
stron"l/ recommendedR other 2eb server and database
combinations such as 99* and )ost"re*M0 are possible but
tested to a lesser etend!
9 stron"l/ recommend a complete 2eb server packa"ed
installer if /ou are at all ne2 to Apache, </*M0 or )H)!
There are man/ out there! </ personal favorite 4because it
2orked out of the bo5 is 6o*erv
4http:JJsourcefor"e!netJproFectsJfoservJ5!
*erver (onfi"uration
Kour )H) setup must have the follo2in" settin"s enabled!
These can be set in the php!ini file:
session!saveNhandler user
9n addition, 2e recommend the follo2in" settin"s:
session!cacheNlimiter none
The php!ini file is usuall/ found in the ,in;T director/!
These settin"s can be set in !htaccess file 4in the drupal
director/5 overriddin" 2hatever is set in the php!ini file!
There is a ver/ helpful function in )H) that "ives /ou all
the information about ho2 )H) is setup on /our server!
Kou can find this information out easil/ 2ith )H)Ds phpinfo
45 function! This function also sho2s /ou 2here /our
php!ini file is located so /ou can make an/ chan"es there!
To find out about /our )H) settin"s simpl/ create a file
called phpinfo!php! Hnter one line of tet, G
<?php
echo phpinfo();
?&
G and save the file to /our server 42here php is installed5!
6or eample, cop/ it to /our G222!m/domain!comG or
GlocalhostG director/ and vie2 it in a bro2ser! -e sure to
have apache runnin" 2hen /ou test it!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9nstallation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal Handbook: 20 April 2005 &$
*tep 1!
Do2nloadin" Drupal
Kou can obtain the latest Drupal release from
http:JJdrupal!or"J! (lick the do2nloads link! Do2nload the
most current tar!"= format and etract the files! Kou ma/
need a tool to uncompress the files! 9 recommend pico=ip
4http:JJ222!pico=ip!comJ5 because it is eas/ and supports
a hu"e number of compression formats! At the time of this
2ritin" it has a 70 da/ trial period!
This 2ill create a ne2 director/ drupal+!!J containin" all
Drupal files and directories! This director/ can be several
director/s deeper than the un=ipped director/! The
director/ 2e are concerned about has the inde!php pa"e
and modules director/ in it! <ove the contents of that
director/ into a director/ 2ithin /our 2eb serverDs
document root or /our public HT<0 director/! .n m/ local
machine 9 created a director/ of the name of the domain
name it is part of! 6or eample, on m/ local machine 9
cop/ the files to, G(:m6o*ervm222mdrupalG! 9 2ould
recommend cop/in" it to a director/ but if /ou are read/
/ou can cop/ the files to root of the site 2hich 2ould be
somethin" like, GD:m6o*ervm222mG 4locall/5 or
Gftp:JJ222!m/domain!comJ222G or
Gftp:JJ222!m/domain!comJvarJ222JhtmlG!
;.TH: 2hen cop/in" files, ensure /ou also cop/ the
hidden !htaccess file! Kou can see hidden files in Hplorer
b/ "oin" to the menu item Tools _ 6older .ptions _ :ie2
_ Hidden 6iles and 6olders _ *ho2 Hidden 6iles!
*tep 2!
(reatin" the Drupal Database
These instructions are "eared to2ard a </*M0 database!
9f /ou are usin" another database and /ou kno2 a little bit
about databases /ou should be able to follo2 alon" Iuite
nicel/! -e sure to check the database documentation for
/our specific database if /ou have an/ Iuestions!
6or this part of the tutorial 9 am "oin" to use </*M0+6ront
to create and setup our Drupal database! At the time of
this 2ritin" it is free! Kou can "oto and do2nload </*M0+
6ront from http:JJ222!m/sIlfront!deJ! Tell the "u/ thank
/ou and donate! 9 received an error that prevented the
pro"ram to launch 2hen 9 tried to G0aunch )ro"ram ;o2G
Drupal Handbook: 20 April 2005 &5
from the installation pro"ram but on a second attempt the
*tart _ )ro"rams _ menu it launched successfull/!
Alternativel/ /ou can use </*M0!ee from the command
line to achieve the same thin"! 9 2ill list the command line
instructions after the </*M0+6ront instructions!
To follo2 alon"in the net steps /ou 2ill need to lo"in to
/our </*M0 database 2ith a user account that has the
(CHATH and #CA;T privile"es! Kou 2ill need to use the
appropriate user name for /our s/stem!
(reatin" the Database 2ith </*M0+6ront
9f /ou are "oin" to create a database from the command
line skip to the net section, other2ise continue on here!
6irst, /ou must create a ne2 database for /our Drupal site!
To do so:
+ .penin" </*M0 6ront
+ 6ind and open </*M0+6ront! An .pen *ession 2indo2
2ill appear!
+ (reatin" a ;e2 (onnection *ession
+ (lick the ;e2 button to create a ne2 connection session
for drupal! An Add *ession 2indo2 2ill appear!
+ 'nder the (ommon tab enter the name for /our
connection! 9n this tutorial 2e 2ill call it GDrupal
(onnectionG!
+ *2itch to the (onnection tab and enter the name of the
server that has m/sIl runnin" on it! This 2ould be
G222!m/server!comG or an 9) G12?!0!0!1G! Hnter
GlocalhostG if /ou are runnin" it locall/! The default port
for m/sIl is G770%G! Default Timeout is 70 seconds!
(onnection *aver is active b/ default! 9 dont kno2 2hat
(onnection *aver is!
+ *2itch to the lo"in tab and enter the username that /ou
setup 2hen /ou installed m/sIl! Kou have the option to
choose the database to startup in! Kou 2ill choose this at
another time because 2e have not created our database
/et! (lick the .k button to save /our ne2 m/sIl session
connection and to take /ou back to the .pen *ession
2indo2! 9f /ou dont kno2 /ourDre userid and pass2ord /ou
2ill need to contact /our hostin" compan/ or 2hoever set
it m/sIl on /our server and "et a userid or send them
these instructions! 9f /ou installed m/sIl /ourself the
username is GadminG or GrootG and the pass2ord is blank
Drupal Handbook: 20 April 2005 &%
4on a fresh m/sIl installation5!
+ 0o"in to </*M0
+ *elect the ne2 session /ou Fust made and click the .>
button! A 2indo2 2ill prompt /ou for /our pass2ord if a
pass2ord 2as not supplied 42hen /ou 2ere creatin" the
session connection5! 9f /our pass2ord is blank /ou do not
need to enter an/thin" here! .ther2ise enter /our
pass2ord no2! (lick .> to lo"in to /our m/sIl account!
9f /ou "et an/ errors the pro"ram 2ill let /ou kno2 about
it and sometimes offers accurate advice on 2hat to do to
fi it! Tr/ 2hat it sa/s and if it doesnDt 2ork use the
(ommand line method listed belo2 or contact the authors
of </*M0+6ront at http:JJ222!m/sIlfront!deJ!
Assumin" /ou lo"in successfull/ /ou 2ill be sho2n a list of
databases attached to the m/sIl server!
+ (reatin" a ;e2 Database
+ To create our ne2 drupal database, select Database _
;e2 _ Database from the menu bar! There is also a
toolbar icon that adds a ne2 database! 6or this tutorial 2e
2ill tr/ to sta/ 2ith menu commands!
+ A ;e2 Database dialo" appears!
+ Hnter the name of /our ne2 drupal database! 9f /ou are
runnin" it on /our local machine 9 2ould name it, GdrupalG
or the same name as /our domain, Gm/domainnameG! 9
recommend usin" all lo2ercase in the names /ou specif/
to avoid case sensitive errors later on! </*M0 2ill then
create the initial database files!
+ (reatin" a 'ser 2ith Access Ci"hts
+ ;et /ou must set the access database ri"hts! Ci"ht click
on 'sers in the Host tree and select Database _ ;e2 _
'ser from the menu bar! An Add 'ser 2indo2 2ill appear!
+ 9n the (ommon tab enter the name of the ne2 user! 9n
this tutorial 2e 2ill use, GdbaNuserG! 9n the pass2ord field
enter a pass2ord! 9f /ou are smart /ou 2ill 2rite these
do2n no2! 9f /ou are not then skip it!
+ *2itch to the Hosts tab and enter GlocalhostG or the name
of /our session connection! Kou 2ill "et an error in "erman
if /ou enter the 2ron" hostname! 9nterpreted it sa/s, G9 am
"erman! ;o speeka en"lace!G .k, 9 dont seem to be doin"
somethin" ri"ht here! 0etDs skip this method! (ancel out of
that! ,e are "oin" to run a script in </*M0+6rontDs *M0
Drupal Handbook: 20 April 2005 &?
Muer/!
+ (lick on the *M0 Hditor and cop/ this code into it:
#CA;T A00 )C9:90H#H* .; m/Database;ame!O T.
m/'ser9dUm/Domain;ame 9DH;T969HD -K
Dm/)ass2ordDR
+ *ubstitute Gm/Database;ameG 2ith the name of /our
database! *ubstitute, Gm/'ser9dG 2ith the name of the
drupal account that 2ill be responsible for administerin"
/our drupal database! *ubstitute Gm/Domain;ameG 2ith
the name of of /our domain! 9f /ou are runnin" drupal on a
local machine enter, GlocalhostG! 6inall/ substitute,
Gm/)ass2ordG 2ith the pass2ord for /our
Gm/'ser9dUm/Domain;ameG user 9D! 9f /ou are smart
/ou 2ill 2rite /our username and pass2ord do2n no2!
+ *elect Database _ Cun from the menu bar! 9f successful
/ou 2ill "et G. ro2s affectedG in the </*M0+6ront status
bar! This 2ill add a ne2 user 2ith permissions necessar/
to administer /our drupal database!
+ 0etDs verif/ that 2e created a ne2 user! (lick on 'sers in
the Host tree and select :ie2 _ Cefresh from the menu
bar! 9f ever/thin" 2ent hunk/ dor/ then 2e should see our
ne2 user listed! 9f not then check the error messa"es, "o
back and check for misspellin" and incorrect s/nta and
tr/ a"ain!
+ 9mportin" the Drupal Database *cheme
.nce /ou have created /our ne2 database, /ou must load
the reIuired drupal tables into it! To do this /ou must "o
to the G9mportin" the Drupal Database *chemeG section in
the (ommand 0ine section or obtain an additional file
called, Gdatabase!sIlG! This is a </*M0 import compatible
</*M0 database! </*M0+6ront cannot import GO!m/sIlG
files 2hich are the onl/ kind included 2ith drupal
distribution! At the time of this 2ritin" the Gdatabase!sIlG
is not included 2ith the drupal distribution! 9 made the file
because 9 imported the database from the command line
and once it 2as in </*M0+6ront 9 eported it to
Gdatabase!sIlG! 9t took 10 seconds to eport it to G!sIlG file!
And ten seconds to import it to m/ test database! -ut
2hatever, /ou can 2rite me or reIuest it from the HHAD
team at drupal!or"! 9t 2ould be better to have them
mana"e it!
Drupal Handbook: 20 April 2005 &&
+ Ci"ht click on /our ne2 drupal database in the Host tree
and select 9mport _ *M0 6ile! -ro2se to the GZdrupal
install dir[JdatabaseJdatabase!sIlG director/ and select the
file, Gdatabase!sIlG! This is the *M0 script that 2ill create
/our drupal tables! An 9mport .ptions 2indo2 2ill appear!
(lick .k and /our database 2ill be created!
9f /ou did not receive an/ errors then /ou have Fust
created /our drupal databaseL KeaL
(reatin" the Database from the (ommand 0ine
9f /ou have alread/ created a database usin" </*M0+6ront
skip to the net section! .ther2ise /ou arenDt "oin"
an/2here budd/! Kou "otta a lesson in GCunnin" </*M0
from the (ommand 0ineG!
+ (reatin" the Database
+ Kou must create a ne2 database for /our Drupal site for
it to 2ork! The tool to do this is the m/sIl!ee file that can
be run from the command line! To "et to the command line
"oto *tart _ Cun and enter GcmdG! (lick the .> button!
Kou 2ill be presented 2ith a scar/ black 2indo2 2ith a
sIuare flash/ thin"! This is called the command line! 4cue
"host sounds5! This is 2hat people used to 2ork in before
"raphical user interfaces available!
+ -ro2se to the director/ 2here Gm/sIl!eeG resides! The
t2o commands /ou use to bro2se are, 2ait for it, GdirG and
GcdG! GDirG lists the contents of the director/ and GcdG
chan"es the director/! .k 9 2as "oin" to eplain this but if
/ou are installin" a 2eb site then /ou dont need to kno2
this! 4!!!ok fine!5 (han"e directories to the m/sIl director/!
Hnter GcdmG to "et to the root of /our hard drive and then
enter Gcd 6o*ervmm/sIlmbinG! ,ell, on m/ machine the
director/ to the Gm/sIlmbinG folder is
GD:m6o*ervmm/sIlmbinG! 9f /ou did ever/thin" ri"ht
command prompt 2ill look like this,
Gd:m6o*ervmm/sIlmbin_G! 9f /ou see somethin" like that
then pat /ourself on the back! Kou are a bi" bo/ no2!
+ ;o2 enter the follo2in" 2here GdbaNuserG is the name of
the user id that has database administration ri"hts to
create /our drupal database and GdrupalG is the name of
the drupal database to create:
m/sIladmin +u dbaNuser +p create drupal
+ *M0 2ill prompt /ou for the dbaNuser database
Drupal Handbook: 20 April 2005 &3
pass2ord! Hnter the pass2ord and hit enter! ;ote: if /ou
Fust setup /our m/sIl to run on /our computer or server or
2hatever then /ou D. ;.T HA:H A )A**,.CD KHTLLLL
AAHHHHAH####L That is ok! (alm do2n! Kou can set it
later! 6or no2 Fust leave the pass2ord field blank and
press the entertainme ke/! 9f /ou receive no messa"es and
are back to the command prompt then /ou have Fust
created the /our drupal database! ,e still need to import
the database tables and setup a user before 2e can "o
further!
+ *ettin" Access Ci"hts
+ ;et /ou must lo"in into /our ne2 database and set the
userDs database access ri"hts! To do that 2e need to lo"
into the </*M0 command prompt! This is a command
prompt that m/sIl creates inside the bi""er command
prompt! ,hatE Kou closed the command line 2indo2E ;o,
no ;.L This 2ont 2ork at allL ThatDs it 9 Iuit! 4,hat drupal
slave masterE 9 am bound b/ the #)0 to finish 2ritin" this
on pain of deathE 9s it death b/ snoose snooseE ;oE
Hmmm! .k! 6ine! 9Dll keep "oin"!5 Hhem, ecuse me,
2here 2as 9E .h ri"ht, letDs "et that command prompt
back up!
+ <ake sure 2e are in the same director/ as before and
enter the follo2in" 2here GdbaNuserG is the name of the
user id that has database adminstration ri"hts:
m/sIl +u dbaNuser +p
+ A"ain, /ou 2ill be asked for the dbaNuser database
pass2ord! Hnter it 4or dont if /ou dont have one5 and press
enter! Kou 2ill no2 be at the m/sIl command line prompt
2hich looks like Gm/sIl_ G! prett/ isnDt itE
+ (reatin" a ne2 user 2ith permissions
+ ;o2 2e need to create a ne2 user that drupal can use to
have access ri"hts to the database!
+ At the </*M0 prompt, enter follo2in" command 2here
Dm/DrupalDatabaseD is the name of /our ne2 drupal
database, Gm/Drupal'ser9DUlocalhostG is the ne2 Drupal
'ser9d, GlocalhostG is the server 2here </*M0 is installed
and runnin" and Gm/Drupal'sers)ass2ordG is the ne2
pass2ord for Gm/Drupal'ser9DUlocalhostG reIuired to lo"
in as the </*M0 user! Kou must include the semicolon at
the end of the line for </*M0 to evaluate /our statement!
Drupal Handbook: 20 April 2005 30
Hnter the follo2in" and press Hnter:
#CA;T A00 )C9:90H#H* .; m/DrupalDatabase!O T.
m/Drupal'ser9DUlocalhost 9DH;T969HD -K
Dm/Drupal'sers)ass2ordDR
+ 9f this attempt is successful, </*M0 2ill repl/ 2ith
GMuer/ .>, 0 ro2s affected V 0!0& sec _G! ;ote: Kou must
remember to include the semicolon at the end of ever/
statement /ou enter at the m/sIl prompt, other2ise it Fust
sits there, 2aitin", 2aitin", 2aitin"!!!
+ Activatin" )ermissions
+ Kou must activate the ne2 permissions for </*M0 to
appl/ the last step to the current runnin" databases! To
activate the ne2 permissions /ou must enter the the
follo2in" from the m/sIl command prompt:
flush privile"esR
+ and press enter! This refreshes and applies the
permission to the ne2 user 2e Fust made!
+ Hit </*M0 (ommand )rompt
+ ,e must no2 eit the m/sIl command prompt to finish
creatin" our database! To eit m/sIl command prompt
t/pe DeitD and press enter! Kou 2ill be returned back to
the command prompt!
+ 9mportin" the Drupal Database *cheme
+ .nce /ou have created /our ne2 database, /ou must load
the reIuired drupal tables into it! To do so enter the
follo2in" from the command prompt:
m/sIl +u m/Drupal'ser9D +p m/DrupalDatabase V
databaseJdatabase!m/sIl
+ 2here Gm/DrupalDatabaseG is the name of /our ne2
drupal database, Gm/Drupal'ser9DG is the ne2 </*M0
userid /ou Fust created42ithout the GUlocahostG5 for use
2ith /our ne2 drupal database and
GdatabaseJdatabase!m/sIlG is the path to the m/sIl
database stored in the GZdrupal install dir[JdatabaseJG
director/! ;o2 2ould be a "ood time to cop/ the database
4usin" 2indo2s eplorer5 to the same director/ 2here
Gm/sIl!eeG resides 4that is the director/ /ou are in ri"ht
no25! .n m/ machine it is GD:m6o*ervmm/sIlmbinG! ,hen
enterin" the userid remember to leave off the
GUdomainnameG 2e specified in previous steps! 9tDs 2as
Drupal Handbook: 20 April 2005 31
onl/ necessar/ 2hen 2e created a user but not used after
that!
+ Kou 2ill be prompted to enter a pass2ord! Hnter the
pass2ord /ou created for /our Gm/Drupal'ser9DG account!
9f /ou receive absolutel/ no messa"es 2hatsoever then the
drupal database 2as successfull/ imported! That is called
livin" b/ faith! -elievin" it 2orked even 2hen /ou see no
si"n! 9f /ou do receive an error then 9 su""est checkin"
the specified the path to the database and spellin" errors!
+ (lose the (ommand )rompt 2indo2
+ T/pe GeitG and press enter to eit the command 2indo2!
9f /ouDve "ot this far then /ou can conclude that /our
drupal database 2as installed and setup successfull/!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(onnectin" it All To"ether
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
,e are almost done! -efore Drupal 2ill 2ork 2e need to
setup a fe2 more settin"s! Drupal server options are
specified in includesJconf!php file! -efore /ou can run
Drupal, /ou must set the database 'C0 and the base 'C0
to the 2eb site! The database 'C0 creates a connection
strin" to connect to /our database! Cemember ho2 9 said
/ou can have multiple drupal sites runnin"E Here is 2here
/ou can confi"ure that!
*ettin" the )ath to the Drupal Database
+ -ro2se to the GincludesG director/ in /our drupal server
install director/ and open the Gconf!phpG file in a tet
editor! .n m/ machine the Gconf!phpG file is located in
GD:m6o*ervm222mincludesmconf!phpG! .n m/ second
drupal install, m/ test site, the Gconf!phpG file is located in
GD:m6o*ervm222mm/testsitemincludesmconf!phpG! 9 have
t2o duplicate sites on m/ server! 9Dve copied the or"inal
files to both the root GD:m6o*ervm222G and the test
director/, GD:m6o*ervm222mtestG! .pen the Gconf!phpG
confi"uration file 4in 2hatever drupal install /ou are in5
and edit the WdbNurl line to match the values 2e defined in
the previous steps:
WdbNurl `
Gm/sIl:JJm/Drupal'ser9D:m/)ass2ordUlocalhostJm/Drup
alDatabaseGR
Drupal Handbook: 20 April 2005 32
+ This step is essential! This is the lo"in script to "et into
/our specific </*M0 drupal database!
*ettin" the )ath to the Drupal Director/ on /our *erver
+ This step is also essential! 9f /ou dont "et this /ou 2ill
onl/ see the home pa"e! -ut nothin" else! The base 'C0 is
the location, the director/ 2here /our inde!php file eists
on /our server! *o if /ou put /our drupal files into a
director/ sa/, Ghttp:JJ222!m/site!comJdrupalG then /ou
2ould put the same thin" here!
+ *et WbaseNurl to match the address and director/ of
drupal on /our 2eb site:
WbaseNurl ` Ghttp:JJ222!m/site!comGR
Here are some more eamples! 'se onl/ one that matches
/our specific confi"uration:
WbaseNurl `
Ghttp:JJ222!m/site!comJdirector/,hereDrupal9sGR
WbaseNurl ` Ghttp:JJlocalhostGR
WbaseNurl ` Ghttp:JJlocalhostJanotherDrupal*iteGR
+ ;.TH: for more information about multiple virtual hosts
or the
confi"uration settin"s, consult the Drupal handbook at
drupal!or"!
*ettin" up more than one dupal site on one machine usin"
:irtual Hosts
-esides the method 9Dve mentioned above Drupal also
allo2s for multiple virtual host installations! To confi"ure a
virtual server host, make a cop/ of the conf!php file 2e
2orked 2ith earlier and rename it to
G222!/ourdomainname!com!phpG! place this in /our
includes director/! ;.TH: This part of the instructions
4settin" up virtual hosts5 is not not tested! 9f someone
validates this and 2ould include an/ steps 9 have for"ot
then i 2ill add it here for the benefit of others!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal Adminstration
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Kou can no2 launch /our bro2ser and test /our siteL
-ro2se to the root director/ 2here Drupal is installed!
<ake sure Apache and </*M0 services are runnin"! 9f
ever/thin" is setup correctl/ /ou 2ill be at the home pa"e
Drupal Handbook: 20 April 2005 37
of /our ne2 Drupal site! 'pon a ne2 installation, /our
Drupal 2ebsite defaults to a ver/ basic confi"uration 2ith
onl/ a fe2 active modules, one theme, and no user access
ri"hts!
'se /our administration panel to enable and confi"ure
services! 6or eample, set some "eneral settin"s for /our
site 2ith GAdministration + confi"urationG! Hnable modules
via GAdministration + confi"uration + modulesG! 'ser
permissions can be set 2ith GAdministration + accounts +
permissionsG!
6or more information on confi"uration options, read
throu"h the instructions 2hich accompan/ the different
confi"uration settin"s and
consult the various help pa"es available in the
administration panel!
;ote that additional communit/+contributed modules and
themes are available at http:JJdrupal!or"J!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*ettin" )ermissions
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.ut of the bo /ou 2ill not have permission to do or vie2
an/thin" but the home pa"e! ;either 2ill an/one 2ho
visits the site! Kou have to "ive them 4an anon/mous
visitor5 privile"es to vie2 /our site!
The first thin" /ou need to do is create a master user
account! 6ollo2 the on screen instructions to create an
account and lo"in! The first account 2ill automaticall/
become the main administrator account for the site! Kou
can add additional adminstrator accounts at an/ time! 9
recommend creatin" another account 2ith administrative
permissions for securit/ reasons and usin" that from no2
on! ,rite /our user name and pass2ord to both do2n in a
secure location!
(reatin" the Administrator Cole
-/ default Drupal onl/ has t2o roles, anon/mous visitor
and authenticated user! Hcept in certain cases /ou 2ill
2ant to create additional roles for the different users that
use /our site! 6or no2 "o to Administer _ Accounts _
Coles and add GAdminstratorG! Hnter GadminstratorG and
press the Add button!
#ivin" )ermissions to a Cole
Drupal Handbook: 20 April 2005 3$
-/ default all the roles have ver/ limited capabilities! ;e2
roles have no permissions set! 9f 2e are "oin" to create a
ne2 adminstrator user account for ourselves 2e 2ill need
to chan"e this! ,e can chan"e this in the )ermissions
pa"e! #oto Administer _ Accounts _ )ermissions! Here is
a table filled 2ith options for all /our different roles! *et
/our administrator account to have all permissions for no2
and click save permissions! Kou can "o back and chan"e
this after /ou "et familiar 2ith Drupal 4think a fe2 months
from no25! )lease note! This is the pa"e to "ive users the
permission to see the content on /our site! To enable
anon/mous users to see /our site content find a ro2
called, Gaccess contentG check the checkbo!
(reatin" a ;e2 'ser
6inall/, 2e are one step a2a/ from creatin" our secondar/
adminstor account! #oto Administer _ Accounts _ ;e2
'ser! .n this pa"e enter the ne2 account information and
click (reate Account! Kou can no2 lo" out of the
adminstrator account 42rite do2n the pass2ord5 and lo"in
2ith /our secondar/ adminstrator account!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(ustomi=in" Themes
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;o2 that /our server is runnin", /ou 2ill 2ant to
customi=e the look of /our site! *everal sample themes are
included in the Drupal
installation and more can be do2nloaded from drupal!or"!
(ustomi=in" each theme depends on the theme! 9n
"eneral, each theme contains a )H) file themename!theme
2hich defines a function header45 that can be chan"ed to
reference /our o2n lo"os!
<ost themes also contain st/lesheets or )H) confi"uration
files to tune the colors and la/outsR check the themesJ
director/ for CHAD<H files describin" each alternate
theme!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*chedulin" Tasks
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<an/ Drupal modules have periodic tasks that must be
tri""ered at specific intervie2s! This is called a cron Fob
and the/ are setup in the cron!php pa"e! To activate these
Drupal Handbook: 20 April 2005 35
tasks, /ou must call the cron pa"eR this 2ill pass control to
the modules and the modules 2ill decide if and 2hat the/
must do!
The follo2in" eample crontab line 2ill activate the cron
script on the hour:
0 O O O O 2"et +. + +I http:JJH.*T;A<HJcron!php
<ore information about the cron scripts are available in
the admin help pa"es and in the Drupal handbook at
drupal!or"! Hample scripts can be found in the scriptsJ
director/! 9 dont kno2 the ,indo2s eIuivalent of this
section! )lease email me if /ou kno2!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.ptional (omponents
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ To use 8<0+based services such as the -lo""er A)9,
1abber, C** s/ndication, /ou 2ill need )H)Ds 8<0
etension! This etension is enabled b/ default in standard
)H)$ installations!
+ 9f /ou 2ant support for clean 'C0s, /ouDll need
modNre2rite and the abilit/ to use local !htaccess files!
4<ore information can be found in the Drupal handbook on
drupal!or"!5
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'p"radin" an Histin" Drupal *ite
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1! -ackup /our database and Drupal director/ + especiall/
/our confi"uration file 4222!eample!com!conf or
includesJconf!php5!
2! 0o" on as the user 2ith user 9D 1!
7! .ver2rite all the old Drupal files 2ith the ne2 Drupal
files!
$! <odif/ the ne2 confi"uration file to make sure it has
the correct information!
5! Cun update!php b/ visitin"
http:JJ222!eample!comJupdate!php!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<ore 9nformation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal Handbook: 20 April 2005 3%
6or platform specific confi"uration issues and other
installation and administration assistance, please consult
the Drupal handbook at
http:JJdrupal!or"J! Kou can also find support at the Drupal
support forum or throu"h the Drupal mailin" lists!
"nstalling Drupal on !indo*s C-t
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Table of (ontents
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9! CeIuirements
99! 9nstallation
999! (onnectin" it All To"ether
9:! Drupal Adminstration
:! *ettin" )ermissions
:9! (ustomi=in" Themes
:99! *chedulin" Tasks
:999! .ptional (omponents
98! 'p"radin" an Histin" Drupal *ite
8! <ore 9nformation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CeIuirements
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal reIuires a 2eb server, )H)$ 4http:JJ222!php!netJ5
and </*M0 or a database server supported b/ the )H)
)HAC A)9 4http:JJpear!php!netJ5!
;.TH: The Apache 2eb server and </*M0 database are
stron"l/ recommendedR other 2eb server and database
combinations such as 99* and )ost"re*M0 are possible but
tested to a lesser etend!
9 stron"l/ recommend a complete 2eb server packa"ed
installer if /ou are at all ne2 to Apache, </*M0 or )H)!
There are man/ out there! </ personal favorite 4because it
2orked out of the bo5 is 6o*erv
4http:JJsourcefor"e!netJproFectsJfoservJ5!
*erver (onfi"uration
Kour )H) setup must have the follo2in" settin"s enabled!
These can be set in the php!ini file:
session!saveNhandler user
Drupal Handbook: 20 April 2005 3?
9n addition, 2e recommend the follo2in" settin"s:
session!cacheNlimiter none
The php!ini file is usuall/ found in the ,in;T director/!
These settin"s can be set in !htaccess file 4in the drupal
director/5 overriddin" 2hatever is set in the php!ini file!
There is a ver/ helpful function in )H) that "ives /ou all
the information about ho2 )H) is setup on /our server!
Kou can find this information out easil/ 2ith )H)Ds phpinfo
45 function! This function also sho2s /ou 2here /our
php!ini file is located so /ou can make an/ chan"es there!
To find out about /our )H) settin"s simpl/ create a file
called phpinfo!php! Hnter one line of tet, G
<?php
echo phpinfo();
?&
G and save the file to /our server 42here php is installed5!
6or eample, cop/ it to /our G222!m/domain!comG or
GlocalhostG director/ and vie2 it in a bro2ser! -e sure to
have apache runnin" 2hen /ou test it!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9nstallation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*tep 1!
Do2nloadin" Drupal
Kou can obtain the latest Drupal release from
http:JJdrupal!or"J! (lick the do2nloads link! Do2nload the
most current tar!"= format and etract the files! Kou ma/
need a tool to uncompress the files! 9 recommend pico=ip
4http:JJ222!pico=ip!comJ5 because it is eas/ and supports
a hu"e number of compression formats! At the time of this
2ritin" it has a 70 da/ trial period!
This 2ill create a ne2 director/ drupal+!!J containin" all
Drupal files and directories! This director/ can be several
director/s deeper than the un=ipped director/! The
director/ 2e are concerned about has the inde!php pa"e
and modules director/ in it! <ove the contents of that
director/ into a director/ 2ithin /our 2eb serverDs
document root or /our public HT<0 director/! .n m/ local
machine 9 created a director/ of the name of the domain
name it is part of! 6or eample, on m/ local machine 9
cop/ the files to, G(:m6o*ervm222mdrupalG! 9 2ould
Drupal Handbook: 20 April 2005 3&
recommend cop/in" it to a director/ but if /ou are read/
/ou can cop/ the files to root of the site 2hich 2ould be
somethin" like, GD:m6o*ervm222mG 4locall/5 or
Gftp:JJ222!m/domain!comJ222G or
Gftp:JJ222!m/domain!comJvarJ222JhtmlG!
;.TH: 2hen cop/in" files, ensure /ou also cop/ the
hidden !htaccess file! Kou can see hidden files in Hplorer
b/ "oin" to the menu item Tools _ 6older .ptions _ :ie2
_ Hidden 6iles and 6olders _ *ho2 Hidden 6iles!
*tep 2!
(reatin" the Drupal Database
These instructions are "eared to2ard a </*M0 database!
9f /ou are usin" another database and /ou kno2 a little bit
about databases /ou should be able to follo2 alon" Iuite
nicel/! -e sure to check the database documentation for
/our specific database if /ou have an/ Iuestions!
6or this part of the tutorial 9 am "oin" to use </*M0+6ront
to create and setup our Drupal database! At the time of
this 2ritin" it is free! Kou can "oto and do2nload </*M0+
6ront from http:JJ222!m/sIlfront!deJ! Tell the "u/ thank
/ou and donate! 9 received an error that prevented the
pro"ram to launch 2hen 9 tried to G0aunch )ro"ram ;o2G
from the installation pro"ram but on a second attempt the
*tart _ )ro"rams _ menu it launched successfull/!
Alternativel/ /ou can use </*M0!ee from the command
line to achieve the same thin"! 9 2ill list the command line
instructions after the </*M0+6ront instructions!
To follo2 alon"in the net steps /ou 2ill need to lo"in to
/our </*M0 database 2ith a user account that has the
(CHATH and #CA;T privile"es! Kou 2ill need to use the
appropriate user name for /our s/stem!
(reatin" the Database 2ith </*M0+6ront
9f /ou are "oin" to create a database from the command
line skip to the net section, other2ise continue on here!
6irst, /ou must create a ne2 database for /our Drupal site!
To do so:
+ .penin" </*M0 6ront
+ 6ind and open </*M0+6ront! An .pen *ession 2indo2
2ill appear!
Drupal Handbook: 20 April 2005 33
+ (reatin" a ;e2 (onnection *ession
+ (lick the ;e2 button to create a ne2 connection session
for drupal! An Add *ession 2indo2 2ill appear!
+ 'nder the (ommon tab enter the name for /our
connection! 9n this tutorial 2e 2ill call it GDrupal
(onnectionG!
+ *2itch to the (onnection tab and enter the name of the
server that has m/sIl runnin" on it! This 2ould be
G222!m/server!comG or an 9) G12?!0!0!1G! Hnter
GlocalhostG if /ou are runnin" it locall/! The default port
for m/sIl is G770%G! Default Timeout is 70 seconds!
(onnection *aver is active b/ default! 9 dont kno2 2hat
(onnection *aver is!
+ *2itch to the lo"in tab and enter the username that /ou
setup 2hen /ou installed m/sIl! Kou have the option to
choose the database to startup in! Kou 2ill choose this at
another time because 2e have not created our database
/et! (lick the .k button to save /our ne2 m/sIl session
connection and to take /ou back to the .pen *ession
2indo2! 9f /ou dont kno2 /ourDre userid and pass2ord /ou
2ill need to contact /our hostin" compan/ or 2hoever set
it m/sIl on /our server and "et a userid or send them
these instructions! 9f /ou installed m/sIl /ourself the
username is GadminG or GrootG and the pass2ord is blank
4on a fresh m/sIl installation5!
+ 0o"in to </*M0
+ *elect the ne2 session /ou Fust made and click the .>
button! A 2indo2 2ill prompt /ou for /our pass2ord if a
pass2ord 2as not supplied 42hen /ou 2ere creatin" the
session connection5! 9f /our pass2ord is blank /ou do not
need to enter an/thin" here! .ther2ise enter /our
pass2ord no2! (lick .> to lo"in to /our m/sIl account!
9f /ou "et an/ errors the pro"ram 2ill let /ou kno2 about
it and sometimes offers accurate advice on 2hat to do to
fi it! Tr/ 2hat it sa/s and if it doesnDt 2ork use the
(ommand line method listed belo2 or contact the authors
of </*M0+6ront at http:JJ222!m/sIlfront!deJ!
Assumin" /ou lo"in successfull/ /ou 2ill be sho2n a list of
databases attached to the m/sIl server!
+ (reatin" a ;e2 Database
+ To create our ne2 drupal database, select Database _
;e2 _ Database from the menu bar! There is also a
Drupal Handbook: 20 April 2005 100
toolbar icon that adds a ne2 database! 6or this tutorial 2e
2ill tr/ to sta/ 2ith menu commands!
+ A ;e2 Database dialo" appears!
+ Hnter the name of /our ne2 drupal database! 9f /ou are
runnin" it on /our local machine 9 2ould name it, GdrupalG
or the same name as /our domain, Gm/domainnameG! 9
recommend usin" all lo2ercase in the names /ou specif/
to avoid case sensitive errors later on! </*M0 2ill then
create the initial database files!
+ (reatin" a 'ser 2ith Access Ci"hts
+ ;et /ou must set the access database ri"hts! Ci"ht click
on 'sers in the Host tree and select Database _ ;e2 _
'ser from the menu bar! An Add 'ser 2indo2 2ill appear!
+ 9n the (ommon tab enter the name of the ne2 user! 9n
this tutorial 2e 2ill use, GdbaNuserG! 9n the pass2ord field
enter a pass2ord! 9f /ou are smart /ou 2ill 2rite these
do2n no2! 9f /ou are not then skip it!
+ *2itch to the Hosts tab and enter GlocalhostG or the name
of /our session connection! Kou 2ill "et an error in "erman
if /ou enter the 2ron" hostname! 9nterpreted it sa/s, G9 am
"erman! ;o speeka en"lace!G .k, 9 dont seem to be doin"
somethin" ri"ht here! 0etDs skip this method! (ancel out of
that! ,e are "oin" to run a script in </*M0+6rontDs *M0
Muer/!
+ (lick on the *M0 Hditor and cop/ this code into it:
#CA;T A00 )C9:90H#H* .; m/Database;ame!O T.
m/'ser9dUm/Domain;ame 9DH;T969HD -K
Dm/)ass2ordDR
+ *ubstitute Gm/Database;ameG 2ith the name of /our
database! *ubstitute, Gm/'ser9dG 2ith the name of the
drupal account that 2ill be responsible for administerin"
/our drupal database! *ubstitute Gm/Domain;ameG 2ith
the name of of /our domain! 9f /ou are runnin" drupal on a
local machine enter, GlocalhostG! 6inall/ substitute,
Gm/)ass2ordG 2ith the pass2ord for /our
Gm/'ser9dUm/Domain;ameG user 9D! 9f /ou are smart
/ou 2ill 2rite /our username and pass2ord do2n no2!
+ *elect Database _ Cun from the menu bar! 9f successful
/ou 2ill "et G. ro2s affectedG in the </*M0+6ront status
bar! This 2ill add a ne2 user 2ith permissions necessar/
to administer /our drupal database!
Drupal Handbook: 20 April 2005 101
+ 0etDs verif/ that 2e created a ne2 user! (lick on 'sers in
the Host tree and select :ie2 _ Cefresh from the menu
bar! 9f ever/thin" 2ent hunk/ dor/ then 2e should see our
ne2 user listed! 9f not then check the error messa"es, "o
back and check for misspellin" and incorrect s/nta and
tr/ a"ain!
+ 9mportin" the Drupal Database *cheme
.nce /ou have created /our ne2 database, /ou must load
the reIuired drupal tables into it! To do this /ou must "o
to the G9mportin" the Drupal Database *chemeG section in
the (ommand 0ine section or obtain an additional file
called, Gdatabase!sIlG! This is a </*M0 import compatible
</*M0 database! </*M0+6ront cannot import GO!m/sIlG
files 2hich are the onl/ kind included 2ith drupal
distribution! At the time of this 2ritin" the Gdatabase!sIlG
is not included 2ith the drupal distribution! 9 made the file
because 9 imported the database from the command line
and once it 2as in </*M0+6ront 9 eported it to
Gdatabase!sIlG! 9t took 10 seconds to eport it to G!sIlG file!
And ten seconds to import it to m/ test database! -ut
2hatever, /ou can 2rite me or reIuest it from the HHAD
team at drupal!or"! 9t 2ould be better to have them
mana"e it!
+ Ci"ht click on /our ne2 drupal database in the Host tree
and select 9mport _ *M0 6ile! -ro2se to the GZdrupal
install dir[JdatabaseJdatabase!sIlG director/ and select the
file, Gdatabase!sIlG! This is the *M0 script that 2ill create
/our drupal tables! An 9mport .ptions 2indo2 2ill appear!
(lick .k and /our database 2ill be created!
9f /ou did not receive an/ errors then /ou have Fust
created /our drupal databaseL KeaL
(reatin" the Database from the (ommand 0ine
9f /ou have alread/ created a database usin" </*M0+6ront
skip to the net section! .ther2ise /ou arenDt "oin"
an/2here budd/! Kou "otta a lesson in GCunnin" </*M0
from the (ommand 0ineG!
+ (reatin" the Database
+ Kou must create a ne2 database for /our Drupal site for
it to 2ork! The tool to do this is the m/sIl!ee file that can
be run from the command line! To "et to the command line
"oto *tart _ Cun and enter GcmdG! (lick the .> button!
Drupal Handbook: 20 April 2005 102
Kou 2ill be presented 2ith a scar/ black 2indo2 2ith a
sIuare flash/ thin"! This is called the command line! 4cue
"host sounds5! This is 2hat people used to 2ork in before
"raphical user interfaces available!
+ -ro2se to the director/ 2here Gm/sIl!eeG resides! The
t2o commands /ou use to bro2se are, 2ait for it, GdirG and
GcdG! GDirG lists the contents of the director/ and GcdG
chan"es the director/! .k 9 2as "oin" to eplain this but if
/ou are installin" a 2eb site then /ou dont need to kno2
this! 4!!!ok fine!5 (han"e directories to the m/sIl director/!
Hnter GcdmG to "et to the root of /our hard drive and then
enter Gcd 6o*ervmm/sIlmbinG! ,ell, on m/ machine the
director/ to the Gm/sIlmbinG folder is
GD:m6o*ervmm/sIlmbinG! 9f /ou did ever/thin" ri"ht
command prompt 2ill look like this,
Gd:m6o*ervmm/sIlmbin_G! 9f /ou see somethin" like that
then pat /ourself on the back! Kou are a bi" bo/ no2!
+ ;o2 enter the follo2in" 2here GdbaNuserG is the name of
the user id that has database administration ri"hts to
create /our drupal database and GdrupalG is the name of
the drupal database to create:
m/sIladmin +u dbaNuser +p create drupal
+ *M0 2ill prompt /ou for the dbaNuser database
pass2ord! Hnter the pass2ord and hit enter! ;ote: if /ou
Fust setup /our m/sIl to run on /our computer or server or
2hatever then /ou D. ;.T HA:H A )A**,.CD KHTLLLL
AAHHHHAH####L That is ok! (alm do2n! Kou can set it
later! 6or no2 Fust leave the pass2ord field blank and
press the entertainme ke/! 9f /ou receive no messa"es and
are back to the command prompt then /ou have Fust
created the /our drupal database! ,e still need to import
the database tables and setup a user before 2e can "o
further!
+ *ettin" Access Ci"hts
+ ;et /ou must lo"in into /our ne2 database and set the
userDs database access ri"hts! To do that 2e need to lo"
into the </*M0 command prompt! This is a command
prompt that m/sIl creates inside the bi""er command
prompt! ,hatE Kou closed the command line 2indo2E ;o,
no ;.L This 2ont 2ork at allL ThatDs it 9 Iuit! 4,hat drupal
slave masterE 9 am bound b/ the #)0 to finish 2ritin" this
on pain of deathE 9s it death b/ snoose snooseE ;oE
Drupal Handbook: 20 April 2005 107
Hmmm! .k! 6ine! 9Dll keep "oin"!5 Hhem, ecuse me,
2here 2as 9E .h ri"ht, letDs "et that command prompt
back up!
+ <ake sure 2e are in the same director/ as before and
enter the follo2in" 2here GdbaNuserG is the name of the
user id that has database adminstration ri"hts:
m/sIl +u dbaNuser +p
+ A"ain, /ou 2ill be asked for the dbaNuser database
pass2ord! Hnter it 4or dont if /ou dont have one5 and press
enter! Kou 2ill no2 be at the m/sIl command line prompt
2hich looks like Gm/sIl_ G! prett/ isnDt itE
+ (reatin" a ne2 user 2ith permissions
+ ;o2 2e need to create a ne2 user that drupal can use to
have access ri"hts to the database!
+ At the </*M0 prompt, enter follo2in" command 2here
Dm/DrupalDatabaseD is the name of /our ne2 drupal
database, Gm/Drupal'ser9DUlocalhostG is the ne2 Drupal
'ser9d, GlocalhostG is the server 2here </*M0 is installed
and runnin" and Gm/Drupal'sers)ass2ordG is the ne2
pass2ord for Gm/Drupal'ser9DUlocalhostG reIuired to lo"
in as the </*M0 user! Kou must include the semicolon at
the end of the line for </*M0 to evaluate /our statement!
Hnter the follo2in" and press Hnter:
#CA;T A00 )C9:90H#H* .; m/DrupalDatabase!O T.
m/Drupal'ser9DUlocalhost 9DH;T969HD -K
Dm/Drupal'sers)ass2ordDR
+ 9f this attempt is successful, </*M0 2ill repl/ 2ith
GMuer/ .>, 0 ro2s affected V 0!0& sec _G! ;ote: Kou must
remember to include the semicolon at the end of ever/
statement /ou enter at the m/sIl prompt, other2ise it Fust
sits there, 2aitin", 2aitin", 2aitin"!!!
+ Activatin" )ermissions
+ Kou must activate the ne2 permissions for </*M0 to
appl/ the last step to the current runnin" databases! To
activate the ne2 permissions /ou must enter the the
follo2in" from the m/sIl command prompt:
flush privile"esR
+ and press enter! This refreshes and applies the
permission to the ne2 user 2e Fust made!
Drupal Handbook: 20 April 2005 10$
+ Hit </*M0 (ommand )rompt
+ ,e must no2 eit the m/sIl command prompt to finish
creatin" our database! To eit m/sIl command prompt
t/pe DeitD and press enter! Kou 2ill be returned back to
the command prompt!
+ 9mportin" the Drupal Database *cheme
+ .nce /ou have created /our ne2 database, /ou must load
the reIuired drupal tables into it! To do so enter the
follo2in" from the command prompt:
m/sIl +u m/Drupal'ser9D +p m/DrupalDatabase V
databaseJdatabase!m/sIl
+ 2here Gm/DrupalDatabaseG is the name of /our ne2
drupal database, Gm/Drupal'ser9DG is the ne2 </*M0
userid /ou Fust created42ithout the GUlocahostG5 for use
2ith /our ne2 drupal database and
GdatabaseJdatabase!m/sIlG is the path to the m/sIl
database stored in the GZdrupal install dir[JdatabaseJG
director/! ;o2 2ould be a "ood time to cop/ the database
4usin" 2indo2s eplorer5 to the same director/ 2here
Gm/sIl!eeG resides 4that is the director/ /ou are in ri"ht
no25! .n m/ machine it is GD:m6o*ervmm/sIlmbinG! ,hen
enterin" the userid remember to leave off the
GUdomainnameG 2e specified in previous steps! 9tDs 2as
onl/ necessar/ 2hen 2e created a user but not used after
that!
+ Kou 2ill be prompted to enter a pass2ord! Hnter the
pass2ord /ou created for /our Gm/Drupal'ser9DG account!
9f /ou receive absolutel/ no messa"es 2hatsoever then the
drupal database 2as successfull/ imported! That is called
livin" b/ faith! -elievin" it 2orked even 2hen /ou see no
si"n! 9f /ou do receive an error then 9 su""est checkin"
the specified the path to the database and spellin" errors!
+ (lose the (ommand )rompt 2indo2
+ T/pe GeitG and press enter to eit the command 2indo2!
9f /ouDve "ot this far then /ou can conclude that /our
drupal database 2as installed and setup successfull/!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(onnectin" it All To"ether
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
,e are almost done! -efore Drupal 2ill 2ork 2e need to
Drupal Handbook: 20 April 2005 105
setup a fe2 more settin"s! Drupal server options are
specified in includesJconf!php file! -efore /ou can run
Drupal, /ou must set the database 'C0 and the base 'C0
to the 2eb site! The database 'C0 creates a connection
strin" to connect to /our database! Cemember ho2 9 said
/ou can have multiple drupal sites runnin"E Here is 2here
/ou can confi"ure that!
*ettin" the )ath to the Drupal Database
+ -ro2se to the GincludesG director/ in /our drupal server
install director/ and open the Gconf!phpG file in a tet
editor! .n m/ machine the Gconf!phpG file is located in
GD:m6o*ervm222mincludesmconf!phpG! .n m/ second
drupal install, m/ test site, the Gconf!phpG file is located in
GD:m6o*ervm222mm/testsitemincludesmconf!phpG! 9 have
t2o duplicate sites on m/ server! 9Dve copied the or"inal
files to both the root GD:m6o*ervm222G and the test
director/, GD:m6o*ervm222mtestG! .pen the Gconf!phpG
confi"uration file 4in 2hatever drupal install /ou are in5
and edit the WdbNurl line to match the values 2e defined in
the previous steps:
WdbNurl `
Gm/sIl:JJm/Drupal'ser9D:m/)ass2ordUlocalhostJm/Drup
alDatabaseGR
+ This step is essential! This is the lo"in script to "et into
/our specific </*M0 drupal database!
*ettin" the )ath to the Drupal Director/ on /our *erver
+ This step is also essential! 9f /ou dont "et this /ou 2ill
onl/ see the home pa"e! -ut nothin" else! The base 'C0 is
the location, the director/ 2here /our inde!php file eists
on /our server! *o if /ou put /our drupal files into a
director/ sa/, Ghttp:JJ222!m/site!comJdrupalG then /ou
2ould put the same thin" here!
+ *et WbaseNurl to match the address and director/ of
drupal on /our 2eb site:
WbaseNurl ` Ghttp:JJ222!m/site!comGR
Here are some more eamples! 'se onl/ one that matches
/our specific confi"uration:
WbaseNurl `
Ghttp:JJ222!m/site!comJdirector/,hereDrupal9sGR
WbaseNurl ` Ghttp:JJlocalhostGR
Drupal Handbook: 20 April 2005 10%
WbaseNurl ` Ghttp:JJlocalhostJanotherDrupal*iteGR
+ ;.TH: for more information about multiple virtual hosts
or the
confi"uration settin"s, consult the Drupal handbook at
drupal!or"!
*ettin" up more than one dupal site on one machine usin"
:irtual Hosts
-esides the method 9Dve mentioned above Drupal also
allo2s for multiple virtual host installations! To confi"ure a
virtual server host, make a cop/ of the conf!php file 2e
2orked 2ith earlier and rename it to
G222!/ourdomainname!com!phpG! place this in /our
includes director/! ;.TH: This part of the instructions
4settin" up virtual hosts5 is not not tested! 9f someone
validates this and 2ould include an/ steps 9 have for"ot
then i 2ill add it here for the benefit of others!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drupal Adminstration
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Kou can no2 launch /our bro2ser and test /our siteL
-ro2se to the root director/ 2here Drupal is installed!
<ake sure Apache and </*M0 services are runnin"! 9f
ever/thin" is setup correctl/ /ou 2ill be at the home pa"e
of /our ne2 Drupal site! 'pon a ne2 installation, /our
Drupal 2ebsite defaults to a ver/ basic confi"uration 2ith
onl/ a fe2 active modules, one theme, and no user access
ri"hts!
'se /our administration panel to enable and confi"ure
services! 6or eample, set some "eneral settin"s for /our
site 2ith GAdministration + confi"urationG! Hnable modules
via GAdministration + confi"uration + modulesG! 'ser
permissions can be set 2ith GAdministration + accounts +
permissionsG!
6or more information on confi"uration options, read
throu"h the instructions 2hich accompan/ the different
confi"uration settin"s and
consult the various help pa"es available in the
administration panel!
;ote that additional communit/+contributed modules and
themes are available at http:JJdrupal!or"J!
Drupal Handbook: 20 April 2005 10?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*ettin" )ermissions
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.ut of the bo /ou 2ill not have permission to do or vie2
an/thin" but the home pa"e! ;either 2ill an/one 2ho
visits the site! Kou have to "ive them 4an anon/mous
visitor5 privile"es to vie2 /our site!
The first thin" /ou need to do is create a master user
account! 6ollo2 the on screen instructions to create an
account and lo"in! The first account 2ill automaticall/
become the main administrator account for the site! Kou
can add additional adminstrator accounts at an/ time! 9
recommend creatin" another account 2ith administrative
permissions for securit/ reasons and usin" that from no2
on! ,rite /our user name and pass2ord to both do2n in a
secure location!
(reatin" the Administrator Cole
-/ default Drupal onl/ has t2o roles, anon/mous visitor
and authenticated user! Hcept in certain cases /ou 2ill
2ant to create additional roles for the different users that
use /our site! 6or no2 "o to Administer _ Accounts _
Coles and add GAdminstratorG! Hnter GadminstratorG and
press the Add button!
#ivin" )ermissions to a Cole
-/ default all the roles have ver/ limited capabilities! ;e2
roles have no permissions set! 9f 2e are "oin" to create a
ne2 adminstrator user account for ourselves 2e 2ill need
to chan"e this! ,e can chan"e this in the )ermissions
pa"e! #oto Administer _ Accounts _ )ermissions! Here is
a table filled 2ith options for all /our different roles! *et
/our administrator account to have all permissions for no2
and click save permissions! Kou can "o back and chan"e
this after /ou "et familiar 2ith Drupal 4think a fe2 months
from no25! )lease note! This is the pa"e to "ive users the
permission to see the content on /our site! To enable
anon/mous users to see /our site content find a ro2
called, Gaccess contentG check the checkbo!
(reatin" a ;e2 'ser
6inall/, 2e are one step a2a/ from creatin" our secondar/
adminstor account! #oto Administer _ Accounts _ ;e2
'ser! .n this pa"e enter the ne2 account information and
click (reate Account! Kou can no2 lo" out of the
Drupal Handbook: 20 April 2005 10&
adminstrator account 42rite do2n the pass2ord5 and lo"in
2ith /our secondar/ adminstrator account!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(ustomi=in" Themes
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;o2 that /our server is runnin", /ou 2ill 2ant to
customi=e the look of /our site! *everal sample themes are
included in the Drupal
installation and more can be do2nloaded from drupal!or"!
(ustomi=in" each theme depends on the theme! 9n
"eneral, each theme contains a )H) file themename!theme
2hich defines a function header45 that can be chan"ed to
reference /our o2n lo"os!
<ost themes also contain st/lesheets or )H) confi"uration
files to tune the colors and la/outsR check the themesJ
director/ for CHAD<H files describin" each alternate
theme!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*chedulin" Tasks
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<an/ Drupal modules have periodic tasks that must be
tri""ered at specific intervie2s! This is called a cron Fob
and the/ are setup in the cron!php pa"e! To activate these
tasks, /ou must call the cron pa"eR this 2ill pass control to
the modules and the modules 2ill decide if and 2hat the/
must do!
The follo2in" eample crontab line 2ill activate the cron
script on the hour:
0 O O O O 2"et +. + +I http:JJH.*T;A<HJcron!php
<ore information about the cron scripts are available in
the admin help pa"es and in the Drupal handbook at
drupal!or"! Hample scripts can be found in the scriptsJ
director/! 9 dont kno2 the ,indo2s eIuivalent of this
section! )lease email me if /ou kno2!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.ptional (omponents
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ To use 8<0+based services such as the -lo""er A)9,
1abber, C** s/ndication, /ou 2ill need )H)Ds 8<0
Drupal Handbook: 20 April 2005 103
etension! This etension is enabled b/ default in standard
)H)$ installations!
+ 9f /ou 2ant support for clean 'C0s, /ouDll need
modNre2rite and the abilit/ to use local !htaccess files!
4<ore information can be found in the Drupal handbook on
drupal!or"!5
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'p"radin" an Histin" Drupal *ite
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1! -ackup /our database and Drupal director/ + especiall/
/our confi"uration file 4222!eample!com!conf or
includesJconf!php5!
2! 0o" on as the user 2ith user 9D 1!
7! .ver2rite all the old Drupal files 2ith the ne2 Drupal
files!
$! <odif/ the ne2 confi"uration file to make sure it has
the correct information!
5! Cun update!php b/ visitin"
http:JJ222!eample!comJupdate!php!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<ore 9nformation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6or platform specific confi"uration issues and other
installation and administration assistance, please consult
the Drupal handbook at
http:JJdrupal!or"J! Kou can also find support at the Drupal
support forum or throu"h the Drupal mailin" lists!
!indo*s 5P "" de/elopment test system
guidelines
;ote, this "uide is for settin" up a developmentJtest site
on a ,indo2s 8) s/stem! 9t is ;.T suitable for use in
settin" up a ,indo2s 99* server on the 9nternet! 9t does
not take into account basic steps in securin" the
underl/in" .* or an 99* server a"ainst outside hackin"!
,indo2s 8) is ;.T *uitable for site hostin" on the
9nternet but is nice for a locall/ hosted development
s/stem!
Drupal Handbook: 20 April 2005 110
Assumptions of this document!
s/stem name: (.<)1
database name: siteNdrupal
database user: siteNuser
pass2ord: chan"eme
(hoose a namin" convention of some sort! ,hile /our
intention ma/ onl/ be to have one site, do not rel/ on this!
Hven 2hen testin", practice "ood standards so that /ou
ma/ establish a habit of "ood practices!
all do2nloads are do2nloaded to a c:msupport director/
applications are installed in a c:mappm director/
,eb site is localhost and installed in the default location of
c:minetpubm222root
Kou are familiar 2ith ho2 to use #oo"le to search for
ans2ers and perform troubleshootin" in the appropriate
forums!
;.TH: 9t is a :HCK -AD securit/ practise to install a
production 99* 2ebsite 2ith 9net)ub on the drive 2ith .*
4usuall/ the (: Drive5!
```````````````````````````````````
```````````
Do2nload the follo2in" in preparation!
Do2nload php to c:msupportmphp
http:JJ222!php!netJdo2nloads!php
This eample uses )H) $!7!% installer
Do2nload the </*M0 installer to c:msupportmm/sIl
http:JJdev!m/sIl!comJdo2nloadsJm/sIlJ$!0!html
This eample uses $!0!1&
Do2nload </*M0 (ontrol (enter to c:msupportmm/sIl
http:JJdev!m/sIl!comJdo2nloadsJm/sIlcc!html
This eample uses 0!3!$
Do2nload 2"et!ee for ,indo2s to c:msupportm2"et
http:JJallserv!u"ent!beJlbpu/peJ2"etJkdo2nload
Do2nload Drupal $!$!2 to (:msupportmdrupalmcore
Do2nload <odules of interest to
c:msupportmdrupalmmodules
```````````````````````````````````
```````````
,indo2s 8)
#o to addJremove pro"rams!
Drupal Handbook: 20 April 2005 111
,indo2s components
hi"hli"ht 9nternet 9nformation *ervices
+select details
+select ,orld ,ide ,eb service
(lick ok or finish
(lose out (ontrol )anel
-ro2se to http:JJlocalhost
Kou should "et the ,elcome to ,indo2s 8) *erver
9nternet *ervices pa"e
+if not, troubleshoot this problem before /ou continue!
```````````````````````````````````
```````````
;o2 to the installs
Cun the php installer
+2hen it asks for a director/ location, install to (:mappm)H)
+Accept all the defaults 4allo2 99* $!0 compatible5
ri"ht click (:mappm)H)msessiondata and select *harin" and
*ecurit/
+choose the securit/ tab
+(lick add + advanced +find
+select 9'*CN(.<)1
+click the 2rite Allo2 bo and ok
Do the same for (:mappm)H)muploadtemp director/
Ci"ht click php!ee 4and php$ts!dll5 select )roperties
+click the *ecurit/ tab
Add J advanced J 6ind no2
+select 9'*CN(.<)1
+The Cead ^R Hecute bo is selected b/ default!
php is no2 installed
6rom /our Administrative tools menu, 0aunch 9nternet
9nformation
*ervices Admin
#o do2n to /our Default ,eb *ite
+ri"ht click and select properties
+select the documents tab and click add and add inde!php
+click ok and out
.pen up Hplorer and bro2se to (:m9netpubm222root and
delete ever/thin" in it!
```````````````````````````````````
```````````
Drupal Handbook: 20 April 2005 112
;ote: There are probabl/ better 2a/s to do this but this
consistentl/ 2orks for me!
9nstall </*M0 +chan"e the install director/ to c:mappmm/sIl
Accept all the other defaults!
bro2se to (:mappmm/sIlmbin and launch 2inm/sIladm!ee
lo" in as user root and leave the pass2ord blank! 42eDre
onl/ usin" it to create the m/!ini file5
an/2a/!
choose the m/!ini tab,
uncomment port`770%
choose save modifications
close and relaunch 2inm/sIladm
</*M0 should no2 be runnin" and respondin" on port
770%, /ou can test b/ telnet localhost 770%!
9f not, troubleshoot before proceedin"!
;o2, letDs set a root pass2ord!
c:mappmm/sIlmbin_ m/sIl +u root
m/sIl_ ')DATH m/sIl!user *HT )ass2ord`)A**,.CD
4Dchan"emeD5 ,HHCH 'ser`DrootDR
m/sIl_ 60'*H )C9:90H#H*R
m/sIl_ JIR
```````````````````````````````````
```````````
9nstall </*M0(( accept all the defaults!
0aunch <t*M0((
;ame: local
Host ;ame: localhost
'ser ;ame: root
)ass2ord: chan"eme
*elect Add!
ri"ht click on local and choose connect
ri"ht click on Database and choose (reate ne2 database!
enter siteNdrupal
ri"ht click on siteNdrupal and connect
ri"ht click on the 'sers table +create ne2 user
'sername: siteNuser
Host: localhost
)ass2ord: chan"eme
(heck siteNdrupal
(heck All )rivile"es m/sIl +u siteNuser +p siteNdrupal V
database!m/sIl
Drupal Handbook: 20 April 2005 117
Hnter pass2ord: chan"eme
9f /ou "et a c: prompt, then there 2ere no errors! 9f there
2ere errors troubleshoot and solve before /ou move on!
This is not a Drupal issue, this is a m/*M0 issue! (hoose
the support forum accordin"l/!
Kou can vie2 /our success b/ usin" </*M0cc!
.pen (:m9netpubm222rootmincludesmconf!php in an editor!
49 prefer (rimson Hditor 222!crimsoneditor!com as it has
contet hi"hli"htin" for php amoun" others but choose
/our favorite5
(han"e line 1? per the 9nstall!tt
WdbNurl `
Gm/sIl:JJsiteNuser:chan"emeUlocalhostJsiteNdrupalGR
0ine 71 2ill 2ork as is, but it is a bad habit to i"nore it, so
chan"e it to /our computer name
WbaseNurl ` Ghttp:JJcomp1GR
Alternativel/ /ou can replace it 2ith this line that 9 found
in the forums! There ma/ be conseIuences to itDs use that 9
am una2are of!
WbaseNurl ` Ghttp:JJG! WN*HC:HCZDHTT)NH.*TD[R
49f /ou use host headers it 2ill adapt nicel/ to all of them5!
Kou are no2 at step 5 of DrupalDs 9nstall!tt!
Kou can use the do2nloaded 2"et!ee to schedule tasks
2ith the ,indo2s *cheduler! 9 do mine ever/ four hour!
Kours 2ill depend on /our site confi"! alternativel/ /ou
ma/ do2nload (/"2in of <icrosoftDs *ervices for 'ni and
use the tools in those packa"es!
"nstalling ne* themes
.nce /ou "et Drupal installed and /ou start to come to
terms 2ith it /ou 2ill probabl/ 2ant to customi=e the 2a/
it looks!
There are several themes 2hich /ou can do2nload from
the Drupal 2eb site 2hich should "et /ou started!
9nstallin" a ne2 theme is ver/ strai"htfor2ard:
Do2nload a ne2 theme packa"e! ;ote that themes
for different Drupal versions are not compatible,
version $!$ themes do not 2ork 2ith Drupal $!5 and
Drupal Handbook: 20 April 2005 11$
reverse!
Cead an/ CHAD<H or 9;*TA00 files in the packa"e
to find out if there are an/ special steps needed for
this theme!
(heck to see if /ou have the reIuired theme en"ine
to be able to displa/ /our theme! Theme en"ine files
"o in a folder in themes.engines in /our Drupal
director/!
'pload the contents of the theme packa"e to a ne2
director/ in the themes director/ in /our Drupal site!
6or eample, themes.o$_grey!
(lick administer jh themes and enable the ne2
theme 4Drupal 2ill auto+detect its presence5!
Hdit /our user preferences and select the ne2
theme! 9f /ou 2ant it to be the default theme for all
users, check the default bo in the themes
administration pa"e!
8igrating from other *eblog soft*are to
Drupal
8igrating from e)Publish
9Dve mi"rated an e=)ublish site to drupal! Here are the
steps:
1! 9 performed a basic installation of drupal, and created
the first user!
2! 9 used php</Admin to etract the entire e=)ublish
database, then installed it at the tar"et site!
7! 9 used sIl statements to etract articles, links, and users
from e=)ublish and insert them into drupal database!
$! 9 modified e=)ublishDs Gprinter+friendl/G article template
to insert html comments sho2in" the start and end of
teaser and bod/!
5! e=)ublish maintains articles in e=ml! 9 used a perl
script to fetch each e=)ublish article 2ith
0,)::'serA"ent, etract the html+formatted teaser and
bod/, and update the content of the drupal database!
%! 9 used a perl script to etract userDs first and last names
from e=)ublish and packa"e them into the users!data field
Drupal Handbook: 20 April 2005 115
for use b/ drupalDs profile module!
Here are the sIl and perl scripts 9 used! )lease note the
follo2in" limitations:
1! DoesnDt kno2 ho2 to access e=)ublish pa"es that
reIuire lo"inR the content of these pa"es 2ill be left in
e=ml!
2! DoesnDt do an/ content ecept articles, article
cate"ories, links, link cate"ories, and users!
DoesnDt fi internal links 4links to other pa"es on same
site5, but does identif/ nodes containin" them!
8o/e e)p database content to drupal
database
Znote from editor a: /ou have to escape the special
characters V 4^ltR5, _ 4^"tR5, and ^ 4^ampR5[
mys7! 3ppass/ord drupa! < migrate+s7!
The follo2in" is the content of mi"rate!sIl:
se!ect Suid %= if(ma$(uid)'ma$(uid)'?) from users;
se!ect Stid %= if(ma$(tid)'ma$(tid)'?) from term_data;
se!ect Snid %= if(ma$(nid)'ma$(nid)'?) from node;
se!ect Sro!e_authenticated_user %= rid from ro!e /here name
= 'authenticated user';
se!ect Se4p_ur! %= *http%..mye4psite+com*;
0
0 8nsert a!! e4pu!ish artic!es as drupa! *story* nodes
0
89:AG; 89;C node
(nid' type'tit!e'uid'status'comment' promote' users'
attriutes' revisions' created'teaser'ody)
se!ect
idWSnid' 0 nid
'story'' 0 type
name' 0 tit!e
1' 0 uid
1' 0 status
,' 0 comment
?' 0 promote
'''
'''
'''
created'
contents'
contents
from e4p+eV<rtic!e_<rtic!e
Drupal Handbook: 20 April 2005 11%
/here 8sKu!ished;
0
0 8nsert a!! e4pu!ish /e!in(s as nodes
0
se!ect S/e!in(_nid%= ma$(nid)W1 from node;
89:AG; 89;C node
(nid' type' tit!e' uid' status' comment' promote' users'
attriutes' revisions' created' teaser' ody)
se!ect
idWS/e!in(_nid'
'/e!in(''
name'
1'
1'
,'
?'
'''
'''
'''
created'
description'
description
from e4p+eV=in(_=in(;
89:AG; 89;C /e!in(
(
nid'
/e!in('
c!ic('
monitor'
0si4e'
change_stamp'
chec(ed'
0feed'
refresh'
thresho!d'
spider_site
0spider_ur!
)
se!ect
idWS/e!in(_nid'
if (ur! rege$p '%..'' ur!' concat('http%..'' ur!))'
?'
?'
?'
?'
,1-??'
5?'
?
from e4p+eV=in(_=in(;
Drupal Handbook: 20 April 2005 11?
0
0 Hiscover vocau!aries for e4artic!e and one for e4!in(
0 (;hese esta!ished manua!!y y drupa! configure.ta$onomy
I8)
0
se!ect Stopic %= vid from vocau!ary /here name = ';opic';
se!ect S!in( %= vid from vocau!ary /here name = '=in(';
0
0 8nsert e4artic!e_category names as terms under topics
vocau!ary
0
89:AG; 89;C term_data
(
tid'
vid'
name'
description'
/eight
)
se!ect
idWStid'
Stopic'
name'
description'
?
from e4p+eV<rtic!e_Bategory;
0
0 ;he artic!e categories (terms) are non3hierarchica!
0
insert into term_hierarchy
se!ect idWStid'? from e4p+eV<rtic!e_Bategory;
0
0 8nsert categories assigned to e4artic!es
0
89:AG; 89;C term_node
(
nid'
tid
)
se!ect
artic!eidWSnid'
categoryidWStid
Drupal Handbook: 20 April 2005 11&
from e4p+eV<rtic!e_<rtic!eBategory=in(
;
0
0 8nsert eV=in(_Bategory names as terms under vocau!ary
!in(s
0
se!ect S/e!in(_tid %= ma$(tid)W1 from term_data;
89:AG; 89;C term_data
(
tid'
vid'
name'
description'
/eight
)
se!ect
idWS/e!in(_tid'
S!in('
name'
description'
?
from e4p+eV=in(_Bategory;
0
0 ;he !in( categories (terms) are non3hierarchica!
0
insert into term_hierarchy
se!ect idWS/e!in(_tid'? from e4p+eV=in(_Bategory;
0
0 8nsert categories assigned to e4!in(s
0
89:AG; 89;C term_node
(
nid'
tid
)
se!ect
!in(idWS/e!in(_nid'
categoryidWS/e!in(_tid
from e4p+eV=in(_=in(Bategory=in(
;
0
0 8nsert users
0
89:AG; 89;C users
Drupal Handbook: 20 April 2005 113
(
uid '
name '
pass '
mai! '
0 mode '
0 sort '
0 thresho!d '
0 theme '
signature '
timestamp '
status '
time4one '
0 !anguage '
init '
0 data '
rid
)
se!ect
idWSuid'
!ogin'
pass/ord' 0 encryption differs' so users /i!! have to reset
their pass/ords
emai!'
signature'
1?X55XY>,6'
1' 0 active status
?' 0 time4one
emai!' 0 init
Sro!e_authenticated_user
from e4p+eVIser_Iser;
0
0 drupa! dec!ares these ta!e primary (eys as
auto_increment' ut
0 in fact actua!!y assigns them e$p!icit!y+ Ipdate drupa!'s
idea
0 of /hat id to assign ne$t for each ta!e+
0
de!ete from se7uences /here name='users_uid';
insert into se7uences (name' id)
se!ect 'users_uid'' ma$(uid) from users;
de!ete from se7uences /here name='term_data_tid';
insert into se7uences (name' id)
se!ect 'term_data_tid'' ma$(tid) from term_data;
de!ete from se7uences /here name='node_nid';
insert into se7uences (name' id)
se!ect 'node_nid'' ma$(nid) from node;
Drupal Handbook: 20 April 2005 120
0
0 8dentify artic!es /ith interna!!in(s (to e edited
manua!!y in drupa!)
0
se!ect nid from node /here ody rege$p Se4p_ur!;
Parse e)-ml 1in perl+ *ith ,!P00UserAgent2
0Z.usr.in.per! 3/
use strict;
use =OK%%Iser<gent;
use E;;K%%Ge7uest%%Bommon 7/(KC:;);

use HM8;
use Barp;
su parse;
my $server = '!oca!host';
my $dataase = 'drupa!';
my $username = 'me';
my $pass/ord = 'fooar';
my $verose;
my $dh = HM83&connect(*di%mys7!%$dataase%$server*'
$username' $pass/ord )
or croa( *Ban't connect to dataase*;
$dh3&{GaiseArror) = 1;
my $se!ect = $dh3&prepare( 7.se!ect nid from node /here
type='story'. );
my $update = $dh3&prepare( 7.update node set teaser=?'
ody=? /here nid=?. );
$se!ect3&e$ecute;
/hi!e (my $id = $se!ect3&fetchro/) {
my $e4pid = $id;

0 ;he fo!!o/ing is the *printer3friend!y* ur! for e4p
artic!e
my $ur! =
*http%..mathiasconsu!ting+com.artic!e.artic!eprint.$e4pid.3
1.?.*;
my $uri = IG83&ne/( $ur! );
Drupal Handbook: 20 April 2005 121
my $ua = =OK%%Iser<gent3&ne/();
my $re7 = KC:; $uri' [ ";
0 :end the re7uest' receive the response
my $response = $ua3&re7uest($re7)3&as_string;
0 print *FFFFFFFFFFFFFFFFFFUn*' uc($ur!)' *Un*;
0 print *$responseUnUnUn*;
(my $teaser' my $ody) = parse( $response );
if ($teaser and $ody) {
$update3&e$ecute( $teaser' *$teaserUn<Z33rea(33
&Un$ody*' $id );
)
e!se {
print *Ban't parse $ur!Un*;
)
)
0
0 =oo( for !ines p!aced there y artic!eprint+tp!
0
su parse {
my $s = shift;
my $teaser;
my $ody;
if ($s =[ .<Z33 teaser starts 33&Un(+F?)<Z33 teaser ends
33&Un.ms) {
$teaser = $1;
)
if ($s =[ .<Z33 ody starts 33&Un(+F?)<Z33 ody ends 33
&Un.ms) {
$ody = $1;
)
return $teaser' $ody;
)
Get e)publish user real names for drupal
profile.module
Znote from a to cher/l: this code tri""ers Gsuspicious
inputG because it of Gdata`G! had to escape this 2ith
G^k100Rata`G! i also 2rapped the lines 4Gm/ Wtemplate`G5
at &0 chars to make this look better here + hope i didnDt
introduce an/ bu"s[
Drupal Handbook: 20 April 2005 122
0Z.usr.in.per! 3/
use strict;
use HM8;
use Barp;
my $server = '!oca!host';
my $dataase = 'drupa!';
my $username = 'me';
my $pass/ord = 'pass/ord';
my $verose;
my $dh = HM83&connect(*di%mys7!%$dataase%$server*'
$username' $pass/ord )
or croa( *Ban't connect to dataase*;
$dh3&{GaiseArror) = 1;
0 difference et/een e4p user id and drupa! uid (see Suid in
migrate+s7!)
my $iddifference = 1;
my $temp!ate='a%1@%{s%1-%*profi!e_rea!name*;s%\d%*\
s*;s%16%*profi!e_address*;U
s%?%**;s%1,%*profi!e_city*;s%?%**;s%1@%*profi!e_state*;s%?%*
*;s%11%*profi!e_4ip*;U
s%?%**;s%16%*profi!e_country*;s%?%**;s%11%*profi!e_2o*;s%?%
**;s%1-%*profi!e_homepage*;U
s%?%**;s%1X%*profi!e_iography*;s%?%**;s%11%*/e!in(_ne/*;s%
1%*?*;s%6%*pass1*;U
s%?%**;s%6%*pass,*;s%?%**;s%6%*!oc(*;a%?%{))';
my $se!ect = $dh3&prepare( 7.se!ect 8H' Dirst9ame' =ast9ame
from e4p+eVIser_Iser. );
my $update = $dh3&prepare( 7.update users set data=? /here
uid=?. );
$se!ect3&e$ecute;
/hi!e ((my $id' my $first' my $!ast) = $se!ect3&fetchro/) {
my $name = ($first ]] '') + ($first ## $!ast ? ' ' % '')
+ ($!ast ]] '');
my $profi!e = sprintf( $temp!ate' !ength( $name )' $name
);
$update3&e$ecute( $profi!e' $idW$iddifference );
)
8igrating from Geeklog
The partial mi"ration of stories from #eeklo" into stor/+
nodes Drupal is a mappin" of the F_stories table into the
Drupal Handbook: 20 April 2005 127
nodes tableR a Iuick 2a/ to do the transform is to dump
the stories out into a format suitable for !oad data
infi!e:
se!ect 'story' as type'
tit!e'
uni$_timestamp(date) as created'
'' as users'
introte$t as teaser'
odyte$t as ody'
uni$_timestamp(date) as changed'
'' as revisions
from tc_stories into outfi!e
'.tmp.stories+dump';
this creates the load fileR after /ouDve loaded the database
script from the Drupal distribution, this data can be
inserted into the database 2ith
!oad data infi!e '.tmp.stories+dump'
into ta!e node
(type'tit!e'created'users'teaser'ody'changed'revisi
ons);
This is not a perfect transformation, but itDs a start!
#eeklo" subFects are lost: To preserve cate"ories, /ou
2ould need to pre+load the topics in Drupal, then create a
script that 2ould insert items from F_stories as mapped
in the above eample, but then to fetch the nid node id
number from the ne2l/ inserted record and do a search on
the term_data to "et the tid number, then insert the pair
into the term_node table!
*ince the terms of our ne2 site 2ere onl/ superficiall/
similar to the cate"ories 2eDd used in #eeklo", 2e chose
instead to fi up the cate"ories later b/ doin" ke/2ord
searches on stories to "et a list of nid and then pairin"
those to the ne2 topics b/ hand usin" *M0 via mys7!
-u": After insertin" stories usin" the above method, the
stories 2ill be in the archives, but 2ill not appear on the
main pa"e 4use update node set promot = 1 to fi this
for all or selected items5! A more serious bu" is that the
nodes do not appear in search results ++ 9 donDt kno2 that
much about the inner 2orkin"s of Drupal, but 9 epect
someone 2ill post a comment eplainin" ho2 to fi this!
Drupal Handbook: 20 April 2005 12$
8igrating from ,i/e.ournal
9n some respects, there is no need to mi"rate from
0iveFournal, as such! 9tDs "reat!! one thin" 9 canDt offer here
is the DfriendsD feature, and all the othe "reat stuff the 01
offers!
This postin" is for people 2ho 2ish to either include their
01 data in a Drupal site or to leave 01 behind and import
their data 2holesale into a Drupal -lo"!
,hen 9 started pla/in" 2ith Drupal 9 tried to import m/
0ive1ournal in several 2a/s!!! Kou ma/ be happ/ 2ith one
of these! These are listed in order of best inte"ration 2ith
Drupal!
9f an/one see a mechanism for makin" their eport s/stem
an/ better 15 email me! 25 email liveFournal!!LL
"mport your ,. through an "3$A8C held in a
&ook Page or similar
;ot ideal to be honest, althou"h 9 did use this approach for
a 2eek or t2o! Kou 2ill rel/ upon the 01 commentin"
feature, and /ou 2ill have to create a suitable 01 st/le to
make it 2ork!
9nterestin"l/, /ou ma/ not be a2are that /ou can, in fact,
have as man/ st/les are /ou 2ish! DThe/D 2ill not tell /ou
this an/2here!!! but /ou can!
Kou could have one st/le for people 2ho vie2 /our Fournal
directl/ at liveFournal!com, and another for /our importin"
96CA<H!
Kou simpl/ reference them 4in an 96CA<H5 like this:
<Z33 :etup 2ourna! 33&
<iframe src=*http%..///+!ive2ourna!+com.customvie/+cgi?
user=ro/anoy#sty!eid=1>->@>* /idth=*1??\* height=@??*
frameorder=*?* scro!!ing=*auto*
a!!o/transparency=*fa!se*&
<Z33 <!ternate content for non3supporting ro/sers 33&
Pour ro/ser /on't /or( here+ Pou'!! need 8A6+6W
<.iframe&
,hen /ou define /our custom st/le at 01, /ouDll be told the
st/le id to use! ;ote that this 2ill onl/ 2ork for paid users
of 01!
Drupal Handbook: 20 April 2005 125
Using pro/ided "mport 8odule
Kou OcouldO use the DimportD module to connect to the C**
feed provided b/ 0ive1ournal for ever/ )A9D user! 9tDs
prett/ "ood that 01 even bother 2ith this, so 9 "uess 2e
have to be "rateful!!
A standard C** feed is provided at a url similar to:
http:JJ222!liveFournal!comJusersJro2anbo/Jrss!ml
This 2ill 2ork if imported into the ne2sfeeds section of
/our Drupal site!!!!but the actual content 2ill still live at
0ive1ournal! 9 "uess the advanta"e here is that /ou can
still use 01 and /et 4fairl/5 d/namicall/ pull content into
Drupal!
Use the ,i/eBournal 8odule to import the
ra* data into Drupal
(urrent Do2nload: from m/ site
9Dve 2ritten a module to import an entire 0ive1ournal into a
Drupal -lo"!
This kind of assumes that /ouDre 2illin" to bin 0ive1ournal
at present! 9Dm 2orkin" on a more d/namic approach, but
once /ou see ho2 this 2orks, /ouDll probabl/ understand
m/ motives!
The alternative to the C** feed + 2hich 9Dll reiterate has
Ono contentO + is to eport /our 01 month b/ month to an
8<0 file! K.uDll find 2hat /ou need to do this here! *ave
the resultin" 8<0 some2here! Cepeat for each month that
/ouDve been usin" 01! *i"h!
;ote: The module 9Dve 2ritten 2ill epect /ou to post this
file on the Dnet 2hile /ou import it!
9n essense, the module takes this file and stuffs it into a
user blo"! Kou can then decide 2hether to publish /our
entries or not!
9 prefered this approach as 9 no2 o2n m/ data! 9f 01 2ent
bust, itDs m/ data!!!
Drupal Handbook: 20 April 2005 12%
8igrating from 8o/able Type
9 Za: FibbaFabbabo/[ Dve chronicled m/ eperience
mi"ratin" a <ovableT/pe site to Drupal!! The process 2as
fairl/ simple, but reIuired a bit of 2ork settin" up inde
templates to eport <T data as a </*M0 dump 2ith
9;*HCT statements! 9f /ou have <T installed 2ith a
</*M0 database 9 presume there mi"ht be an easier 2a/
to do this, but this 9 2orked this 2a/ because it 2as much
Iuicker for me! The final mi"rated Drupal site is no2 live
at http:JJurl"re/hot!com!
Za: co2bo/d used another strate"/! moved here from a
comment![ 9 used a different strate"/, but 9 didnDt have the
need to do an/thin" fanc/, such as brin" over <T
cate"ories or comments, so 9 2rote a reall/ Iuick perl
script to parse the <T rss feed, and use it to directl/
"enerate inserts into the node table! ,orked Iuite 2ell for
me! 9 detailed the process here!
</ site is no2 live usin" drupal!
Za: cher/lchase details on co2bo/dDs method above!
moved here from a separate book pa"e 4and fied the
HT<05![ *enor Dude recommended usin" a modified
<ovable T/pe template to "enerate all the entries to be
mi"rated as a sin"le file of ml, then cobblin" to"ether a
Iuick/ parser in perl 2ith 8<0::*A8 to "enerate m/sIl
insert statements! 9 had to make a couple of modifications
to his code to "et the thin" 2orkin"!
ZFsen": mt2drupal is another trick /ou can use to mi"rate
<T to Drupal! 9t is 2ritten in perl as an <T plu"in utili=in"
<T libraries to etract from the database and then feed it
into the </*M0 database directl/! 9t 2ill import
all /our blo""ers
all /our defined cate"ories
all /our entries includin" bod/, ecerpt, etended 4in
$!$!1 ^ (:*, it is stored as bod/etended and in D$-
formattin" rules are also preserved5
all /our comments 42ith anon/mous support, in (:*
and D$-5
all incomin" trackbacks 4stored as comments5
all /our out"oin" trackbacks 4D$- onl/5
all /our trackbacks trackers 4D$- onl/5
Drupal Handbook: 20 April 2005 12?
keep all /our old archives as urlNalias, includin" /our
C** feeds so permalink is preserved
Za=tek: 1ohn Do2ne/ has come up 2ith his o2n conversion
script modified from the one in this book! His final site
no2 at http:JJ222!catdevnull!net has a vie2 of his
eperiences startin" over a"ain 2ith Drupal!
C-tract 8o/able Type content as -ml
1! 9nstall the follo2in" as a ne2 <ovable T/pe template
called Drupal (onvert, 2ith drupal!rdf specified as the
.utput 6ile!
<?$m! version=*1+?* encoding=*iso3>>6Y31*?&
<items&
<1;Antries !astn=*1???* sort_order=*ascend*&
<item aout=*<$1;Antry=in($&*&
<tit!e&<$1;Antry;it!e encode_$m!=*1*$&<.tit!e&
<description&<$1;AntryMody encode_$m!=*1*$&<.description&
<!in(&<$1;Antry=in($&<.!in(&
<su2ect&<$1;AntryBategory encode_$m!=*1*$&<.su2ect&
<creator&<$1;Antry<uthor encode_$m!=*1*$&<.creator&
<date&<$1;AntryHate format=*\P3\m3\d;\E%\1%\
:*$&<$1;M!og;ime4one$&<.date&
<.item&
<.1;Antries&
<.items&
2! *ave the template, and rebuild! <ovable T/pe 2ill offer
to rebuild drupal!rdf for /ou! The file 2ill contain the last
1000 <ovable T/pe entries, encoded as 8<0, sorted in
ascendin" date order! This 2ill be helpful if /ou are
turnin" them into drupal blo" entries, because drupal
displa/s blo" entries in reverse node id 4database insert5
order!
8o/ing your 8T styles and templates
.f course /ou 2ant to make /our ne2 drupal site look and
feel as much as possible like /our old <T site! This article
mi"ht help on the 2a/ in doin" so! 0uckil/ this is not too
hard, so non+)H) pro"rammers can re +create the old
st/les, so that the/ can be used on the ne2 drupal site! To
do this, /ou do not need to kno2 )H), but /ou do need to
kno2 at least basic (** codin"!
*ince 9 do not kno2 the 2a/ <T templates are built and
Drupal Handbook: 20 April 2005 12&
created, 9 2ill stick onl/ to the drupal part of the stor/!
ThatDs not a too bi" problem, because, as lon" as /ou
understand the 2a/ drupal uses its themes, /ou 2ill be
able to modif/ little thin"s so that the/ JlookJ like the <T
st/les, but do not have to be the same! After all, this is not
an article about stealin", its about ho2 to port /our o2n
<T creations to drupal! *o bear in mind: do not steal,L
Drupal kno2s man/ methods for themin"! 9t depends on
/our o2n preferences 2hat themin" method /ou choose!
This, ho2ever is far out of the scope of this article, and 9
stick to the easiest method, in m/ opinion, )H) template!
The )H) template can be installed as an/ other theme,
read the shipped install tet on ho2 to do this! There are
numerous articles on drupal!or" that eplain in detail ho2
to confi"ure )H) template, "o look for them /ourself and
use them to confi"ure the template! This document is not a
tutorial on ho2 to use )H) template, after all!
(reatin" a ne2 template under )H)template is as eas/ as
cop/+pastin" one of the folders! Cename it to somethin"
/ou like: </Template for eample! The best is to cop/ the
<oveableToDrupal folder and paste it as </Template!
;o2 some technical blabla on the 2a/ )H)template
2orks! Drupal kno2s themes, Fust the 2a/ most (<*+es
do! The file phptemplate!theme is the actual theme! The
bi" difference is that )H)template is not Fust a theme, like
chameleon, or blue robot, but acts more like a la/er! 9t
allo2s /ou to create templates in the theme! #et itE ;oE
Alri"ht: Drupal has themes! Kou can install a theme and
the look and feel of /our site has chan"ed!
-ut )H)template is not reall/ one of them! 9t uses some
fanc/ codin" to create another templatin" s/stem! *o it is
a template in a theme! All the folders inside the
)H)template folder are templates,
#ot it no2E
*o inside those sub+folders 4for eample the folder
</Template5 there are some files! *ome of them are
st/les, some ima"es and a fe2 are !php files! The/ are the
actual templates! 9f /ou kno2 enou"h )H) Fust open them
and move some of the code around!
-ut no2 over to the real stuff: usin" the st/le sheet4s5 to
re+create /ou <T desi"n!
Drupal Handbook: 20 April 2005 123
As said above: /ou 2ill need (** skills to do this, if /ou
donDt have those, 2ell, post a messa"e on drupal!or" or on
the support list and tell /ouDve "ot some mone/ or
somethin" else 4stories, tutorials, modules, clients 2ith
loads of mone/5 l/in" around /ou 2ish to "et rid of! And
ask if an/bod/ is interested in receivin" that mone/ 4or
that somethin" else5 for the simple task of re2ritin" the
<T (**!
-ack to business: drupal can have virtuall/ an/ HT<0
D.<, but in "eneral it is kind of similar to that of <T! 9n
)H) template , 2e have sidebars and a main content!
Drupal uses the id !node instead of !blo" and it has some
more differences, of course!
*ome basic chan"es /ou should make are:
<T selector
Drupal )H) template selector
kbanner
!header
!side
!sidebar+left or !sidebar+ri"ht
kcontent
!main+content
H7!title
!node H2 4A5
!blo"
!node
!blo"bod/ 4)5
!node !content
These are some basic chan"es , that should "et /ou on the
road! 6or all other stiles and selectors, /ou should heave a
look at the st/le sheet in <oveableToDrupal
Drupal Handbook: 20 April 2005 170
Template for 8T entry and comment e-port
and Drupal import
To do0
Automaticall/ create accounts
Hport <T cate"ories and import to Drupal
taonom/
,imitations0
All comments are from the Anon/mous user
All comments are unthreaded
The comment subFect is made from the first five
2ords of the comment
The import defaults to usin" uid 1, i!e! the site admin
4chan"e the $uid variable to import to another user5
All posts are promoted to the front pa"e
All comments have a published status
<T cate"ories 4Drupal taonom/ terms5 are not
eported
"nstructions0
(reate a ne2 <ovable T/pe 9nde template called
Drupal 9mport 2ith import!php specified as the
.utput 6ile
(ut and paste the follo2in" into the Template bod/
tetarea
*et the variables belo2 the JJset variable defaults
comment to the correct values
*ave and rebuild the template
0oad import!php in /our 2eb bro2ser
9f the import is successful, the output 2ill be a sin"le
sentence listin" the number of entries and comments
imported!
<htm!&
<head&
<tit!e&A$port<.tit!e&
<.head&
<ody&
<?php
..set varia!e defau!ts
Drupal Handbook: 20 April 2005 171
$hostname = **;
$username = **;
$pass/ord = **;
$d = **;
$uid = 1;
.. get ne$t node numer from se7uences ta!e
$!in( = mys7!_connect($hostname'$username'$pass/ord) or die
(*Bou!d not connect to server*);
mys7!_se!ect_d($d) or die(*Bou!d not se!ect dataase
*+$d);
$resu!t = mys7!_7uery(*:A=AB; nid DGC1 node*);
$node_ro/s = mys7!_num_ro/s($resu!t)W1;
<1;Antries !astn=*1???* sort_order=*ascend*&
$node_tit!e = <<<9;
<$1;Antry;it!e$&
9;;
$node_tit!e = mys7!_escape_string($node_tit!e);
$node_teaser = <<<9A
<$1;AntryMody$&
9A;
$node_teaser = mys7!_escape_string($node_teaser);
$node_ody = <<<9M
<$1;AntryMody$&<$1;Antry1ore$&
9M;
$node_ody = mys7!_escape_string($node_ody);
..get post status
$status = strto!o/er(*<$1;Antry:tatus$&*);
if ($status == *pu!ish*)
{
$node_status = 1;
)
e!se
{
$node_status = ?;
)
$node_insert_7uery = *89:AG; 89;C node (type' tit!e' uid'
status' comment' promote' users' revisions' created'
changed' teaser' ody) R<=IA: ('!og'' '$node_tit!e'' $uid'
$node_status' ,' 1' ''' ''' I98L_;81A:;<1K('<$1;AntryHate
format=*\P3\m3\d \E%\1%\:*$&<$1;M!og;ime4one$&')'
I98L_;81A:;<1K('<$1;AntryHate format=*\P3\m3\d \E%\1%\
:*$&<$1;M!og;ime4one$&')' '$node_teaser'' '$node_ody');*;
<1;Bomments sort_order=*ascend*&
$comment_te$t = <<<B;
<$1;BommentMody$&
B;;
$comment_te$t = mys7!_escape_string($comment_te$t);

.. gra the first five /ords of the comment as the comment
Drupal Handbook: 20 April 2005 172
su2ect
$su2ect = **;
$arr = e$p!ode(* *'$comment_te$t);

for($i=?; $i<6; $iWW) { $su2ect += $arr??6;$i??6d;+* *; )
$comments_insert_7uery = *89:AG; 89;C comments (cid' pid'
nid' uid' su2ect' comment' hostname' timestamp' score'
status' thread' users) R<=IA: (9I==' ?' $node_ro/s' ?'
'$su2ect'' '$comment_te$t'' '<$1;Bomment8K$&''
I98L_;81A:;<1K('<$1;BommentHate format=*\P3\m3\d \E%\1%\
:*$&<$1;M!og;ime4one$&')' ?' ?' '1.'' 'a%1%{i%?;i%?;)');*;
mys7!_7uery($comments_insert_7uery);
if (mys7!_errno($!in())
{
echo mys7!_errno($!in() + *% * + mys7!_error($!in() +
*Un*;
)
$comments_ro/sWW;
<.1;Bomments&
.. increment node_ro/s counter' so /e have the correct nid
for the comment insert ne$t time
$node_ro/sWW;
mys7!_7uery($node_insert_7uery);
if (mys7!_errno($!in())
{
echo mys7!_errno($!in() + *% * + mys7!_error($!in() +
*Un*;
)
<.1;Antries&
.. echo the numer of ro/s added to the nodes ta!e
echo($node_ro/s+* !og entries and *);
mys7!_7uery(*89:AG; into se7uences (name'id) R<=IA:
('node_nid''$node_ro/sW1)*);
if (mys7!_errno($!in())
{
echo mys7!_errno($!in() + *% * + mys7!_error($!in() +
*Un*;
)
.. echo the numer of ro/s added to the comments ta!e
echo($comments_ro/s+* comments inserted+*);
mys7!_7uery(*89:AG; into se7uences (name'id) R<=IA:
('comments_cid''$comments_ro/sW1)*);
if (mys7!_errno($!in())
{
echo mys7!_errno($!in() + *% * + mys7!_error($!in() +
*Un*;
)
Drupal Handbook: 20 April 2005 177
mys7!_c!ose($!in();
?&
<.ody&
<.htm!&
Parse -ml into s(l insert statements
This code 2as ori"inall/ published b/ *enor Dude! -ut
because he didnDt publish it in the Drupal Handbook, and
because 9 added code to improve the "eneration of the
teaser 4the ori"inal code Fust put the 2hole bod/ into the
teaser5, 9Dm postin" it here!
KouDll need to have perl of a hi"h enou"h version to handle
the iso+&&53+1 encodin" 49 used 5!&R 5!% is too old5! KouDll
need to install 8<0::*A8 4eas/ enou"h 2ith cpan5! This
ma/ takes Iuite a 2hile to run, dependin" upon 2hat
parser it locates!
use L1=%%:<L%%Mase;
use L1=%%:<L%%KarserDactory;
pac(age 9ode;
my $teaser_!ength = -??;
pac(age BonversionDi!ter;
S8:< = 7/(L1=%%:<L%%Mase);
my $type = '!og';
su characters {
my ($se!f'$data) = S_;
$se!f3&{_characters) += $data3&{Hata);
)
su start_e!ement {
my ($se!f' $e!ement) = S_;
my $tagname = $e!ement3&{=oca!9ame);
my $hand!e = *start_$tagname*;
if ($se!f3&can($hand!e)) {
$se!f3&$hand!e($e!ement);
)
$se!f3&:IKAG%%start_e!ement($e!ement);
)
Drupal Handbook: 20 April 2005 17$
su end_e!ement {
my ($se!f' $e!ement) = S_;
my $tagname = $e!ement3&{=oca!9ame);
my $hand!e = *end_$tagname*;
if ($se!f3&can($hand!e)) {
$se!f3&$hand!e($e!ement);
)
$se!f3&:IKAG%%end_e!ement();
)
su start_item {
my $se!f = shift;
$se!f3&{_current_item) = ne/ 9ode();

)
su end_item {
my $se!f = shift;
print $se!f3&{_current_item)3&insert_statement();
)
su start_description {
my $se!f = shift;
$se!f3&c!ear_characters();
)
su end_description {
my $se!f = shift;
$se!f3&{_current_item)3&{description) = $se!f3
&get_characters();
)
su start_tit!e {
my $se!f = shift;
$se!f3&c!ear_characters();
)
su end_tit!e {
my $se!f = shift;
$se!f3&{_current_item)3&{tit!e) = $se!f3
&get_characters();
)
su start_date {
my $se!f = shift;
$se!f3&c!ear_characters();
)
su end_date {
my $se!f = shift;
$se!f3&{_current_item)3&{created) = $se!f3
&get_characters();
)
su c!ear_characters {
my $se!f = shift;
$se!f3&{_characters) = **;
)
Drupal Handbook: 20 April 2005 175
su get_characters {
my $se!f = shift;
return $se!f3&{_characters);
)
pac(age 9ode;
su ne/ {
my $c!ass = shift;
return !ess {)' $c!ass;
)
0 Morro/ed from node+modu!e
su node_teaser {
my $ody = shift;
my $si4e = $teaser_!ength;
if ($si4e == ?) {
return $ody;
)
if (!ength($ody) < $si4e) {
return $ody;
)
if (my $!ength = rinde$($ody' *<r .&*' $si4e)) {
return sustr($ody' ?' $!ength);
)
if (my $!ength = rinde$($ody' *<r&*' $si4e)) {
return sustr($ody' ?' $!ength);
)
if (my $!ength = rinde$($ody' *<.p&*' $si4e)) {
return sustr($ody' ?' $!ength);
)
if (my $!ength = rinde$($ody' *Un*' $si4e)) {
return sustr($ody' ?' $!ength);
)
if (my $!ength = rinde$($ody' *+ *' $si4e)) {
return sustr($ody' ?' $!ength W 1);
)
if (my $!ength = rinde$($ody' *Z *' $si4e)) {
return sustr($ody' ?' $!ength W 1);
)
if (my $!ength = rinde$($ody' *? *' $si4e)) {
return sustr($ody' ?' $!ength W 1);
)
return sustr($ody' ?' $si4e);
Drupal Handbook: 20 April 2005 17%
)
su insert_statement {
my $se!f = shift;
my $ody = mys7!_escape($se!f3&{description));
my $teaser = mys7!_escape( node_teaser( $se!f3&
{description) ) );
return *89:AG; 89;C node *+
*(type'tit!e'uid'status'comment' promote'
users' attriutes' revisions' created'teaser'ody)*+
* R<=IA: ('$type'''*+
mys7!_escape($se!f3&{tit!e))+
*''1'1','1''''''''''*+
*I98L_;81A:;<1K('*+to_mys7!_date($se!f3&
{created))+*')''$teaser'''$ody');Un*;
)
su mys7!_escape {
my $string = shift;
$string =[ s.Un.UUn.mg;
$string =[ s.(U']U*).UU$1.g;
return $string;
)
su to_mys7!_date {
my $string = shift;
$string =[ s.;. .;
$string =[ s.UW??%??$..;
return $string;
)
pac(age main;
my $fi!ename = $<GQR[?";
my $hand!er = ne/ BonversionDi!ter();
my $parser = ne/ L1=%%:<L%%KarserDactory3&parser(Eand!er =&
$hand!er);
$parser3&parse_uri($fi!ename);
"nsert content into drupal nodes
The final trick is that the insert statements count on
m/sIlDs autoNincrement feature, but drupal actuall/ sets
node ids eplicitl/! *o after /ou run the "enerated m/sIl,
/ouDll need to find the maimum node id that m/sIl
"enerated for /ou, and bump the net node id that drupal
intends to assi"n to be lar"er than that!
\ .in.per! +.convert+p! drupa!+rdf &mt+s7!
Drupal Handbook: 20 April 2005 17?
\ mys7! 3ppass/ord drupa! se!ect ma$(nid) from node;
W3333333333W
] ma$(nid) ]
W3333333333W
] >@ ]
W3333333333W
1 ro/ in set (?+,6 sec)
mys7!& se!ect F from se7uences;
W3333333333333333W3333W
] name ] id ]
W3333333333333333W3333W
] users_uid ] > ]
] vocau!ary_vid ] , ]
] term_data_tid ] > ]
] node_nid ] - ]
] comments_cid ] @ ]
W3333333333333333W3333W
6 ro/s in set (?+?? sec)
mys7!& update se7uences set node_nid = >5;
etting terms for inserted nodes
/ou probabl/ 2ant to assi"n terms to the inserted nodes!
Kou can do this b/ hand in m/sIl! The follo2in" attaches
the term 2ith term id 1 to all the nodes 42hose node ids 9
determined b/ some characteristic of the nodes
themselves, usin" a select statement5!
\mys7! 3ppass/ord drupa!
mys7!& insert into term_node se!ect nid' 1 from node /here
nid &= - and nid <= >@;
8igrating from P4P7uke
8igrating themes
1ust like )H);uke themes, Drupal uses )H)+based themes
mied 2ith HT<0 markup!
-oth have similar functions for header, footer, bo and
stor/ 4node5!
Drupal Handbook: 20 April 2005 17&
8igrating users
$igrating users:
To mi"rate users from )H) ;uke to Drupal takes t2o
simple </*M0 commands! The follo2in" eamples are for
"oin" from )H) ;uke 5 to Drupal 7!
6irst, /ou need to be sure that the DnameD column in the
)H) ;uke user table isnDt blank! 6or eample, from 2ithin
</*M0 t/pe:
update phpnu(e+nu(e_users set name=uname /here name='';
*econd, cop/ the valid data from the )H) ;uke user table
to the Drupal user table:
insert into drupa!+users
(name'userid'rea!_emai!'fa(e_emai!'ur!'io) se!ect
name'uname'emai!'femai!'ur!'io from phpnu(e+nu(e_users;
9f /ou find this intimidatin", /ou can tr/ this script 2hich
includes more instructions!
8igrating from Post7uke
9Dve 2ritten a </*M0 script to mi"rate from a )ost;uke
database to a Drupal one!
(urrentl/ it mi"rates Themes, 'sers, *tories, (omments,
)olls and )oll comments! These 2ere the onl/ tables 2hich
9 2as interested in! 9 2rote it to mi"rate )untbarra!(.<
4the (atalan version of *lashdot5 in earl/ *eptember!
9t has been a bit complicated "iven the fact )ost;uke
database structure is horrible!
Take it from m/ sandbo!
Configuring modFre*rite in .htaccess for
P7 legacy U$,s in
9Dll be mi"ratin" >airosne2s from )ost;uke to Drupal (:*
this 2eekend! *ince the site has almost 2000 stories, 9Dm
concerned about the fact tha an/ links to them from
around the 2eb 2ill "o dead! *ome consolation is that
the !htaccess rules 2ill take those dead links and refer
them to the home pa"e instead of $0$in" them! (an !
Drupal Handbook: 20 April 2005 173
htaccess be confi"ured to re2rite the urlsE The node ids
2ill be taken from the current stor/ idDs, so that part 2ill
not be a problem! The current ); default stor/ url looks
like this: modules!phpEop`modload^name`;e2s^file
`article^sid`13?2^mode`nested der`0^thold`0 so it
seems like it could be re2ritten to nodeJvie2J13?2 9s this
possibleE Admittedl/, 9 kno2 ver/ little about modNre2rite!
An/ su""estions 2ould be helpful!
earch Cngine 3riendly 8igration
The bi""est pain for me, havin" Fust mi"rated from
#eeklo" to Drupal is that m/ site has a "ood inde in
"oo"le and other search en"ines! All those users findin"
m/ site on #oo"le are suddenl/ "ettin" the $0$ error
pa"e, "ivin" up, and "oin" a2a/ 2hen the/ could di" a bit
deeper and find eactl/ 2hat the/ 2ere lookin" for!
*o, 9 harnessed m/ eperience 2rittin" HTT)NCH6HCHC
lo""in" s/stems for "eeklo" to provide m/self 2ith a )a"e
2ith )H) enabled content to parse the *earch Hn"ine
Iuer/ from the HTT)NCH6HCHC and do a search on m/
Drupal site to tr/ and find 2hat the user 2as actual/
lookin" for! 9 thou"ht 9Dd share 2ith the 2orld, as thatDs
the entire point of open source s/stems like Drupal!
<?php
$searchengines = array(
'^http%..///U+goog!e+F$' =& '7''
'^http%..///+googe!+fi+F$' =& '7''
'^http%..+Fsearch+msn+co+Fresu!ts+F$'
=& '7''
'^http%..+FU+mysearch+com.2sp.QQmain+2
sp?searchfor=+F$' =& 'searchfor''
'^http%..search+freeserve+com.+F$' =&
'7''
'^http%..ao!search+ao!+co+F$' =&
'7uery''
'^http%..search+yahoo+com+F$' =& 'va''
'^http%..search+yahoo+com+F$' =& 'p''
'^http%..///+c+co+u(.cgi3
in.search.+F' =& '7''
'^http%..///+tisca!i+co+u(.search.resu
!ts+php+F$' =& '7uery''
'^http%..///+a!tavista+com./e.resu!ts
+F$' =& '7''
Drupal Handbook: 20 April 2005 1$0
'^http%..search+hotot+co+u(.cgi3
in.pursuit+F$' =& '7uery''
'^http%..///+e$cite+co+u(.search./e.r
esu!ts+F$' =& '7''
'^http%..u(+search+yahoo+com.search+F$
' =& 'p''
'^http%..search+/anadoo+F$' =& '7'
);
$referer = getenv(*E;;K_GADAGAG*);
/hi!e( !ist( $rege$p' $7sitem ) = each(
$searchengines ) )
{
if( eregi( $rege$p' $referer ) )
{
echo( t(*<r.&<h,&:earch Angine
Hetected<.h,&8t /ou!d appear you arrived here on
the /ings of a search engine' so' 8 /i!! search my
!oca! dataase and sho/ you anything that matches
/hat you /ere !oo(ing for%<r.&*));
$ur! = parse_ur!( $referer );
$7uerystring = $ur!['7uery'";
$7uerystring = e$p!ode( *#*' $7uerystring );
/hi!e( !ist( ' $va!ue ) = each( $7uerystring
) )
{
$item = e$p!ode( *=*' $va!ue );
if( $item[?" == $7sitem )
{
if( trim( $item[1" ) Z= '' )
{
$item[1" = ur!decode( $item[1" );
echo ( search_data( $item[1" ) );
)
)
)
)
)
?&
This provides a 4partial5 list of re"ular epressions for
common search en"ines, 2ith information as to 2hich
Iuer/ strin" parameter is the Iuer/ the user entered! The
HTT)NCH6HCHC value 4the site the user clicked a link to
"et to /our site5 is then eamined a"ainst this list! ,hen a
match is found, a search is done usin" the standard Drupal
search call 4searchNdata5! This locates potential matches,
Drupal Handbook: 20 April 2005 1$1
and hopeful/, keeps the user on /our site!
9n order to use this, create a ne2 node 2hich allo2s )H)
code! Kou can call it 2hat /ou 2ant, and put 2hatever
eplanator/ tet /ou like on it! Kou can set 2hatever path
/ou like! 1ust drop the above code+clip into place! Then, in
Administration +_ *ettin"s set the $0$ handler to be the
path to the ne2 node /ou created, and voila, if the user
arrives from a reco"nised search en"ine, their search is
performed on /our site! 9tDs 2orkin" nicel/ for me!
8ore than one drupal site on one machine
There are several possible confi"urations for runnin"
multiple Drupal servers on the same hard2are! Kou can
separate them b/ directories or b/ vhosts, the/ can share
confi"urations or split them or, in some cases, have a
miture, but all of these methods have at their heart the +.
sites.domain_or_host_name.settings+php confi"uration
file and the search+seIuence 2here the Drupal pro"ram
2ill search first for a confi"uration named for the current
pa"e and then to the current host before settlin" for the
default!
General $ules for 8ultiple Drupal
Deployments
Hach of the possible multi+drupal scenarios is discussed in
more detail in the sections that follo2, but the "eneral
form for the alternate confi"uration filename is:
+.sites.vhost.uri.settings+php
;ote ho2 the path separator 4DJD5 must be chan"ed to a
dot! As an eample, the vhost drupa!+mysite+net ma/
have one primar/ drupal server at the HCBI1A9;_GCC;
location, but a second site ma/ be"in at
HCBI1A9;_GCC;.a!tserver! 6or this case, the
confi"uration file 2ould be +.
sites.drupa!+mysite+net+a!tserver.settings+php
,ithin that confi"uration file, the most common and
minimal option is to set the $d_ur! that specifies the
host, database and lo"in for the Drupal tables, as 2ell as
the WbaseNurl! -ut /ou can also include assi"nments to
Drupal Handbook: 20 April 2005 1$2
override an/thin" in the R<G8<M=A: table! This allo2s /ou
to redefine the theme, the site footer and contact email,
blocks per+pa"e limits, even the name /ou use for
anonymous!
Drupal "Ds
,hen usin" multiple drupal servers on the same
hard2are, each ne2 confi"uration 2ill result in a ne2 host
component for the usernameS<i&host<.i& Drupal lo"in 9D
4used 2hen lo""in" into a forei"n Drupal server5! 6or
eample, if /ou have a director/ partitioned host at
drupa!+mysite+net.a!tserver /our usename to lo"in to
some other Drupal server 2ould be
I:A9<1ASdrupa!+mysite+net.a!tserver!
8ultiple directories
Drupal allo2s /ou to setup multiple drupal sites usin"
different directories on top of one ph/sical source tree!
This mi"ht be useful if /ou 2ant to setup multiple sites
about different topics 4e!"! http:JJ/ourdomain!comJtravelJ
and http:JJ/ourdomain!comJsportJ5 or if /ou 2ant to
provide users on /our s/stem 2ith a personal drupal site
4e!"! http:JJ/ourdomain!comJlFoeJ and
http:JJ/ourdomain!comJlFohnJ5! ,hen usin" 'niJ0inu as
/our host operatin" s/stem, this can be best accomplished
b/ usin" s/mbolic links:
$ !s 3! inc!udes.F+php
3r/3r/3r33 1 drupa! drupa!
inc!udes.yourdomain+com+[2oe+php
.nce /ou created the confi"uration file, create a fake
director/ usin" s/mbolic links that matches the 'C9! 6or a
drupal site 2ith 'C9 http:JJ/ourdomain!comJlFoeJ use:
$ !n 3s + [2oe
9f /ou 2ant 1oe to be able to confi"ure his o2n drupal site,
create another s/mbolic link to make the confi"uration file
includesJ/ourdomain!com!lFoe!php available to 1oe in his
home director/:
$ !n 3s .path3to3drupa!.inc!udes.yourdomain+com+[2oe+php .
home.2oe.
Drupal Handbook: 20 April 2005 1$7
8ultiple domains or /hosts
8ultiple domains or /hosts using different
databases
Apache supports both 9)+ and name+based virtual hosts
4vhosts5! ,hile runnin" more than one en"ine 4b/ usin"
vhosts5 can be ver/ useful for development and testin"
purpose, it mi"ht even be more interestin" for hostin"
companies! Therefore, 2e tried to support vhosts in the
best possible 2a/ in order to make the life of an/
administrator easier! ,e do so b/ makin" it possible to run
an unlimited amount of vhosts on the same ph/sical source
tree, thou"h b/ usin" different confi"uration files!
<oreover, /ou can setup multiple confi"uration files in
/our includes+director/!
$ !s 3! sites.F.F+php
3r/3r/3r33 1 drupa! drupa!
sites.///+yourdomain1+com.settings+php
3r/3r/3r33 1 drupa! drupa!
sites.///+yourdomain,+com.settings+php
The onl/ thin" left to be done is to setup the
correspondin" vhosts in /our Apache confi"uration file!
;ote that the DocumentCoot points to the same source
tree t2ice:
9ameRirtua!Eost 1,X+?+?+1
HocumentGoot .home.///.drupa!
:erver9ame ///+yourdomain1+com
HocumentGoot .home.///.drupa!
:erver9ame ///+yourdomain,+com
Cemember that as of Drupal $!%, /ou can have site specific
modules and themes as 2ell! 1ust create a director/ under
the sitesJ222!/ourdomain1!com called DmodulesD and
place the site specific modules! The same applies to
themes as 2ell!
(onsult the 9;*TA00!tt that came 2ith /our Drupal
Drupal Handbook: 20 April 2005 1$$
installation for more details!
8ultiple domains using the same database
9f /ou 2ant to host multiple domains 4or subdomains5 on
top of the same database 4e!"! http:JJ/ourdomain!comJ and
http:JJ222!/ourdomain!comJ5, simpl/ use s/mbolic links to
setup the reIuired confi"uration files:
$ !n 3s sites.yourdomain+com sites.///+yourdomain+com
$ !s 3! sites
3r/3r/3r33 1 drupa! drupa! sites.yourdomain+com
!r/$r/$rr$ 1 drupa! drupa!
sites.///+yourdomain+com 3& sites.yourdomain+com
9f /our installation isnDt in the root folder then /ou need to
specif/ the path to the Drupal installation! 6or eample if
the 'C0 to /our installation is
http:JJ222!eample!comJdrupalJ /ou 2ould use
sitesJ222!eample!com!drupal 2ith a settin"s!php file in
it!
9f /ou 2ant cookies to be shared bet2een t2o sites, /ou
2ill need to set the value of )H)Ds session!cookieNdomain
correctl/! 9n the case above, set it to G!/ourdomain!comG!
Kou can do this throu"h DrupalDs !htaccess file!
Tuning your ser/er for optimal Drupal
performance
There is Iuite a lot of tunin" that can be done to /our 2eb
server and its supportin" soft2are to increase the ultimate
performance of Drupal! This document is an attempt to
compile into one place the man/ tunin" tips that have
proven beneficial to other Drupal users!
9f /ou have somethin" /ou can add, b/ all means please
doL
Tuning P4P
9f /ou have ()' c/cles to spare, or if band2idth is a
more constrained resource than ()' c/cles, /ou can
add the follo2in" to php!ini:
Drupal Handbook: 20 April 2005 1$5
outputNhandler ` obN"=handler
A comment in php!ini eplains:
GKou can redirect all of the output of /our
scripts to a function! 6or eample, if /ou set
outputNhandler to DobN"=handlerD, output
2ill be transparentl/ compressed for
bro2sers that support "=ip or deflate
encodin"! *ettin" an output handler
automaticall/ turns on output bufferin"!G
This functionalit/ is further described here!
ver/ interestin" presentation from a )H) developer
Additional resources:
)H) )roFect )a"e
P4P Caches
)H) is a scriptin" lan"ua"e! Hach time a )H) script is run
to "enerate a 2ebpa"e 2ith Drupal, /our 2eb server must
compile the )H) script into an eecutable format! This
results in an obvious amount of overhead each time a pa"e
is "enerated!
A )H) cache can be installed to save and re+use compiled
)H) scripts, thus "reatl/ reducin" the amount of overhead
reIuired for Drupal to displa/ a 2eb pa"e!
There are a number of )H) caches 4aka accelerators5
available, includin":
Turck <<(ache
)H) Accelerator
Alternative )H) (ache 4A)(5
After -urner
eend Accelerator
eAccelerator
Turck 88Cache
The Turck <<(ache has been confirmed to 2ork 2ell
2ith Drupal! 9nstallation is Iuite simple, resultin" in a
Iuick and noticeable performance increase!
Drupal Handbook: 20 April 2005 1$%
Deriew:
Accordin" to the proFectDs home pa"e:
GTurck <<(ache is a free open source )H)
accelerator, optimi=er, encoder and d/namic
content cache for )H)! 9t increases performance
of )H) scripts b/ cachin" them in compiled state,
so that the overhead of compilin" is almost
completel/ eliminated! Also it uses some
optimi=ations to speed up eecution of )H)
scripts! Turck <<(ache t/picall/ reduces server
load and increases the speed of /our )H) code
b/ 1+10 times!G
Compatibility:
The Turck <<(ache runs on 0inu and ,indo2s, 2orkin"
2ith Apache 1!7 and Apache 2!0, compatible 2ith )H) $!1
and later!
The follo2in" versions of <<(ache have been tested
successfull/ 2ith Drupal $!1X: 2!7!15, 2!7!27, 2!$!%!
5nstallation:
*tep+b/+step installation instructions can be found here!
.nce properl/ installed, /ou should immediatel/ notice an
improvement!
C14 4tili>ation:
The sar utilit/ from the s/sstat collection "athers s/stem
activit/ numbers over time! The follo2in" sar snapshot
taken from a dedicated Drupal server sho2s ho2 the
installation of <<(ache can help reduce s/stem load on
even a heavil/+optimi=ed 2eb server 4<<(ache 2as
installed around 12:00)<5:
11%??%?? <1 BKI \user \nice \system
\id!e
11%1?%?? <1 a!! @+X1 ?+?? 1+>6
Y5+55
11%,?%?? <1 a!! @+>- ?+?? ?+6?
Y6+-5
11%@?%?? <1 a!! 5+5Y ?+?? ?+@@
Y6+1>
11%5?%?? <1 a!! 5+?6 ?+?? ?+@-
Y6+6>
11%6?%?? <1 a!! @+X- ?+?? ?+@-
Y6+>>
1,%??%?? K1 a!! @+@> ?+?? ?+6,
Y-+11
1,%1?%?? K1 a!! ?+6, ?+?? ?+1?
Drupal Handbook: 20 April 2005 1$?
YY+@>
1,%,?%?? K1 a!! ?+XY ?+?? ?+,?
YY+?1
1,%@?%?? K1 a!! ?+6X ?+?? ?+1,
YY+@1
1,%5?%?? K1 a!! ?+6Y ?+?? ?+1,
YY+,Y
1,%6?%?? K1 a!! ?+55 ?+?? ?+11
YY+56
Troubleshooting:
An eas/ 2a/ to tell if <<(ache is 2orkin" properl/ after
follo2in" the installation instructions is to see if temporar/
files are bein" created in DJtmpJmmcacheD, or 2herever /ou
told them to be 2ritten 2ith the Dmmcache!cacheNdirD
directive! 9f no files are appearin", somethin" is 2ron"!
6irst, be sure that )H) has properl/ loaded mmcache!
(reate a short script on /our 2eb bro2ser called
Dphpinfo!phpD as follo2s:
<?php
phpinfo();
?&
0oad that file in /our bro2ser to find a 2ealth of useful
information! *earch for an/ occurances of the 2ord
D<<(acheD! 9f itDs not there, then <<(ache is not loaded!
Double check /our D(onfi"uration 6ile 4php!ini5 )athD on
that same pa"e, and be sure that /ou modified the correct
Dphp!iniD file! :erif/ that /ou installed Dmmcache!soD into
the director/ specified b/ the DetensionNdirD directive!
Also, tr/ restartin" /our 2eb bro2ser to be sure the latest
confi"uration chan"es have been made! 6inall/, be sure to
look in /our 2eb serverDs error lo" to see if there are an/
hints there! 4;ote that the phpinfo45 function call reveals a
NlotN of information about /our s/stem! 6or securit/
reasons it is ver/ un2ise to make this information
available to the "eneral public! 9f /ou created
Dphpinfo!phpD in a public place, be sure to remove it 2hen
/ouDre finished troubleshootin"!5
Additional resources:
Turck <<(ache Home )a"e
Drupal Handbook: 20 April 2005 1$&
Configuration
Drupal is an etremel/ fleible platform that provides /ou
2ith man/ options for chan"in" ho2 /our site looks, ho2
users interact 2ith it, and the kinds of information /ou
2ish to displa/! Althou"h there are man/ confi"uration
options, Drupal 2orks 2ell Gout of the boG and there is
ver/ little initial confi"uration to perform! As /our site
evolves and /our demands "ro2, Drupal makes it eas/ for
/ou to dramaticall/ alter its look and add to its
functionalit/! -est of all, because it is released under the
#;' )ublic 0icense, Drupal is infinitel/ customi=able and
lets /ou tailor it to /our specific needs!
"nitial configuration
Changing Drupal:s basic settings
DrupalDs basic settin"s can be found on the administer jh
settin"s pa"e! Kou must be lo""ed in and have permission
to access this pa"e! After /ou chan"e the settin"s, donDt
for"et to click G*ave confi"urationG at the bottom of the
pa"e!
The information /ou enter here "ets stored in DrupalDs
database to help Drupal decide ho2 to prepare and serve
/our pa"es! >eep in mind that the settin"s on this pa"e
are onl/ basic confi"uration settin"s! There are man/
other places to confi"ure Drupal and those are discussed
in the appropriate sections of this handbook!
A lot of the information /ou are asked to supppl/ here is
self+eplanator/ and there are brief help messa"es belo2
each settin" to "uide /ou! ;ote that the G*lo"an,G
G<ission,G and G6ooter messa"eG ma/ or ma/ not be
immediatel/ visible or used b/ /our site! 9f /ou are ne2 to
Drupal, 2e recommend suppl/in" all the information for
these boes! 9f /ou decide that /ou donDt need or like ho2
Drupal uses them, /ou can chan"e it later 4see the
handbook section on confi"urin" themes for more on this5!
ee the links belo* for further guidance
-elo2 are links to provide /ou 2ith eplanations and tips
Drupal Handbook: 20 April 2005 1$3
for some of the more technical settin"s on the Gsettin"sG
pa"e! 9f /ou Fust 2ant to "et Drupal up and runnin", /ou
can safel/ i"nore these settin"s! KouDll al2a/s be able to
come back and eperiment 2ith them later! The one
possible eception to this is the Gfile s/stem settin"sG
2hich /ou ma/ 2ish to set no2! 6or more information on
the G6ile s/stem settin"s,G click its link belo2! This link
can also help /ou resolve issues 2ith errors that often
appear at the top of the Gsettin"sG pa"e after Drupal is
freshl/ installed!
Anonymous user
'sers 2ho interact 2ith /our site 2ithout bein" lo""ed in
are labeled as GAnon/mousG b/ default! Drupal "ives /ou
the option to chan"e this to somethin" different 4e!"!
GAnon/mous co2ardG5! The name /ou "ive anon/mous
users is used b/ Drupal 2hen creatin" b/lines for posts
2hich t/picall/ reads somethin" like, G)osted b/
Anon/mous on 1anuar/ 1, 200%G!
Default front page
This settin" "ives /ou control 2hat Drupal+"enerated
content a user sees 2hen the/ visit /our Drupal
installationDs root director/! 6or eample, /ou mi"ht have
created a node 2ith a lar"e collection of links to act as a
table of contents to the different sections of /our site and
/ou 2ant this director/ to be 2hat users see first!
This settin" tells Drupal 2hich 'C0 users should be
redirected to! 9tDs important to note that the 'C0 is
relative to the director/ /our Drupal installation is in! *o,
instead of Ghttp:JJ222!/oursitename!comJnodeJ&7G or
Ghttp:JJ222!/oursitename!comJdrupalNinstallationNdirecto
r/JnodeJ&7,G /ou need onl/ t/pe GnodeJ&7G! 6or those not
usin" clean 'C0s, note that there is no need to t/pe in
GEI`G before t/pin" the 'C0!
-/ default, the GDefault front pa"eG is set to Gnode,G 2hich
simpl/ displa/s articles that have been G)romoted to front
pa"e!G ;ote that 2hen /ou chan"e the GDefault front pa"eG
to somethin" other than GnodeG, nodes that are G)romoted
to front pa"eG 2ill no lon"er appear on the front pa"e!
Drupal Handbook: 20 April 2005 150
The/ can ho2ever, still be vie2ed b/ visitin" the relative
'C0 path GnodeG!
9f /ou enter a value in here that is not a valid Drupal path,
the user 2ill be confronted 2ith a G)a"e not foundG error!
Kou cannot redirect users to an/ 2eb documents 4e!"! a
static HT<0 pa"e5 not created b/ /our Drupal site!
C-amples0
1roblem ': Kou 2ant a particular node to be the first
pa"e userDs see 2hen the visit http:JJ222!/oursite!com
42e are assumin" Drupal is installed in the siteDs root
director/5!
!olution: Determine the id number of the node /ou 2ish
to have Drupal redirect users to! .ne 2a/ to determine the
nodeDs id number is to visit the node and look at the
number after the last slash in /our bro2serDs address bar!
This is /our nodeDs id number! ;o2 set the GDefault front
pa"eG to GnodeJidkG! *o, assumin" /our nodeDs id is G&7,G
/ou 2ould t/pe GnodeJ&7G!
1roblem E: Kou 2ant user blo"s to be the front pa"e!
!olution: *et the GDefault front pa"eG to Gblo"G!
1roblem F: Kou 2ant content from a sin"le cate"or/ to
appear on the front pa"e
!olution: Determine the cate"or/Ds id number! Kou can
determine the id number b/ "oin" to administer jh
cate"ories! Coll the mouse on top of the Gedit termG link
net to the cate"or/ to reveal the 'C0 in /our bro2serDs
status bar 4usuall/ located at the bottom of /our bro2serDs
2indo25! The number after the last slash in the 'C0 is the
cate"or/Ds id number! ;o2 set the GDefault front pa"eG to
Gtaonom/JtermJidkG! 9f /our cate"or/Ds id number is G5G
for eample, /ouDd 2rite Gtaonom/JtermJ5G!
Clean U$,s
-/ default, Drupal passes path ar"uments to itself in the
strin" of the 'C0! This results in 'C0s that look like the
follo2in": Ghttp:JJ222!/ourdrupalsite!comJEI`nodeJ&7!G
;otice the rather unsi"htl/ GEI`G in there! .ther than
bein" a bit u"l/ and hard to read, it also stops man/
Drupal Handbook: 20 April 2005 151
search en"ines from indein" /our site!
-/ enablin" clean 'C0s, /ou 2ill be able to "et rid of the
GEI`G in the 'C0 and make it Gclean!G ;ote that this 2orks
onl/ for Apache servers 2hich have modNre2rite installed!
Talk to /our 2eb host or consult the Apache
documentation for more information!
Crror handling and reporting
Crror pages
DrupalDs pa"e error messa"es are meant to be direct and
to the point! 9f /ou 2ant pa"e error messa"es that are a
little more user+friendl/, Drupal allo2s /ou to customi=e
them! 1ust follo2 these steps:
(reate t2o nodes, one for each kind of pa"e error
4$07 and $0$5!
Determine the id number of the node /ou 2ish to
have Drupal redirect users to! .ne 2a/ to determine
the nodeDs id number is to visit the node and look at
the number after the last slash in /our bro2serDs
address bar! This is /our nodeDs id number!
;o2 enter the paths to /our nodes into the
appropriate boes! 6or eample, if the node id
number for $07 error codes is G&7,G /ou 2ould t/pe
GnodeJ&7G into the GDefault $07 4access denied5
pa"eG settin"!
Crror reporting
9f /our site is activel/ servin" pa"es on the 9nternet to
users /ou ma/ not trust, itDs 2ise to set error reportin" to
G,rite errors to the lo"G! ,hile this ma/ make bu"s and
errors a little harder to catch, it makes /our site more
secure b/ hidin" valuable information about /our site from
potential hackers!
Kou can tell Drupal to automaticall/ discard error lo"
entries older than the a"e /ou specif/! This reIuires a
crontab to be set up! *ee the discussion about crontabDs
else2here in this handbook!
Drupal Handbook: 20 April 2005 152
Cache support
-us/ Drupal sites ma/ 2ant to consider cachin" their
pa"es to li"hten the load on their server and speed up
pa"e "eneration times!
4o* Drupal:s cache *orks
Hver/ time /ou visit a Drupal pa"e, Drupal makes do=es of
Iueries 4perhaps even hundreds on sites 2ith man/
modules installed or 2ith lots of content on a pa"e5 to the
database to pull out the data and code needed to "enerate
the HT<0 2hich makes up a Drupal 2eb pa"e! That
means ever/ pa"e Drupal creates uses a relativel/ lar"e
amount of /our serverDs processin" po2er! 'suall/, /ou
donDt notice all the 2ork Drupal does because computers
are ver/ fast and Drupal is ver/ efficient! Ho2ever, ver/
bus/ sites 2ith man/ hundreds or thousands of pa"e vie2s
per minute ma/ start to slo2in" thin"s to a cra2l! This is
because the 2eb server is havin" a ver/ hard time makin"
all the reIuired database Iueries it needs to make in order
to keep 2ith all the pa"e reIuests! -/ enablin" DrupalDs
cache, /ou can si"nificantl/ reduce the load on /our server
b/ reducin" the number of database Iueries reIuired to
create a pa"e!
,ith the cache turned on, Drupal stores all the HT<0
code for an/ pa"e visited b/ an anon/mous user directl/
into the database! Then, 2hen another anon/mous user
comes alon" later and reIuests the same pa"e, Drupal
remembers that this pa"e has alread/ been reIuested and
pulls the cahced pa"e back out of the database! The end
result is that hundreds of Iueries "et replaced 2ith one
sin"le Iuer/, thereb/ si"nificantl/ li"htenin" the load on
/our 2eb server!
3ile system settings
Drupal provides some confi"uration settin"s for dealin"
2ith /our serverDs file s/stem so that userDs and
administrators can upload files to the server for use b/
Drupal!
Drupal Handbook: 20 April 2005 157
Path settings
3ile system path
-/ default, this is set to GfilesG! ,e recommend leavin" this
settin" alone!
Temporary directory
-/ default this is set to GJtmpG 2hich is the temporar/
director/ common in #;'J0inu distributions! 9f /ou are
usin" a ,indo2s or other kind of server, 2e recommend
settin" it to GtmpG 4no slash5! Drupal 2ill automaticall/
create the temporar/ director/ as a subdirecto/ of the
G6ile s/stem path!G
Do*nload method
There are t2o possible GDo2nload methodG settin"s:
G)ublicG and G)rivateG!
!et to G1ublicG if:
Kou donDt care if an/ user, even anon/mous users, can
do2nload the files uploaded b/ other users!
!et to G1riateG if:
Kou 2ish to restrict the abilit/ of some users to do2nload
files uploaded b/ other users!
;otice the 2arnin" on the belo2 this settin" 2hich reads
GKou can chan"e this at an/ time, ho2ever all do2nload
'C0s 2ill chan"e and there ma/ be unepected problems
so it is not recommended!G To avoid problems like this in
the future, 2e recommend settin" the GDo2nload methodG
to G)rivateG since this still allo2s /ou to let all users
do2nload an/ file until /ou instruct Drupal other2ise!
Dealing *ith error messages
;e2 Drupal installations freIuentl/ displa/ one or more
red error messa"e at the top of the Gsettin"sG pa"e! This
means that either the GTemporar/ director/G or G6ile
s/stem pathG directories needed b/ Drupal to upload files
does not eist andJor its permissions are not set properl/!
*impl/ create these directories and set their permissions
so that Drupal can 2rite and read from the director/!
9f /ou are unsure about 2here or ho2 to create these
directories or ho2 to chan"e their permissions, contact
Drupal Handbook: 20 April 2005 15$
/our 2eb hostin" service for further assistance!
Date and time settings
Drupal allo2s /ou to confi"ure ho2 dates and times are
formatted and displa/ed! ,hen makin" the format
settin"s, /ou should probabl/ consider the culture of /our
tar"et audience! -elo2 are su""ested confi"urations for
the GDefault time =oneG and G(onfi"urable time =onesG
options!
3or sites where most users lie in a small geographic
region:
*et the GDefault time =oneG to the time =one of the re"ion
and disable confi"urable time =ones!
3or sites where most users lie a region that spans a
few time >ones:
*et the GDefault time =oneG to the time =one usuall/
considered to be the GstandardG time =one and disable
confi"urable time =ones! 6or eample, in the 'nited
*tates, /ouDd set /our siteDs time to the time=one that
corresponds to Hastern *tandard Time!
3or sites where users are li#ely to be scattered
across the globe:
*et the GDefault time =oneG to the time =one to #<T
4X00005 and enable confi"urable time =ones!
Customi)ing the interface
,hen launchin" a ne2 drupal site, here are some thin"s
/ou can do to personali=e the desi"n and architecture of
/our drupal site!
Choose a Theme!
The look and feel of Drupal is primaril/ controlled b/
the theme /ou have applied to /our site! A site can
even have multiple themes! A "ood first step is to "o
to administer _ themes and set a ne2 theme as /our
default! Kou can find more themes on the do2nload
pa"e after the list of modules! .nce /ou do2nload a
ne2 theme /ou 2ill need to install it on /our s/stem!
Create your own Theme!
Drupal Handbook: 20 April 2005 155
<an/ Drupal sites 2ill need a more uniIue look than
these pre+built themes can offer! Therefore, man/
developers 2ill 2ant to 2rite their o2n themes!
Theme development reIuires a 2orkin" kno2led"e
of HT<0J(** and possibl/ some rudimentar/ )H)
dependin" on the compleit/ of /our theme!
Customi>e the /aigation!
The menus that are displa/ed on the top and bottom
of the pa"e are confi"ured in administer _ themes!
*elect the confi"ure tab and scroll do2n to <enu
*ettin"s! The primar/ and secondar/ links can be
defined here, usin" strai"ht HT<0! 9f the primar/
links are left blank /our navi"ation 2ill be created
based on /our installed modules!
Hach theme has an individual confi"uration pa"e
4listed at the top of the "lobal settin"s pa"e5 as 2ell!
'nfortunatel/, if /ou are usin" a theme that uses the
)H)Template theme en"ine, then /our navi"ation
must be defined in that themeDs individual theme
area 4see : primar/ and secondar/ link functionalit/
is retarded5!
Customi>e Te0t !trings
Kou can also chan"e the tet strin"s throu"hout
drupal usin" the locale feature, 2hich 2as desi"ned
for runnin" drupal in different lan"ua"es, /ou can
personali=e almost all of the tet in drupal!
9n fact, /ou can replace a strin" like Gcreate blo"
entr/G 2ith html markup such as references to
"raphics!
Customi)ing user login
9n the default setup the Drupal lo"in block is al2a/s
displa/ed unless a user is lo""ed in! Here are some
alternative 2a/s of allo2in" contributors and
administrators to lo"in to /ou site!
Disable ,ogin &lock
9t 2ill not al2a/s be desirable to displa/ a lo"in block on
/our Drupal site! 9f /ou are usin" Drupal to create a site
Drupal Handbook: 20 April 2005 15%
that has a ver/ limited number of people actuall/ lo""in"
into the s/stem to create or edit content, then /ou
probabl/ donDt 2ant a lar"e portion of /our screen real+
estate taken up 2ith a lo"in block that doesnDt relate to
them! This also confuses the bulk of /our users that 2ill
not have the option to lo"in!
To disable the lo"in block
#oto the block confi"uration 4 administer jh blocks 5
Deselect the check bo for 'ser lo"in in the Hnabled
column
Kour re"ular content editors and administrators can still
lo"in to the site b/ directl/ accessin" the lo"in pa"e,
http:JJ222!eample!comJuser!
Kou can also create more customi=ed lo"in blocks!
Congestion control0 tuning the auto%
throttle
Deriew:
This pa"e 2ill be of most benefit to Drupal users that have
their 2ebsites hosted on a shared server! ,hen /ou have
little or no control over ho2 /our 2ebserver is tuned, it
can be etremel/ difficult to prepare for unepected loads,
such as a link from *lashdot! The steps belo2 describe
DrupalDs built in con"estion control mechanism, the auto+
throttle, and 2alks /ou throu"h its confi"uration!
)lease note: if /ou have complete control over the server
thatDs hostin" /our 2ebsite, /ou should tune the operatin"
s/stem, database, 2ebserver, and )H) for optimal stabilit/
and speed!
Tuning the auto-throttle:
,nable the Drupal cache:
.ne of the most dramatic performance
improvements /ou can make 2ith Drupal is b/
enablin" cache support! This "reatl/ reduces the
overhead associated 2ith displa/in" a pa"e to an
anon/mous "uest! To enable the cache, "o to /our
siteDs main confi"uration pa"e at Gadminister _
confi"urationG and check GHnabledG under the 2ords
G(ache support:G, then click G*ave confi"uration!
Drupal Handbook: 20 April 2005 15?
,nable the statistics module:
To use the auto+throttle, /ou 2ill first need to enable
the statistics module! This can be found on /our site
at Gadminister _ confi"uration _ modulesG! )ut a
check mark in the status column, and click D*ave
confi"urationD!
,nable the access log:
,ith the statistics!module enabled, /ou no2 must
enable the access lo"! The access lo" 2rites an entr/
in a database table ever/ time /our site serves a
pa"e! The auto+throttle utili=es this information to
monitor ho2 much traffic is hittin" /our site!
To enable the access lo", "o to Gadminister _
confi"uration _ modules _ statisticsG on /our site,
and click GHnabledG under the 2ords GHnable access
lo":G! 9t is not important ho2 lon" /ou retain access
lo"s, so if /ou are onl/ usin" this information for the
auto+throttle and 2ant to keep /our database as
small as possible, /ou can safel/ adFust this all the
2a/ do2n to 1 hour! ,hen finished, click G*ave
confi"urationG!
,nable the throttle module:
;o2 /ou need to enable the throttle module! Ceturn
to the module administration pa"e on /our site at
Gadminister _ confi"uration _ modulesG and put a
check mark in the status column, then click D*ave
confi"urationD!
,nable the Gthrottle statusG bloc#:
9n order to properl/ tune the auto+throttle on /our
2ebsite, 2e need to have an understandin" of ho2
much traffic /our site "ets! The throttle module
provides a block for this purpose! #o to the block
administration pa"e on /our site at Gadminister _
confi"uration _ blocksG, and enable the GThrottle
statusG block! 6or this eample, do not check
GcustomG or GthrottleG, but feel free to adFust the
G2ei"htG and Gre"ionG for 2hatever /ou prefer! ;o2
click G*ave blocksG!
Configure Gthrottle statusG bloc# access
permissions:
9t is not desirable to allo2 /our siteDs users to vie2
Drupal Handbook: 20 April 2005 15&
the Gthrottle statusG block that 2e have Fust enabled!
This block is onl/ intended as an administrative tool!
9f /ou are the onl/ administrator of /our site, and
/ou administer /our site as uid`1, then /ou donDt
need to set up an/ permissions ++ b/ default, uid`1
has all permissions! Ho2ever, if /ou have multiple
administrators or administer /our site 2ith a
different user account, /ou 2ill need to "ive /our
administrative "roup the Gaccess throttle boG
permission!
#o to the user permission administration pa"e on
/our site at Gadminister _ accounts _ permissionsG
and locate the Gaccess user listG permission! )lace a
check mark in the appropriate roleDs column and
click G*ave permissionsG! 9t is important to be a2are
that all users that are in this role 2ill no2 see the
Gthrottle statusG block, as there is some overhead
involved in displa/in" this block in the form of 1
database Iuer/ per pa"e displa/ed!
,nable the auto-throttle:
,hen /ou reload /our 2ebsite, /ou should no2 see
the GThrottle statusG block! All it sa/s at this point is
GThrottle: disabledG, meanin" that currentl/ the
auto+throttle is not turned on!
The auto throttle can be enabled on the throttle
module administration pa"e at Gadminister _
confi"uration _ modules _ throttleG! Kou can Iuickl/
find this pa"e b/ clickin" the 2ord GdisabledG 2ithin
/our GThrottle statusG block! .n the resultin"
administration pa"e, click GenabledG underneath the
2ords GHnable auto+throttleG, and click G*ave
confi"urationG!
$onitoring the GThrottle statusG bloc#:
Kou should no2 notice that there is more information
displa/ed in the GThrottle statusG block! The onl/
thin" 2eDre interested in at this time is the bottom
section that should read somethin" like, GThis site
has served 17 pa"es in the past minute!G This means
eactl/ 2hat it sa/s: durin" the past %0 seconds,
/our Drupal+po2ered 2ebsite has served 17 pa"es to
visitors of /our site! This includes all pa"es that have
been served, includin" pa"es vie2ed b/ /ourself,
Drupal Handbook: 20 April 2005 153
re"istered users, anon/mous "uests, C** clients,
search en"ine spidersJbots, and cron!
To properl/ tune the auto+throttle, /ou 2ill need to
monitor this block carefull/, "ettin" a "ood feel for
ho2 bus/ /our site is on avera"e! 9n particular, /ou
2ant to kno2 ho2 bus/ /our site is on avera"e at the
busiest time of each da/! 9n our eample, 2e 2ill
assume that /our site is servin" bet2een 10+12
pa"es a minute 2hen it is bus/! ,e 2ill no2 use this
information to tune our throttle!
Tuning the auto-throttle:
.nce a"ain return to the throttle module
administration pa"e at Gadminister _ confi"uration
_ modules _ throttleG! 4A Iuick shortcut is to click
on the 2ord GenabledG 2ithin /our GThrottle statusG
block!5 ,e 2ill no2 adFust the t2o options 2ithin the
GAuto+throttle+tunin"G section of this pa"e!
The first option is the GAuto+throttle multiplierG! 9t is
"enerall/ a "ood idea to set /our auto+throttle
multiplier to a number nearest ho2 man/ pa"es /our
site serves on avera"e 2hen it is bus/! 9n our
eample, this 2as 12, so 2e 2ill set the auto+throttle
multiplier to G12 40,12,2$,7%,$&,%05G! Hach of the
numbers in the parenthesis is a Gthrottle levelG, 2ith
0 bein" level 0, 12 bein" level 1, 2$ bein" level 2,
and so on up to %0 bein" 5! Hach of these numbers is
a multiple of the number 12 that 2e have selected!
,hen our site starts servin" 12 pa"es a minute, the
auto+throttle 2ill adFust itself to be at level 1! *hould
the site become t2ice as bus/ as normal and start
servin" 2$ pa"es in a minute, 2e move up to level 2!
This continues until /our site is servin" more than 5
times a normal load 41 pa"e per second5, at 2hich
time the auto+throttle level 2ill be set to 5!
The second option is the GAuto+throttle probabilit/
limiterG! This fancil/ named confi"uration option is
used to minimi=e the overhead of usin" the auto+
throttle! Kou see, to calculate the current throttle
level this module has to perform a database Iuer/!
Ho2ever, it turns out that one of the primar/
bottlenecks on a shared server is the database, so
database Iueries are considered epensive! Thus, 2e
Drupal Handbook: 20 April 2005 1%0
adFust the Gprobabilit/ limiterG so that 2e perform
our etra database Iuer/ on onl/ a certain
percenta"e of pa"e vie2s! 9f /ou set this value to
10a, then 2e onl/ perform the etra database Iuer/
for approimatel/ 1 out of ever/ 10 pa"es displa/ed
b/ /our Drupal+po2ered site! 9t is unlikel/ /ouDd
2ant to set this to an/thin" hi"her than 10a,
ho2ever for bus/ sites /ou ma/ 2ish to set it lo2er!
-e a2are that the lo2er /ou set this value, the
lon"er /our auto+throttle 2ill take to detect a sur"e
in load!
Auto-throttling bloc#s:
9n Drupal $!$ and hi"her 4or the latest (:* version5,
it is possible to confi"ure blocks to be automaticall/
disabled 2hen the auto+throttle reaches a maimum
level of 5, indicatin" that /our site is currentl/
eperiencin" a severe load! This could happen for a
number of reasons, such as a link from *lashdot, or
bein" indeed b/ sometimes over+a""ressive
"oo"lebots, or even an intentional Do* 4Denial of
*ervice5 attack! 'nder these heav/ loads, /ou ma/
find /our site chokin", usuall/ reportin" a </*M0
error sa/in" somethin" like GToo man/ connectionsG!
-/ automaticall/ disablin" blocks, the cost of
"eneratin" pa"es on /our site 2ill reIuire less
database Iueries and thus /our site 2ill be able to
better 2ithstand a "reater number of hits!
To throttle blocks "o to the block administration
pa"e on /our site at Gadminister _ confi"uration _
blocksG! ;o2, for an/ blocks that should be disabled
2hen /our site is under a severe load click the
GthrottleG checkbo! 9t is recommended that /ou
select nearl/ all boes, ecept perhaps G;avi"ationG
and G'ser lo"inG, as it 2ill be rare that the auto+
throttle actuall/ causes them to be temporaril/
disabled! 9f /ou have an especiall/ under+po2ered
2ebserver, /ou ma/ even 2ish to enable the throttle
for the G'ser lo"inG block so that users 2ill be
discoura"ed from lo""in" in under heav/ loads, as
each pa"e vie2ed b/ a user has to be d/namicall/
built rather than displa/in" them from the cache!
;o2, 2hen /our site comes under a heav/ load, all
Drupal Handbook: 20 April 2005 1%1
blocks that have GthrottleG enabled 2ill be
automaticall/ disabled! As lon" as /our site remains
under a severe load, the blocks 2ill remain disabled,
optimi=in" /our pa"e and helpin" to prevent /our
database from chokin"! ,hen the load starts to
decline, the blocks 2ill be automaticall/ restored!
Auto-throttling modules:
9n Drupal $!$ and hi"her 4or the latest (:* version5,
it is also possible to confi"ure entire modules to be
automaticall/ disabled 2hen the auto+throttle
reaches a maimum level of 5, once a"ain indicatin"
that /our site is currentl/ eperiencin" a severe
load!
To throttle modules, "o to the module administration
pa"e on /our site at Gadminister _ confi"uration _
modulesG! ;o2, for an/ module that should be
disabled 2hen /our site is under a severe load click
the GthrottleG checkbo! Decidin" 2hich modules to
throttle can be more difficult than decidin" 2hich
blocks to throttle! 9t is recommended that /ou
eperiment in /our development environment,
disablin" modules and seein" ho2 this affects /our
site! The more underpo2ered /our 2ebserver, the
more modules /ou 2ill 2ant to throttle! #enerall/
speakin", throttlin" modules 2ill usuall/ have a
lar"er affect than throttlin" blocks!
;o2, 2hen /our site comes under a heav/ load, all
modules that have GthrottleG enabled 2ill be
automaticall/ disabled! All aspects of the module 2ill
be disabled, includin" an/ links, pa"es andJor blocks
that the module ma/ have "enerated! As lon" as /our
site remains under a severe load, the modules 2ill
remain disabled, optimi=in" /our pa"e and helpin"
to prevent /our database from chokin"! ,hen the
load starts to decline, the modules 2ill be
automaticall/ restored!
Continuous auto-throttle tuning:
Kour site is no2 potentiall/ able to deal 2ith heavier
loads, ho2ever it is important to continue to monitor
the GThrottle statusG block to be sure /ou have
properl/ confi"ured /our site! 9n particular, 2atch
the G(urrent levelG field, and be sure that under an
Drupal Handbook: 20 April 2005 1%2
avera"e bus/ load /ouDre not "oin" above level 2! 9f
/ou are, then /ouDll probabl/ 2ant to "o back and
adFust the GAuto+throttle multiplierG to a hi"her value
as described earlier! .n the other hand, if /our site
is al2a/s sho2in" a G(urrent levelG of 0, then /ouDll
probabl/ 2ant to "o back and adFust the Auto+
throttle multiplierG to a lo2er value!
Also note that over time /our siteDs popularit/ ma/
chan"e! *o, 2hat 2as a perfect throttle settin" a fe2
months a"o ma/ be too hi"h or too lo2 this month!
!lashdottedH
Hven 2ith the auto+throttle enabled and confi"ured,
/ou ma/ find that /our server chokes 2hen an
etremel/ bus/ site such as *lashdot links to /our
site! 9t ma/ be that /our shared 2ebserver simpl/
canDt handle the load, ho2ever donDt "ive up too
Iuickl/! Here are a fe2 more tips:
Tr/ adFustin" the GAuto+throttle multiplierG to a
lo2er value so /our auto+throttle can detect a
sur"e sooner!
Tr/ adFustin" the GAuto+throttle probabilit/
limiterG to a hi"her percenta"e, a"ain so that
the auto+throttle is Iuicker to detect a sur"e! 9t
is not advised to increase this value much
be/ond 10a ho2ever, as this ma/ have a
ne"ative impact on /our siteDs performance!
Hnable GthrottleG for all but the absolutel/
essential blocks!
Hnable GthrottleG for all but the absolutel/
essential modules! 4this is perhaps the most
si"nificant su""estion5
Hack /our theme to be auto+throttle a2are,
automaticall/ disablin" lar"e ima"es 2hen
/our site comes under a heav/ load! Cefer to
the throttle!moduleDs GthrottleNstatus45G
function!
Talk to /our 2eb host about ho2 the/ can
better tune /our 2ebserver!!!
Drupal Handbook: 20 April 2005 1%7
Adding syndicated content 1ne*sfeeds+
$2 to your site
Drupal has the abilit/ to a""re"ate s/ndicated content
4e!"! rss feeds5 from multiple sources onto /our 2ebsites!
To learn more about this concept includin" such confusin"
terms as ne2sfeeds, rss, atom, and s/ndication, please
read Drupal as a ne2s a""re"ator for a more in+depth
description of these services!
Add a new newsfeed
To add a ne2sfeed or s/ndicated content to /our Drupal
site:
#oto the modules confi"uration pa"e 4administer _
modules5, and enable the a""re"ator module
.nce /ou have enabled the a""re"ator module /ou
2ill be able to "o to the a""re"ator confi"uration
pa"e 4administer _ a""re"ator5!
*elect the add feed tab!
Define the Title! This 2ill be the headin" of the
ne2sfeed throu"hout the site!
Define the 'C0 of the remote ne2s feed, such as
http:JJ222!eample!comJcoolne2sfeed!rss
*et the 'pdate interval! >eep in mind that some
ne2s feeds are starin" to instal throttlin" soft2are
that ma/ prevent /ou from accessin" their feeds too
often! .nl/ pull content as much as /ou actuall/
need to!
9f /ou 2ant the items for this ne2s feed to have a
block then /ou must chan"e the 0atest items block
selection from itDs default! The options control the
number of items displa/ed in this block! .nce /ou
have selected this option /ou must enable /our
ne2sfeed block in the blocks confi"uration pa"e
4administer _ blocks5
9f /ou leave the 0atest items block settin" at itDs
default /our users 2ill onl/ be able to access the
ne2s feeds throu"h the a""re"ator 'C0,
http:JJ222!eample!comJ/oursiteJa""re"ator or
http:JJ222!eample!comJ/oursiteJa""re"atorJsource
sJ1, 2here 1 is the number of the ne2sfeed /ou have
created!
Drupal Handbook: 20 April 2005 1%$
Configuring newsfeed display
;e2sfeeds can be displa/ed individuall/ as blocks on /our
site, 2ithin cate"ories 2hich are also listed as blocks, or
can be accessed throu"h either method throu"h the ne2s
a""re"ator link in the site navi"ation block!
5ndiidual display as bloc#s
This method is described in the setup above
Display of newsfeeds in category bloc#s
;e2sfeeds can be broken up into cate"ories! To
create a cate"or/:
#oto the ne2sfeed confi" pa"e 4administer _
a""re"ator5 and select the add cate"or/ tab!
)rovide a Title and Description!
To make ne2s feeds defined to this cate"or/
appear as a block select a number of items
from the 0atest items block pull+do2n!
Hnable this ne2 block on the block
confi"uration pa"e 4administer _ blocks 5, then
return to the ne2sfeed confi" pa"e 4administer
_ a""re"ator5!
,e 2ill no2 need to add one or more ne2s
feeds to this cate"or/! *elect the 0ist tab and
select the edit link in the ro2 of the ne2sfeed
item /ou 2ould like to add to this cate"or/!
'nder Automaticall/ file items select the
checkbo net to the cate"or/ /ou Fust created!
;o2 2hen ne2 ne2s items come in the/ 2ill
be displa/ed in the cate"or/ block! The po2er
of this feature is bein" able to brin" multiple
ne2s feeds to"ether under one cate"or/!
9f /ou alread/ have ne2s items updated on
/our site the cate"or/ 2ill not inde them! To
"et the old ne2s items into the ne2 cate"or/,
click the list tab, click remove items from the
ne2sfeed /ou 2ant, and then click update
items! This 2ill update the items and inde
them into /our ne2 cate"or/!
Display under news aggregator lin#
,hen /ou enable the a""re"ator module, drupal
creates a link in /our site navi"ation! 'nder this
section /our users can vie2 all individual ne2s feeds
Drupal Handbook: 20 April 2005 1%5
and ne2s feed cate"ories /ou have created!
Celevant 'C0s in this section are:
http:JJ222!eample!comJ/oursiteJa""re"ator +
ne2s a""re"ator home
http:JJ222!eample!comJ/oursiteJa""re"atorJs
ourcesJk + inde of individual ne2sfeeds 2here
the number indicates the particular feed
http:JJ222!eample!comJ/oursiteJa""re"atorJc
ate"oriesJk + inde of ne2sfeed cate"ories
2here the number indicates the cate"or/
9f /ou are lookin" for content, there are several sites that
provide an inde of ne2s feed services on the internet
includin":
*/ndic&
Kahoo C** 6eeds
Database table prefi- 1and sharing tables
across instances2
imple usage
*ome 2eb hosts limit their customers to one database!
Thus, no duplicate table names are possible! 9n order to
assure that these admins can still use Drupal, and even
use multiple installations of Drupal, Drupal offers table
prefiin"!
9n order to use this feature, /ou must currentl/ edit /our
databaseJdatabase! script in order to create tables
prefied b/ the strin" of /our choice! 6or eample, chan"e
all statements from the format of
BGA<;A ;<M=A access to BGA<;A ;<M=A dr1_access!
Then use dr1N 4for eample5 as value of WdbNprefi in /our
sites.e$amp!e+com.settings+php file!
Ad/anced usage
Table prefiin" ma/ be optionall/ applied to some tables
and not others! This has the effect that multiple Drupal
installations can share common tables! .ne interestin"
application for this is to share the taonom/ tables
Drupal Handbook: 20 April 2005 1%%
4vocabularies, termNdata5! Another interestin" use is to
share users across Drupal installations!
9n order to use this capabilit/, create t2o drupal installs in
same D- usin" different database prefies! 9n this
eample, one is prefied DmasterND and the other
DcontentNonl/ND! Then edit the conf!php file of
DcontentNonl/ND so that it points some tables to the
DmasterND! 6or sharin" users, add the follo2in":
$d_prefi$ = array(
*defau!t* =& *content_on!y_*'
*users* =& *master_*'
*sessions* =& *master_*'
*ro!e* =& *master_*'
*authmap* =& *master_*'
*se7uences* =& *master_*
);
uper ad/anced usage
Ztested onl/ on m/sIl so far[ 9t is possible to keep the
multiple Drupal installations in different databases but still
share common tables! To do this, specif/ the database
name as part of the prefi! 6or eample,
$d_prefi$ = array(
*defau!t* =& *content_on!y+*'
*users* =& *master+*'
*sessions* =& *master+*'
*ro!e* =& *master+*'
*authmap* =& *master+*'
*se7uences* =& *master+*
);
9n the eample above, contentNonl/ and master are
databases!
Tables that should not be shared
The follo2in" tables contain info that is hi"hl/ site specific
and should therefore not be shared:
cache
variable
Drupal Handbook: 20 April 2005 1%?
earch engine friendly and robots.t-t
Drupal b/ it self is ver/ search en"ine friendl/! 6or
eample it is not uncommon for drupal based sites to have
have a "oo"le rankin" of 5 4out of 105 or more 2here usin"
the same content on another (<* 2ould score much
lo2er!
*till, /ou can make drupal even more search en"ine
friendl/ b/ chan"in" some default parameters! .n this
pa"e /ou 2ill find severals 2a/s of t2eakin" /our drupal
instalation to make it more search en"ine friendl/!
6irst of all /ou mi"ht 2ant to enable friendl/ 'C0Ds
Then, make sure that /ou "et rid of the session 9D in
the 'C0 b/ chan"in" the !htaccess if /ou are on
$!5!! .n $!%, session 9Ds in 'C0 are disabled b/
default!
.ptional, use 'C0 aliasin" for all or some selective
nodes! Kou can use the pathauto module to
automaticall/ create aliases for ne2 nodes!
robots.t-t file
-/ default drupal does not ship 2ith a pointer file for the
search en"ines called Grobots!ttG! -/ addin" this file to
the root of /our 4virtual5 2ebserver, /ou can Iuide bots
t"hrou"h /our site or forbid indein" parts of /our site!
*ee for an eample the file for drupal!or" itself at
http:JJdrupal!or"Jrobots!tt!
9f /ou 2ant to have robots!tt file, please follo2 the
instructions belo2! 6or more details check
http:JJ222!robotstt!or"
(reate a file 2ith the content as sho2n belo2 and call this
file Grobots!ttG
0 sma!! roots+t$t
0 more information aout this fi!e can e found at
0 http%..///+rootst$t+org./c.roots+htm!
0 !ines eginning /ith the pund (*0*) sign are
comments and can e de!eted+
0 if case your drupa! site is in a directory
0 !o/er than your docroot (e+g+ .drupa!)
0 p!ease add this efore the .3es e!o/
0 to stop a po!ite root inde$ing an e$amp!edir
Drupal Handbook: 20 April 2005 1%&
0 add a !ine !i(e (de!te the 0's)
0 user3agent% po!ite3ot
0 Hisa!!o/% .e$amp!edir.
0 a !ist of (no/ ots can e found at
0
http%..///+rootst$t+org./c.active.htm!.inde$+htm!
0 see
http%..///+s$/+org+u(.computing.roots.chec(+htm!
0 for synta$ chec(ing
Iser3agent% F
Bra/!3He!ay% 1?
Hisa!!o/% .aggregator
Hisa!!o/% .trac(er
Hisa!!o/% .comment.rep!y
Hisa!!o/% .node.add
Hisa!!o/% .user
Hisa!!o/% .fi!es
Hisa!!o/% .search
Hisa!!o/% .oo(.print
This file 2ill sa/ to indein" robots, that the/ should "o to
director/Ds that are for users instead of robots! 6or
eample the search pa"e! Also it 2ill stop robots to "o to
the first step of addin" comments!
<an/ robots obe/ the G(ra2l+dela/:G parameter! *ince
drupal sites seem to be popular 2ith search en"ines and
lost of people have more a""resive bots than visitors at
their site, it mi"ht be 2ise to slo2 do2n the robots b/
addin" a robots!tt line like:
Iser3<gent% F
Bra/!3He!ay% 1?
410 is the time in seconds bet2een pa"e reIuests5
-oth G*lurpG 4The robot that is indein" for /ahoo and
alta:ista5 and the <icrosoft robots for the <*; sites obe/
this parameter! #oo"lebot does not use the Gcra2l+dela/G
parameter /et but 2ill most likel/ in a ne2 version of this
indein" robot!
(han"e the file as /ou 2ish and save it! ;o upload it to
/our 2ebserver and make sure it is in the root of the
4virtual5 2ebserver! 9f /ou have installed drupal in a
subdirector/ 4for eample Jdrupal5, than chan"e the 'C0Ds
in the robots!tt file but place the file in the root of the
2ebserver, not in the root of /our drupal instalation!
Drupal Handbook: 20 April 2005 1%3
;o2 2atch the robots visit /our site and after some time,
2atch /our lo" files 4Grefferrer lo"G5 to see ho2 man/
visitors cam from a search en"ine!
The tolerant &ase U$,
9nstead of usin" a hard coded domain as /our WbaseNurl in
the includesJconf!php file, /ou mi"ht 2ant to use
<?php
$ase_ur! = 'http' + ($_:AGRAG['E;;K:'" == 'on' ?
's' % '');
$ase_ur! += '%..' +$_:AGRAG['E;;K_EC:;'";
if ($dir = trim(dirname($_:AGRAG['KEK_:A=D'")'
'U'.')) {
$ase_ur! += *.$dir*;
)
?&
This has the advanta"e that 2hatever domain the user
used to "et to the site, he 2ill maintain throu"hout his
session!
Warning
Hmail notifcations ma/ be issued under the domain
2hich is used b/ the poster! 9f /ou access /our site
usin" http:JJlocalhost, /ou could send emails 2ith
that invalid 'C0! The onl/ module 2hich behaves
this 2a/ toda/ that 9 kno2 of is subscription!module
from (ontrib!
&locks
!hat are &locksA
-locks are the boes visible in the sidebar4s5 of /our 2eb
site! <odules "enerate most of the -locks that /ou 2ill see
4e!"! recent forum topics5, but /ou can also create /our
o2n blocks!
The sidebar each block appears in depends on both 2hich
theme /ouDre usin" 4some are left+onl/, some ri"ht, some
both5, and on the settin"s in block mana"ement!
Drupal Handbook: 20 April 2005 1?0
Configuring &locks
-locks are controlled from the block mana"ement screen
b/ clickin" administer jh blocks!
&lock 6isibility
,hether a block is visible in the first place depends on
four thin"s:
9t must have its GenabledG bo checked in block
mana"ement!
each block has custom visibilit/ settin"s, 2hich can
be seen b/ clickin" the Gconfi"ureG link net to each
block in block mana"ement! (ustom visibilit/ means
administrators can set it so that blocks appear
al2a/sR displa/ed but allo2 users to disable it, or
hidden but allo2 users to enable it!
2hether it appears on the section of the site as
confi"ured b/ the administrator b/ clickin" the
Gconfi"ureG link net to each block in block
administration!
2hether the block appears for the selected content
t/pe as determined b/ the administrator 4a"ain, b/
clickin" the Gconfi"ureG link net to each block in
block administration5!
if administrators have enabled the throttle module,
the block has its throttle bo checked, the user 2ill
onl/ see the block if the site throttle level is lo2!
!eight
The block mana"ement screen also lets /ou specif/ the
vertical sort+order of the blocks 2ithin a sidebar! Kou do
this b/ assi"nin" a 2ei"ht to each block! 0i"hter blocks
4smaller 2ei"ht5 Gfloat upG to2ards the top of the sidebar!
Heavier ones Gsink do2nG to2ards the bottom of it!
-elo2 those options, /ou 2ill see a lar"e tet bo! .n each
line, /ou can specif/ 2hich pa"es that block 2ill appear
onbYnor not appear on, dependin" one 2hat /ou selected
above!
The follo2in" are some annotated eamples! The/ all
assume that /ou choose the second option aboveR if /ou
Drupal Handbook: 20 April 2005 1?1
chose the first option, blocks 2ill appear on all pa"es
other than 2hat /ou specif/ belo2! KouDre 2elcome to add
more than one listin", each separated b/ lines! 4;ote that
/ou cannot specif/ pa"es on 2hich blocks appear as 2ell
as pa"es on 2hich blocks do not appear! 9t is either one or
the other!5
Vfront_ *pecifies that the block appears on the front pa"e!
nodeJ$2
*pecifies that the block 2ill appear on the item 2ith the node 9D
of $2!
a""re"a
tor
*pecifies that the block appears on Fust the a""re"ator!
blo"JO
*pecifies that all 'C0s that start 2ith blo"J 2ill sho2 the block!
;ote: if /ou 2ant the block4s5 to also appear on the main blo"
pa"e, /ou need to add !og 4that is, 2ithout the trailin" slash5 as
2ell!
Another eample, if /ou have HT<0, 1avascript or )H)
blocks /ou donDt think are necessar/ for administrators to
see, /ou can select G*ho2 on ever/ pa"e ecept the listed
pa"es!G and use the follo2in" 2ildcard for the block:
adminJO
Administrators can select 2hich content t/pe blocks
appear on as 2ell! This can be found under G(ontent
specific visibilit/ settin"sG after clickin" the Gconfi"ureG
link for an individual block! (hoose 2hich content t/pe
blocks appear on b/ checkin" the bo net to that content
t/pe! Kou can use content t/pe+specific blocks in
conFunction 2ith the above restrictions based on 'C0s!
Custom Administrator Defined &locks
An administrator defined block contains content supplied
b/ /ou 4as opposed to bein" "enerated automaticall/ b/ a
module5! To create /our o2n block simple navi"ate to the
block mana"ement screen b/ clickin" administer jh
blocks and select the ne2 tab! Hach admin+defined block
consists of a title, a description, and a bod/ that can be as
lon" as /ou 2ish! The contents of these blocks can either
be static html or d/namic )H)! This fleibilit/ makes the
block module ver/ etensible!
Drupal Handbook: 20 April 2005 1?2
7ote about &lock Titles
(urrentl/ the title of the block is used as its identifier in
the database! Therefore /ou can onl/ have one custom
block 2ithout a title 4this is a kno2n issue5! This presents
a problem if /ou donDt 2ant the block to have a title on
/our site! .ne 2orkaround for this is to enter a title like
this: <Z33tit!e of custom !oc(33&! That 2a/ /ou
satisf/ DrupalDs need for a block title but the <Z33 bits
prevent it from bein" displa/ed!
Custom &locks
*ee belo2 for a series of custom blocks created b/ Drupal
users that ma/ be useful for /ou! *ome custom block
eamples are also available in the (:* Cepositor/ 4,hatDs
a (:* Cepositor/E5!
Kou can also look at the preinstalled Drupal blocks b/
searchin" the Drupal files for GNblock4G! All blocks that are
defined in a module be"in 2ith this hook! 0ook to see 2hat
is put into WblocksZGsubFectG[ and WblocksZGcontentG[! The
0o"in+block, for eample, is implemented in user!moduleDs
function userNblock45 as block 0 4Gcase 0:G + this delta is
there as the user module defines more that one block5!
ho* block to certain users only
/ote: *ome of the follo2in" code mi"ht onl/ 2ork 2ith
Drupal $!5 or better!
4o* to sho* a block only to logged%in users
9f /ou 2ant to sho2 a certain 4self+made5 block onl/ to
logged-in users 4i!e! anon/mous users shouldnDt see it5,
/ou can use the follo2in" code in a )H) block:
<?php
g!oa! $user;
if ($user3&uid) {
return *;his !oc( is on!y visi!e for !ogged3in
users+*;
) e!se {
return;
)
Drupal Handbook: 20 April 2005 1?7
?&
Ceplace the strin" GThis block is onl/ visible for lo""ed+in
users!G 2ith an/thin" /ou 2ant to displa/ onl/ to lo""ed+in
users!
The block 2ill not be sho2n at all for users 2ho are not
lo""ed+in! Kou can replace the sin"le return in the else+
block 2ith, e!"!
<?php
return *;his !oc( is on!y visi!e for !ogged3in
users+*;
?&
to sho2 some tet instead of not displa/in" the block at
all!
4o* to sho* a block only to anonymous users
9f /ou 2ant to sho2 a certain 4self+made5 block onl/ to
anonymous users, /ou can use the follo2in" code in a
)H) block:
<?php
g!oa! $user;
if (Z$user3&uid) {
return *;his !oc( is on!y visi!e for anonymous
users+*;
) e!se {
return;
)
?&
4o* to sho* a block only to certain users
9f /ou 2ant to sho2 a certain 4self+made5 block onl/ to
certain users, /ou can use the follo2in" code in a )H)
block:
<?php
g!oa! $user;
if ($user3&uid == 1Y) {
return *;his !oc( is on!y visi!e for the user
/ith the user38H 1Y+*;
) e!se {
return;
)
Drupal Handbook: 20 April 2005 1?$
?&
Debugging the Path
9f /ou 2ant to see the strin" that is bein" matched a"ainst
/our pattern put the follo2in" code in block!module
print ('<pre& in modu!e% *'+$!oc(['modu!e'"+'* '+
$!oc(['path'" + '<.pre&');
print( '<pre& string% ' + ereg_rep!ace('^.(U?7=)?
'' ''' re7uest_uri()) + '<.pre&');
print( '<pre& matches?% ' + preg_match($!oc(
['path'"' ereg_rep!ace('^.(U?7=)?'' '''
re7uest_uri())) + '<.pre&');
it should "o into function blockNlist45 of block!module
after
/hi!e ($resu!t ## ($!oc( = d_fetch_array
($resu!t))) {
.. Ohen the user's account setting is empty'
/e use the !oc('s regu!ar 'status' (/hich is the
defau!t)
if ($!oc(['custom'" ## $user3&uid ## Zisset
($user3&!oc([$!oc(['modu!e'""[$!oc(['de!ta'""))
{
$user3&!oc([$!oc(['modu!e'""[$!oc(
['de!ta'"" = $!oc(['status'";
)
FF<33 here
the output is as follo2s
in module: GmenusG
strin" : slu=b/JEI`adminJs/stemJblock
matchesE : 1
matches : 1 means that re"ullar epression 2as succesful
and the block 2ill be displa/ed, if there is nothin" it means
there 2ere no attempt to make re"e
Custom login
This is a ver/ simple block to displa/ a link to the lo"in
pa"e 2hen the user is not lo""ed in and to displa/ a lo"out
link 2hen the user is lo""ed in!
<?php
Drupal Handbook: 20 April 2005 1?5
g!oa! $user;
if (Z$user3&uid) {
.. Bhange the fo!!o/ing !ine's te$t to /hatever
you /ant+
return '<a
href=*?7=user.!ogin*&=ogin.Gegister<.a&';
) e!seif ($user3&uid) {
.. ;he fo!!o/ing !ine /i!! disp!ay the username
you are !ogged in as+
return '=ogged in as ' + $user3&name + '<r&<a
href=*node?7=!ogout*&=ogout<.a&';
)
?&
9f /ou donDt 2ant the block to redundantl/ sho2 up in the
lo"in section, add this to the custom blockDs path field!
<^(?Zuser)&
All published content in a list.
A ver/ simple block to sho2 all nodes that are published in
a list ,ordered b/ creation date!
9ts ver/ hand/ 2hen /ou have Fournal that uses not onl/
blo" nodes, but also ima"es, 2eblinks etc!
<?php
$resu!t = d_7uery_range(*:A=AB; n+created'
n+tit!e' n+nid' n+changed
DGC1 node n
OEAGA n+status = 1
CGHAG MP n+created
HA:B *' ?' 1?);
/hi!e ($node = d_fetch_o2ect($resu!t)) {
$output[" = !(chec(_output($node3&tit!e)'
*node.vie/.*+$node3&nid);
)
return theme_item_!ist($output);
?&
&log Categories
HereDs a block that sho2s all of the cate"ories in /our -lo"
vocabular/! 9t can easil/ be customi=ed to sho2 the
cate"ories from an/ node t/pe b/ chan"in" the
Gvocabular/NnodeNt/pes!t/pe ` Dblo"DG part to eIual /our
Drupal Handbook: 20 April 2005 1?%
preferred node t/pe!
<?php
if (user_access('access content')) {
$resu!t = d_7uery(*:A=AB; term_data+tid'
term_data+name' BCI9;(F) <: count DGC1
{vocau!ary_node_types) 899AG NC89 {term_data)
I:89Q (vid) 899AG NC89 {term_node) I:89Q (tid)
899AG NC89 {node) I:89Q (nid) OEAGA node+status =
1 <9H vocau!ary_node_types+type = '!og' QGCIK MP
term_data+tid' term_data+name CGHAG MP
term_data+name*);
$items = array();
/hi!e ($category = d_fetch_o2ect($resu!t)) {
$items[" = !($category3&name +' ('+
$category3&count +')'' 'ta$onomy.term.'+
$category3&tid);
)
return theme('item_!ist'' $items);
)
?&
&logcentric $andom "mage
This is a variation that 2ill displa/ a random ima"e
belon"in" to the current blo"Ds o2ner!!!
set a path of oblo"mJZ0+3[ so it onl/ displa/s on blo"
pa"es!!!
<?php
if (arg(?)=='!og'){
$uid = arg(1);
$account = user_!oad(array((is_numeric($uid) ?
'uid' % 'name') =& $uid' 'status' =& 1));
$current_!og = $account3&uid;
)
$7uery = sprintf(*:A=AB; F DGC1 node OEAGA
type='image' <9H uid=\d CGHAG MP G<9H() =818;
?'1*'$current_!og);
$resu!t = d_7uery($7uery);
if (d_num_ro/s($resu!t) & ?){
$ro/ = d_fetch_array($resu!t);
$nid = $ro/[*nid*";
$tit!e = $ro/[*tit!e*";
if($tit!e==**)$tit!e=*isimsi4*;
$resu!t = mys7!_7uery(*:A=AB; F DGC1 image OEAGA
Drupal Handbook: 20 April 2005 1??
nid=$nid*);
$ro/ = mys7!_fetch_assoc($resu!t);
$thum = $ro/[*thum_path*";
mys7!_free_resu!t($resu!t);
echo(*<div a!ign=U*centerU*&<a
href=U*http%..///+!ogto/n+ca.node.$nid?res=@??$5?
?U*&<img
src=U*$thumU*&<r&<&$tit!e<.&<.a&<.div&*);
)
?&
Comment Appro/al Count &lock
Displa/s a count of the comments 2aitin" to be approved
to the super+admin user, as 2ell as a link to the comment
approval Iueue!
<?php
g!oa! $user;
if ($user3&uid == 1) {
$s7! = ':A=AB; c+nid' c+cid' c+timestamp'
c+status' c+name' c+homepage DGC1 {comments) c
OEAGA c+status = 1';
$resu!t = d_7uery($s7!);
$num_comments = d_num_ro/s($resu!t);
return *<div a!ign='center'&
<p&;here are
<strong&$num_comments<.strong& comment(s) /aiting
to e
<a
href='admin.comment.!ist.approva!'&approved<.a&<.p
&<.div&*;
)
?&
Iuicker 2a/ mi"ht be this:
<?php
$comment_count = d_resu!t(d_7uery(*:A=AB; count
(F) DGC1 comments OEAGA status=1*));
?&
Counter 1- days before # past...2
A small block that displa/s the da/s after a certain date!
Drupal Handbook: 20 April 2005 1?&
<?php
$day = @?;
$month = 1,;
$year = 1Y-Y;
$age= ((int)((m(time (?'?'?'$month'$day'$year) 3
time(void)).>-5??) F 31 );
print (*1y age in days is * + $age + );
?&
4its by 8onth
)ut this in a block, and it 2ill sho2 the number of hits per
month, b/ month! The number of months sho2n 2ill
depend on 2hat /ou confi"ured 4ho2 lon" to keep
statistics5!
The first and last months 2ill be incomplete, because of
the lo" pur"in"!
Kou can restrict the path of the block to admin to make
this visible onl/ to /ou 4the site administrator5!
This is </*M0 specific! 9 am sure it can be adapted to
other databases!
<?php
$header = array ('1onth'' 'Eits');
$ro/s = array();
$7 = *:A=AB; H<;A_DCG1<;(DGC1_I98L;81A(timestamp)'
'\P3\m') <: month' BCI9;(F) <: hits DGC1
{access!og) QGCIK MP month CGHAG MP month HA:B*;
$resu!t = d_7uery ($7);
/hi!e ( $ro/ = d_fetch_o2ect ( $resu!t ) ) {
$ro/s[" = array ( 'data' =& array ( $ro/3&month'
$ro/3&hits )) ;
)
if (Z$ro/s) {
$ro/s[" = array(array('data' =& t('9o !og data
avai!a!e+')' 'co!span' =& ,));
)
print theme('ta!e'' $header' $ro/s);
?&
,atest stories block
Here is a simple module 2hich displa/s the titles of the
Drupal Handbook: 20 April 2005 1?3
last n chan"ed stories in a block! 9t 2as made specificall/
for m/ site, and onl/ 2orks on Dstor/D nodes, thou"h it
2ould be eas/ to chan"e this! ;eeds to be topped and
tailed 2ith php script open and close an"le brackets! ZEphp
JJ ++++ cop/ from here +++ JJ latest!module v0!1!0, 1ohn (lift,
11 Dec 2007 JJ <odule displa/s a block 2hich lists the
titles, linked, JJ of the last five stories to be added or
modified JJ Database Iuer/ to "et the latest stor/ nodes JJ
Wnlimit sets the number of node titles to displa/ function
latestNnodes4Wt/pe5 P Wnlimit ` 5R Wresult ` dbNIuer/
4G*H0H(T n!created, n!title, n!nid, n!chan"ed 6C.< node
n ,HHCH n!t/pe ` DWt/peD .CDHC -K n!chan"ed DH*(
09<9T WnlimitG5R 2hile 4Wnode ` dbNfetchNobFect4Wresult55
P Woutput !` l4checkNoutput4Wnode+_title5,
GnodeJvie2JG!Wnode+_nid5 !G
GR Q return WoutputR Q JJ 6unction to displa/ titles of latest
stor/ nodes in a block function latestNblock4Wop ` GlistG,
Wdelta ` 05 P if 4Wop `` GlistG5 P WblocksZ0[ZGinfoG[ ` t
4G0atest n Additions or (han"esG5R return WblocksR Q else
P WblockZGsubFectG[ ` t4G0atest (han"esG5R Wblock
ZGcontentG[ ` latestNnodes4Gstor/G5R return WblockR Q Q JJ +++
end +++ E[
Paypal blocks
Here are t2o snipets that displa/ ho2 much and 2ho has
made donations! CeIuires the pa/palNframe2ork module!
Total mone/ sent to /ou:
<?php
$resu!t = d_7uery(*
:A=AB; :I1(payment_gross) as tota! DGC1
paypa!_!og
*);
$pp = d_fetch_o2ect($resu!t);
print sprintf( *\?1+,f*' $pp3&tota!W? );
?&
The 10 most recent people to have sent /ou the mone/:
<?php
$resu!t = d_7uery(*
:A=AB; usiness'option_name1 DGC1 paypa!_!og
CGHAG MP payment_date HA:B =818; 1?
*);
$count = ?;
Drupal Handbook: 20 April 2005 1&0
/hi!e( $donor = d_fetch_o2ect($resu!t) ){
print *<!i&*;
if( $donor3&{usiness) ){
print $donor3&{usiness);
)e!seif( $donor3&{option_name1) ){
print $donor3&{option_name1);
)e!se{
print *<i&anonymous<.i&*;
)
print *<.!i&*;
$count = $count W 1;
)
if( $count==? ){
print *<!i&<i&none<.i&<.!i&*;
)
?&
Pull Do*n Top ,e/el Category ,inks
This is a little block to sho2 a pull+do2n form list of /our
top level taonomies! ,hen /ou select a list item a little
1avascript 2ill Fump /ou to that taonom/Ds pa"e!
<?php
..Hefau!t Ra!ue for :e!ect
$t_name[" = 'Nump to Bategory';
..Qet ;a$onomy ;erms /ith 9o Karent
$resu!t = d_7uery(*:A=AB; term_data+name'
term_data+tid DGC1 term_data' term_hierarchy OEAGA
term_data+tid=term_hierarchy+tid <9H
term_hierarchy+parent = ?*);
..Kopu!ate array /ith names and !in(s+ ;he (ey of
the array /i!! e our IG=+
/hi!e ($term = d_fetch_o2ect($resu!t)) {
$t_name['ta$onomy.term.' + $term3&tid" = $term3
&name;
)
..Mui!d the se!ect !ist using Hrupa!'s
'form_se!ect' function+
$category_se!ect = form_se!ect(''' 'category'' '''
$t_name' $description = 9I=='
'onBhange=*top+!ocation+href=document+getA!ementMy
8d(U'edit3categoryU')+options
[document+getA!ementMy8d(U'edit3categoryU')+
se!ected8nde$"+va!ue*'' $mu!tip!e = D<=:A'
$re7uired = D<=:A);
Drupal Handbook: 20 April 2005 1&1
..Qive our suse7uent form a name /e can gra /ith
the Navascript
$form_attriutes[name" = 'form';
..Mui!d our form /ith Hrupa!'s 'form' function+
return form($category_se!ect' $method = 'get'' '''
$form_attriutes);
?&
This isnDt reall/ such a "reat thin" to do as far as
accesibilit/ thou"h! 9f /ou are usin" an/ device other than
a mouse it is hard to select the options, 2ith the Favascript
in there auto directin" /our pa"e location!
*o here is a version of the same script 2ith a submit
button!
<?php
..Hefau!t Ra!ue for :e!ect
$t_name[" = 'Nump to Bategory';
..Qet ;a$onomy ;erms /ith 9o Karent
$resu!t = d_7uery(*:A=AB; term_data+name'
term_data+tid DGC1 term_data' term_hierarchy OEAGA
term_data+tid=term_hierarchy+tid <9H
term_hierarchy+parent = ?*);
..Kopu!ate array /ith names and !in(s+ ;he (ey of
the array /i!! e our IG=+
/hi!e ($term = d_fetch_o2ect($resu!t)) {
$t_name['ta$onomy.term.' + $term3&tid" = $term3
&name;
)
$category_se!ect = form_se!ect(''' 'category'' '''
$t_name' $description = 9I==' ''' $mu!tip!e =
D<=:A' $re7uired = D<=:A);
..<dd utton 2avascript
$utton_attriutes[onB!ic(" =
'top+!ocation+href=document+getA!ementMy8d(U'edit3
categoryU')+options[document+getA!ementMy8d
(U'edit3categoryU')+se!ected8nde$"+va!ue';
..<dd utton
$sumit_utton = form_utton('Qo ;o BategoryZ''
$name = 'op'' $type = 'utton''
$utton_attriutes);
..Breate var for a!! form contents
$form_info = $category_se!ect + $sumit_utton;
..Qive our suse7uent form a name /e can gra /ith
the Navascript
$form_attriutes[name" = 'form';
..Mui!d our form /ith Hrupa!'s 'form' function+
Drupal Handbook: 20 April 2005 1&2
return form($form_info' $method = 'get'' '''
$form_attriutes);
?&
$andom image
<?php
$resu!t = mys7!_7uery(*:A=AB; F DGC1 node OEAGA
type='image' CGHAG MP G<9H() =818; ?'1*);
$ro/ = mys7!_fetch_assoc($resu!t);
$nid = $ro/[*nid*";
$tit!e = $ro/[*tit!e*";
if($tit!e==**)$tit!e=*isimsi4*;
$resu!t = mys7!_7uery(*:A=AB; F DGC1 image OEAGA
nid=$nid*);
$ro/ = mys7!_fetch_assoc($resu!t);
$thum = $ro/[*thum_path*";
mys7!_free_resu!t($resu!t);
echo(*<div a!ign=U*centerU*&<a
href=U*node.$nid?res=@??$5??U*&<img
src=U*$thumU*&<r&<&$tit!e<.&<.a&<.div&*);
?&
$andom image display
6or use 2ith Drupal $!5! ZEphp Wresult ` m/sIlNIuer/
4G*H0H(T O 6C.< node ,HHCH t/pe`Dima"eD .CDHC -K
CA;D45 09<9T 0,1G5R Wro2 ` m/sIlNfetchNassoc4Wresult5R
Wnid ` Wro2ZGnidG[R Wtitle ` Wro2ZGtitleG[R if4Wtitle``GG5
Wtitle`Gisimsi=GR Wresult ` m/sIlNIuer/4G*H0H(T O 6C.<
ima"e ,HHCH nid`WnidG5R Wro2 ` m/sIlNfetchNassoc
4Wresult5R Wthumb ` Wro2ZGthumbNpathG[R
m/sIlNfreeNresult4Wresult5R echo4G
&title
G5R E[ add this as a php block and edit the outputted url
4222!sample!com5, so it matches /our installation! !!!
2orkin" no2 on a slider!!! :5
ho* highest contributers to a site
6rom a post b/ Favanaut in ans2er to a forum Iuestion!
Drupal Handbook: 20 April 2005 1&7
This 2orks in Drupal $!5
<?php
$users = d_7uery(*:A=AB; BCI9;(cid) <: count'
{users)+uid' {users)+name DGC1 {comments) =AD;
NC89 {users) C9 {comments)+uid = {users)+uid OEAGA
{comments)+uid Z= ? QGCIK MP uid CGHAG MP count
HA:B =818; ,?*);
print *<u!&*;
/hi!e ($user = d_fetch_o2ect($users)) {
print *<!i&*+!($user3&name'*user.$user3&uid*)+
* ($user3&count)<.!i&*;
)
print *<.u!&*;
?&
ubmission (ueue block
Hi folks, 1ust in case an/oneDs interested, 9 have Fust
2ritten a small custom block 2hich lists items in the
submission Iueue! (reate /ourself a ne2 )H) block and
use this code: VEphp "lobal WuserR if 4Wuser+_uid5 P JJ "et
the links WIuer/Cesult ` dbNIuer/Nran"e4G*H0H(T n!O
6C.< PnodeQ n ,HHCH n!moderate ` 1G, 0, 105R 2hile
4Wnode ` dbNfetchNobFect4WIuer/Cesult55 P if 4Wuser+_uid
`` Wnode+_uid TT fieldN"et4Wnode+_users, Wuser+_uid55 P JJ
itDs our o2n node or 2eDve alread/ voted Wro2sZ[ ` l
4Wnode+_title, GIueueJWnode+_nidG5 ! G 4G ! IueueNscore
4Wnode+_nid5 ! G5GR Q else P JJ itDs someone elseDs node
Wro2sZ[ ` l4Wnode+_title, GIueueJWnode+_nidG5R Q Q return
theme4GitemNlistG, Wro2s, G*ubmission IueueG5 ! GVdiv
class`mGmore+linkmG_G ! l4t4GmoreG5, GIueueG, arra/4GtitleG
`_ t4G0ist all Iueue entries!G555 ! GVJdiv_GR Q E_ Hope /ou
find this helpfulL (heers, <abster
Top users by comment number
This block displa/s the top 10 users 2ho made the most
comments, in descendin" order!
;ote: to create a similar block that counts the users 2ho
authored the most nodes 4pa"esJstoriesJforum articles, !!!
etc!5 chan"e the 2ord GcommentsG 2ith GnodeG in the
select statement belo2!
Drupal Handbook: 20 April 2005 1&$
<?php
$header = array ('Iser'' 'Kosts');
$ro/s = array();
$7 = *:A=AB; u+name' count(F) <: posts DGC1
{users) u' {comments) c OEAGA u+uid = c+uid QGCIK
y u+name CGHAG MP posts HA:B =818; 1?*;
$resu!t = d_7uery ($7);
/hi!e ( $ro/ = d_fetch_o2ect ( $resu!t ) ) {
$ro/s[" = array ( 'data' =& array ( $ro/3&name'
$ro/3&posts )) ;
)
if (Z$ro/s) {
$ro/s[" = array(array('data' =& t('9o comments
avai!a!e+')' 'co!span' =& ,));
)
print theme('ta!e'' $header' $ro/s);
?&
Uptime and load on Uni- systems
This block makes it possible to sho2 the current load and
uptime in a block! The code 2ill not 2ork as is on all
'nies! .ne mi"ht consider it a securit/ risc to sho2 2hat
/our uptime is 4kernel patchin" reIuires reboot5, so !!
batteries not included, al2a/s look both sides 2hen
crossin" a road etc!
Kou can learn from this code ho2 to eecute shell
commands form php!
<?php
$uptime = she!!_e$ec(*cut 3d+ 3f1 .proc.uptime*);
$!oadavg_array = e$p!ode(* *' e$ec(*cat .
proc.!oadavg*));
$!oadavg = $!oadavg_array[,";
$days = f!oor($uptime.-?.-?.,5);
$hours = $uptime.-?.-?\,5;
$mins = $uptime.-?\-?;
$secs = $uptime\-?;
echo *;his server has een up $days day(s) $hours
hour(s) $mins minute(s) and $secs second(s)*;
echo *<p&<r&*;
print(*[ Burrent server !oad% * + $!oadavg + * "
*);
?&
Drupal Handbook: 20 April 2005 1&5
Drupal modules and features
The nodes belo2 contain the help available for the Drupal
modules!
A blog for e/ery Drupal user
DrupalDs blo" module allo2s all re"istered users to
maintain a personal 2eblo" on site! -lo"s are easil/+ and
freIuentl/+updated 2ebsites usuall/ 2ritten in an informal
and conversational st/le! The/ are ordered reverse+
chronolo"icall/ 4that is, the most recent entr/ is at the top5
and have archives of past entries! Hach individual entr/
has a permanentpthat is to sa/, stablep'C0 linkin"
directl/ to that item! -lo"s t/picall/ have comments for
each entr/ so that readers can participate in the
discussion, and the/ usuall/ have C** feed to be
s/ndicated else2here or read in an desktop a""re"ator!
Hach entr/ usuall/ contains one iidea, 2ith a link to the
source of the ori"inal item bein" discussed! -lo"s can be
4and are5 2ritten about an/ subFect, from dail/ personal
life to technolo"/ to politics to knittin" to sports to a
compan/Ds products!
6rom a more practical standpoint, blo"s can be seen as a
means of personal kno2led"e publishin", a place for
researchers or enthusiasts to build and share kno2led"e
about their interests! .r in proFect oriented sites, as a
2orkspace for proFect members to post ideas for
commentin" b/ others in a "roup!
6or a more complete definition of blo""in" 2ith links to
resources and eamples, see #eor"e *iemensD The Art of
-lo""in" + )art 1 and The Art of -lo""in" + )art 2!
Configuring User &logs
To implement user blo"s on /our Drupal site, simpl/ turn
on the blo" module!
#o administer h modules and check the bo in the status
column to the ri"ht of blo"! ;et, under administer jh
access control, check the edit o2n blo" bo for each role
/ou 2ish to maintain blo"s!
Drupal Handbook: 20 April 2005 1&%
.nce lo""ed in, each user 2ith the permission to maintain
a blo" 2ill be able to click create content h personal blo"
entr/ and 2ill see m/ blo" 42hich displa/s blo" entries as
other people 2ill see them5 in the user navi"ation block! At
the bottom of each individual blo" post, the ori"inal blo"
author 2ill find an edit this blo" entr/ option!
To add instructions for users on creatin" their blo"s,
return to Drupal site administration and select administer
h settin"s h blo"! Hnter /our instructions in the available
tet field! ;ote that /ou can use the <inimum number of
2ords in a blo" entr/ settin" to specif/ a minimum len"th
for all blo" posts!
8aking User &logs 8ore Accessible
Drupal provides a number of 2a/s to make user blo" posts
accessible! KouDll need to decide 2hich ones 2ork best for
ho2 /our Drupal site is confi"ured:
A lin# in the naigation bar: After activatin" the
blo" module, most Drupal themes 2ill include a
-lo"slink in the header navi"ation bar! The user blo"
listin" contains the most recent blo" posts b/ all site
users! 9f the site is usin" template, /ouDll need to
create the link /ourself! #o to site confi"uration jh
themes jh template and add in the HT<0 to create
the 'C0 4to find the 'C0, s2itch /our site theme
momentaril/ to <arvin and the link 2ill be present
in the navi"ation header5!
$a#ing user blog listings the default home
page: (lick administer h settin"s and t/pe in the
2ord Gblo"G 42ithout Iuotes5 for Default front pa"e!
1romoting indiidual blog posts: 9f blo" listin"s
are not the default home pa"e 4that is, if
dministrators have GnodeG as the Default front pa"e
settin" can elect to promote an/ user blo" posts to
the front pa"e! (lick onto the blo" post /ou 2ant to
promote, then the edit tab and then check )romoted
to 6ront )a"e!
1romoting indiidual blog posts automatically:
(lick administer h content h confi"ure h content
t/pe, then the Gconfi"ureG link net to Gpersonal blo"
entr/, and check the )romoted front pa"e bo in the
GDefault optionsG "roup! 4This 2ill 2ork if GnodeG is
Drupal Handbook: 20 April 2005 1&?
the Default front pa"e in administer jh settin"s!
"in#s to recently-updated blogs on the sidebar:
Drupal also makes available a <ost recent blo"s
block under administer h blocks!
Additional features
Blog it: 'sers 2ith blo"s 2ill see a Gblo" itG link in
the form of a linked ima"e i!e! 2hen vie2in" posts
in the ne2s a""re"ator! .ther ne2s listin"s, such as
C** blocks, 2ill have an icon in place of the tetual
blo" it link! ,hen the blo" it option is selected, the
user 2ill be taken to the blo" entr/ form, 2ith the
title, a link to the item, and a link to the source
alread/ entered in the tet input field, read/ for the
user to add eplanation!
4ser Blog 2!! syndication: each individual user
blo" has their o2n C** feed, allo2in" other sites to
s/ndicate their content or allo2in" readers to read
the individual blo" in an a""re"ator! To find the C**
feed for a user, vie2 their personal blo" 4in their
personal information, 2hich /ou can "et to b/
clickin" on their username, select vie2 recent blo"
entries5! Then look for the 8<0 icon at the bottom of
their blo" pa"e!
Collaborati/e book or documentation
*riting
The book or"anises content into a nested hierarchical
structure! 9t is particularl/ "ood for manuals, 6reIuentl/
Asked Muestions 46AMs5 and the like, allo2in" /ou to have
chapters, sections, etc!
A book is simpl/ a collection of nodes that have been
linked to"ether! These nodes are usuall/ of t/pe book
pa"e, but /ou can insert nodes of an/ t/pe into a book
outline! Hver/ node in the book has a parent node 2hich
GcontainsG it! This is ho2 book!module establishes its
hierarch/! At an/ "iven level in the hierarch/, a book can
contain man/ nodes! All these siblin" nodes are sorted
accordin" to the 2ei"ht that /ou "ive them!
-ook pa"es contain a lo" messa"e field 2hich helps /our
Drupal Handbook: 20 April 2005 1&&
users understand the motivation behind an edit of a book
pa"e! Hach edited version of a book pa"e is stored as a
ne2 revision of a node! This capabilit/ makes it eas/ to
revert to an old version of a pa"e, should that be
desirable!
0ike other node t/pes, book submissions and edits ma/ be
subFect to moderation, dependin" on /our confi"uration!
*imilarl/, books use permissions to determine 2ho ma/
read and 2rite to them! .nl/ administrators are allo2ed to
create ne2 books, 2hich are reall/ Fust nodes 2hose
parent is Vtop+level_! To include an eistin" node in /our
book, click on the GoutlineG+tab on the nodeDs pa"e! This
enables /ou to place the node 2herever /ouDd like 2ithin
the book hierarch/! To add a ne2 node into /our book, use
the create content h book pa"e link!
Administrators ma/ revie2 the hierarch/ of their books b/
clickin" on the collaborative book link in the
administration pa"es! There, nodes ma/ be edited,
reor"ani=ed, removed from book, and deleted! This
behavior ma/ chan"e in the future! ,hen a parent node is
deleted, it ma/ leave behind child nodes! These nodes are
no2 orphans! Administrators should periodicall/ revie2
their books for orphans and reaffiliate those pa"es as
desired! 6inall/, administrators ma/ also eport their
books to a sin"le, flat HT<0 pa"e 2hich is suitable for
printin"!
8aintaining a 3A9 using a collaborati/e book
(ollaborative books let /ou easil/ set up a 6reIuentl/
Asked Muestions 46AM5 section on /our 2eb site! The main
benefit is that /ou donDt have to 2rite all the
IuestionsJans2ers b/ /ourself + let the communit/ do it for
/ouL
9n order to set up the 6AM, /ou have to create a ne2 book
2hich 2ill hold all /our content! To do so, click on the
create content h book pa"e link! #ive it a thou"htful title,
and bod/! A title like GHstonia Travel + 6AMG is nice! Kou
ma/ al2a/s edit these fields later! Kou 2ill probabl/ 2ant
to desi"nate Vtop+level_ as the parent of this pa"e! 0eave
the lo" messa"e and t/pe fields blank for no2! After /ou
have submitted this book pa"e, /ou are read/ to be"in
Drupal Handbook: 20 April 2005 1&3
fillin" up /our book 2ith Iuestions that are freIuentl/
asked!
,henever /ou come across a post 2hich /ou 2ant to
include in /our 6AM, click on the administer link! Then
click on the edit book outline button at the bottom of the
pa"e! Then place the relevant post 2herever is most
appropriate in /our book b/ selectin" a parent! -ooks are
Iuite fleible! The/ can have sections like 6l/in" to
Hstonia, Hatin" in Hstonia and so on! As /ou "et more
eperienced 2ith the book module, /ou can reor"ani=e
posts in /our book so that it sta/s or"ani=ed!
;otes:
An/ comments attached to those relevant posts
2hich /ou desi"nate as book pa"es 2ill also be
transported into /our book! This is a "reat feature,
since much 2isdom is shared via comments!
Cemember that all future comments and edits 2ill
automaticall/ be reflected in /our book!
Kou ma/ 2ish to edit the title of posts 2hen addin"
them to /our 6AM! This is done on the same pa"e as
the Hdit book outline button! (lear titles improve
navi"abilit/ enormousl/!
-ook pa"es ma/ come from an/ content t/pe 4blo",
stor/, pa"e, etc!5! 9f /ou are creatin" a post solel/ for
inclusion in /our book, then use the create content h
book pa"e link!
9f /ou donDt see the administer link, then /ou
probabl/ have insufficient permissions!
Printing P4P 6ariables from GCT or P'T
3orms
The collaborative book allo2s administrators to add )H)
code to the pa"e bod/ for etra po2er! Kou do ;.T use
the )H) ta"s 4GVEphpG and GE_G5!
To "et the data /ou submit from a form /ou can do this:
print Gvariable1: G ! WN).*TZGvariable1G[ !GVbr_GR
print Gproduct: G ! WN).*TZGproductG[ !GVbr_GR
print Gsi=e: G ! WN).*TZGsi=eG[ !GVbr_GR
chan"e WN).*T to WN#HT if /ou used #HT as /our form
Drupal Handbook: 20 April 2005 130
method or if /ou are usin" a 'C0 to set the variables! 4e":
/oursite!comJpa"e!phpEvariable1`hello5
Comment system
,hen enabled, the Drupal comment module creates a
discussion board for each Drupal node! 'sers can post
comments to discuss a forum topic, 2eblo" post, stor/,
collaborative book pa"e, etc! An administrator can "ive
comment permissions to user "roups, and users can
4optionall/5 edit their last comment, assumin" no others
have been posted since!
User control of comment display
Attached to each comment board is a control panel for
customi=in" the 2a/ that comments are displa/ed! 'sers
can control the chronolo"ical orderin" of posts 4ne2est or
oldest first5 and the number of posts to displa/ on each
pa"e! Additional settin"s include:
Threaded p Displa/s the posts "rouped accordin"
to conversations and subconversations!
3lat p Displa/s the posts in chronolo"ical order,
2ith no threadin" 2hatsoever!
,0panded p Displa/s the title and tet for each
post!
Collapsed p Displa/s onl/ the title for each post!
,hen a user chooses save settin"s, the comments are then
redispla/ed usin" the userDs ne2 choices! Administrators
can set the default settin"s for the comment control panel,
alon" 2ith other comment defaults, in administer h
comments h confi"ure! ;.TH: ,hen comment moderation
is enabled, users 2ill have another control panel option to
control thresholds 4see belo25!
Additional comment configurations
(omments behave like other user submissions in Drupal!
6ilters, smile/s and HT<0 that 2ork in nodes 2ill also
2ork 2ith comments! Administrators can control access to
various comment module functions throu"h administer h
access control h permissions! >no2 that in a ne2 Drupal
installation, all comment permissions are disabled b/
Drupal Handbook: 20 April 2005 131
default! The choice of 2hich permissions to "rant to 2hich
roles 4"roups of users5 is left up to the site administrator!
The follo2in" permissions:
Access comments p Allo2s users to vie2
comments!
Administrate comments p Allo2s users complete
control over confi"urin", editin" and deletin" all
comments!
$oderate comments p Allo2s users to rate
comment postin"s 4see more on moderation belo25!
1ost comments p Allo2s users to post comments
into an administrator moderation Iueue!
1ost comments without approal p Allo2s users
to directl/ post comments, b/passin" the moderation
Iueue!
7otification of ne* comments
Drupal provides specific features to inform site members
2hen ne2 comments have been posted!
Drupal displa/s the total number of comments attached to
each node, and tracks comments read b/ individual site
members! <embers 2hich have lo""ed in 2ill see a notice
accompan/in" nodes 2hich contain comments the/ have
not read! *ome administrators ma/ 2ant to do2nload,
install and confi"ure the notif/ module! 'sers can then
reIuest that Drupal send them an e+mail 2hen ne2
comments are posted 4the notif/ module reIuires that
cron!php be confi"ured properl/5!
The tracker module, disabled b/ default, displa/s all the
siteDs recent posts! There is a link to the recent posts pa"e
in the navi"ation block! This pa"e is a useful 2a/ to
bro2se ne2 or updated nodes and comments! (ontent
2hich the user has not /et read is ta""ed 2ith a red star
4this "raphic depends on the current theme5! :isit the
comment board for an/ node, and Drupal 2ill displa/ a red
Gne2G label beside the tet of unread comments!
Comment moderation
.n sites 2ith active commentin" from users, the
administrator can turn over comment moderation to the
Drupal Handbook: 20 April 2005 132
communit/!
,ith comment moderation, each comment is automaticall/
assi"ned an initial ratin"! As users read comments, the/
can appl/ a vote 2hich affects the comment ratin"! At the
same time, users have an additional option in the control
panel 2hich allo2s them to set a threshold for the
comments the/ 2ish to vie2! Those comments 2ith ratin"s
lo2er than the set threshold 2ill not be sho2n! To enable
moderation, the administrator must "rant moderate
comments permissions! Then, a number of options in
administer h comments h confi"ure must be confi"ured!
8oderation /otes
The first step is to create moderation labels 2hich allo2
users to rate a comment! #o to administer h comments h
confi"ure h moderation votes! 9n the vote field, enter the
tetual labels 2hich users 2ill see 2hen castin" their
votes! *ome eamples are
Hcellent X7
9nsi"htful X2
'seful X1
Cedundant +1
6lame +7
*o that users kno2 ho2 their votes affect the comment,
these eamples include the vote value as part of the label,
althou"h that is optional! 'sin" the 2ei"ht option, /ou can
control the order in 2hich the votes appear to users!
*ettin" the 2ei"ht heavier 4positive numbers5 2ill make
the vote label appear at the bottom of the list! 0i"hter 4a
ne"ative number5 2ill push it to the top! To encoura"e
positive votin", a useful order mi"ht be hi"her values,
positive votes, at the top, 2ith ne"ative votes at the
bottom!
8oderator /ote#/alues matri-
;et "o to administer h comments h confi"ure h
moderation matri! Hnter the values for the vote labels for
each permission role in the vote matri! The values
entered here 2ill be used to create the ratin" for each
comment! ;.TH: (omment ratin"s are calculated b/
Drupal Handbook: 20 April 2005 137
avera"in" user votes 2ith the initial ratin"!
Creating comment thresholds
9n administer h comments h confi"ure h moderation
thresholds, /ouDll have to create some comment thresholds
to make the comment ratin" s/stem useful! ,hen
comment moderation is enabled and the thresholds are
created, users 2ill find another comment control panel
option for selectin" their thresholds! The/Dll use the
thresholds /ou enter here to filter out comments 2ith lo2
ratin"s! (onseIuentl/, /ouDll probabl/ 2ant to create more
than one threshold to "ive users some fleibilit/ in filterin"
comments!
,hen creatin" the thresholds, note that the <inimum
score is askin" /ou for the lo2est ratin" that a comment
can have in order to be displa/ed! To see a common
eample of ho2 thresholds 2ork, /ou mi"ht visit *lashdot
and vie2 one of their comment boards associated 2ith a
stor/! Kou can reset the thresholds in their comment
control panel!
"nitial comment scores
6inall/, /ou ma/ 2ant to enter some initial comment
scores! 9n administer h comments h confi"ure h
moderation roles /ou can assi"n a be"innin" ratin" for all
comments posted b/ a particular permission role! 9f /ou do
not assi"n an/ initial scores, Drupal 2ill assi"n a ratin" of
( as the default!
Cron system and crontab
Drupal comes 2ith s/stem+2ide defaults but the settin"+
module provides control over man/ Drupal preferences,
behaviours includin" visual and operational settin"s!
Cron
*ome modules reIuire re"ularl/ scheduled actions, such
as cleanin" up lo"files! (ron, 2hich stands for
chrono"raph, is a periodic command scheduler eecutin"
commands at intervals specified in seconds! 9t can be used
Drupal Handbook: 20 April 2005 13$
to control the eecution of dail/, 2eekl/ and monthl/ Fobs
4or an/thin" 2ith a period measured in seconds5!
Automatin" tasks is one of the best 2a/s to keep a s/stem
runnin" smoothl/, and if most of /our administration does
not reIuire /our direct involvement, cron is an ideal
solution!
The recommended 2a/ to set up /our cron s/stem is to set
up a 'niJ0inu crontab entr/ 4see Gman crontabG5 that
freIuentl/ visits http:JJeample!comJcron!php! ;ote that
cron does not "uarantee the commands 2ill be eecuted at
the specified interval! Ho2ever, Drupal 2ill tr/ its best to
run the tasks as close to the specified intervals as possible!
The more /ou visit cron!php, the more accurate cron 2ill
be!
9f /our hostin" compan/ does not allo2 /ou to set up
crontab entries, /ou can al2a/s ask someone else to set up
an entr/ for /ou! After all, virtuall/ an/ 'niJ0inu
machine 2ith access to the internet can set up a crontab
entr/ to freIuentl/ visit http:JJeample!comJcron!php!
6or the 'niJ0inu crontab itself, use a bro2ser like l/n
or 2"et but make sure the process terminates: either use
.usr.in.!yn$ 3source http%..e$amp!e+com.cron+php
or .usr.in./get 3o .dev.nu!! 3C .dev.nu!!
http%..e$amp!e+com.cron+php! Take a look at the
eample scripts in the scripts+director/! <ake sure to
adFust them to fit /our needs! A "ood crontab line to run
the cron script once ever/ hour 2ould be:
?? F F F F .home.///.drupa!.scripts.cron3!yn$+sh
;ote that it is essential to access cron+php usin" a
bro2ser on the 2eb siteDs domainR do not run it usin"
command line )H) and avoid usin" !oca!host or
1,X+?+?+1 or some of the environment variables 2ill not
be set correctl/ and features ma/ not 2ork as epected!
Directory er/er 1Drupal ites2
The GDrupalG module features a capabilit/ 2hereb/ other
drupal sites ma/ call home to report their eistence! 9n
turn, this enables a pod of Drupal sites to find, cooperate
and advertise each other!
Drupal Handbook: 20 April 2005 135
(urrentl/, the main application of this feature is the
Drupal sites pa"e! -/ default, fresh Drupal installations
can use drupal!or" as their director/ server and report
their eistence! This reportin" occurs via scheduled 8<0+
C)( pin"s!
Drupal administrators should simpl/ enable this feature to
"et listed on the Drupal sites pa"e! 1ust set /our siteDs
name, e+mail address, slo"an and mission statement on the
administer h settin"s pa"e! Then make sure that the field
called Drupal 8<0+C)( server on the administer h
settin"s h drupal pa"e is set to
http:JJ222!drupal!or"Jmlrpc!php, and enable this feature
usin" the dropdo2n directl/ belo2!
The listin" of /our site 2ill occur shortl/ after /our siteDs
net cron run! ;ote that cron!php should be called usin"
the domain name 2hich /ou 2ant to have listed at
drupal!or"! 6or eample, donDt kick off cron b/ reIuestin"
http:JJ12?!0!0!1Jcron!php! 9nstead, use a publicl/
accessible domain name such as
http:JJ222!eample!comJcron!php!
Also note that /our installation need not use drupal!or" as
its director/ server! 6or eample, this feature is perfectl/
capable of a""re"atin" pin"s from all of /our
departmental drupal installations sites 2ithin an
enterprise!
Discussion forums
6orums and containers are used to or"ani=e the threaded
discussions! 6orums ma/ be nested in each other! A
container is used to "roup like forums to"ether 2ith out
allo2in" topics to be created in the container! (ontainers
can be nested Fust like forums
Drupal as a ne*s aggregator
Thousands of 2eb sites, especiall/ ne2s sites and 2eblo"s,
s/ndicate their most recent site content for others to
displa/! The s/ndicated content al2a/s includes titles, also
kno2n as headlines, for the ne2est published stories! Hach
headline acts as a direct link to the stories on the remote
site! Alon" 2ith the headline, most sites t/picall/ provide
Drupal Handbook: 20 April 2005 13%
either the first fe2 para"raphs of the stor/ or a short
summar/! <an/ individuals use client+based ne2s
a""re"ators on their personal computer to a""re"ate
content, such as 6eedDemon 4for ,indo2s5, ;et;e2s,ire
4for <acs5 and AmphetaDesk 4,indo2s, <ac and 0inu5!
Drupal also has a ne2s a""re"ator built in as a standard
feature! ,ith it, /ou can subscribe to feeds from other
sites and displa/ their content for /our site users! *impl/
enable the a""re"ator module in administer h modules,
then click administer h a""re"ator and enter the feeds
that /ou choose!
!hat do " need to subscribe to a feedA
The standard method of s/ndication is usin" the 8<0+
based C** format! C** stands for Ceall/ *imple
*/ndication, CD6 *ite *ummar/, or Cich *ite *ummar/,
dependin" on 2hom /ou talk to! To s/ndicate a siteDs
content, obtain the full 'C0 of the C** pa"e providin"
s/ndication! (ommon file ta"s for C** pa"es are !rss, !ml
and !rdf! Hample: http:JJslashdot!or"Jslashdot!rdf!
<ost 2eblo" sites that offer s/ndication 2ill have an
obvious link on the main pa"e! .ften /ou need onl/ look
for a red 8<0 button, such as the one Drupal uses for site
s/ndication!
*ome sites do not make their C** feeds as eas/ to find! .r
ma/be /ou 2ant to find a number of feeds on a "iven
topic, 2ithout etensivel/ searchin" the 2eb! 9n that case,
tr/ an C** s/ndication director/ such as */ndic&!
To learn much more about C**, here are some "ood
introductions:
<ark )il"rimDs ,hat is C**
,ebCeference!comDs The Hvolution of C**
;.TH: Hnable /our siteDs 8<0 s/ndication button b/
turnin" on the */ndicate block in administer h blocks!
Configuring ne*s feeds
To subscribe to an C** feed on another site, click
administer h a""re"ator!
.nce there, select the add feed tab at the top of the
Drupal Handbook: 20 April 2005 13?
a""re"ator administration pa"e! Drupal 2ill then ask for
the follo2in":
Title ++ The tet entered here 2ill be used in /our
ne2s a""re"ator, 2ithin the administration
confi"uration section, and as title for the ne2s feed
block! As a "eneral rule, use the 2eb site name from
2hich the feed ori"inates!
42" ++ Here /ouDll enter the full/+Iualified 'C0 for
the feed for the site /ou 2ant to subscribe to!
4pdate interal ++ The update interval is ho2 often
Drupal 2ill automaticall/ access the C** 'C0 for the
site for fresh content! The 1 hour default is t/picall/
a "ood minimum to use! Accessin" another siteDs
C** pa"e more freIuentl/ can be considered
impolite because it reIuires the other siteDs server to
handle /our automatic reIuests! To take advanta"e
of this feature, note that cron!php must be
confi"ured to have /our feeds updated re"ularl/!
.ther2ise, /ouDll have to manuall/ update feeds one
at a time 2ithin the ne2s a""re"ation administration
4administer h a""re"ator5 section!
.nce /ou submit /our ne2 feed, check to see if it is
2orkin" properl/! *elect update items on the main ne2s
a""re"ation pa"e! 9f /ou do not see an/ items listed for
that feed, edit the feed and make sure that the 'C0 2as
entered correctl/!
Creating Categories in the Aggregator
#o to administer h a""re"ator then click on the add
cate"or/ tab!
Add a title to the cate"or/, then a description!
9f /ou 2ish to have a block of the last items from
that cate"or/, select the number of items in G0atest
items blockG! To place the block on /our sidebar, "o
to administer h blocks and look for the cate"or/ /ou
Fust created!
;o2 ever/ time /ou add a feed, /ou can select a cate"or/
2hich the items 2ill automaticall/ appear under!
Alternativel/, /ou can ta" individual items in /our
a""re"ator to appear in a cate"or/!
Drupal Handbook: 20 April 2005 13&
Tagging "ndi/idual "tems in the Aggregator
To "et to the cate"ori=ation screen, in /our sidebar
navi"ation, click ne2s a""re"ator
Here /ou have t2o options:
click cate"ories, then the cate"or/ /ou 2ish to
look at, then the cate"ori=e tab!
click sources, then the feed source /ou 2ith to
look at, then the cate"ori=e tab!
Kou 2ill be presented 2ith a list of items to
cate"ori=e, plus to the ri"ht, the cate"ories 2hich
/ou can assi"n to each item! 9f /ou have the multiple+
select option enabled in the a""re"ator
confi"uration, /ou can select more than one cate"or/
for an item b/ holdin" do2n (TC0 4)(5 or (<D
4<ac5 and clickin" on each cate"or/!
Using the 7e*s Aggregator
The ne2s a""re"ator has a number of 2a/s that it displa/s
/our subscribed content:
"atest /ews ++ Displa/s all incomin" content in the
order received
2ith
The title of the ori"inal post!
The name of the source, 2hich acts as a link to
an individual feed pa"e, listin" information
about that feed and incomin" content for that
feed onl/!
A description, the first fe2 para"raphs or
summar/ of the ori"inatin" post 4if an/5!
The list of cate"ories that the feed 4or feed
item5 belon"s to, 2ith a link to each cate"or/!
/ews by !ource: .r"ani=es incomin" content b/
feed, displa/in" titles 2hich link to the ori"inatin"
post! Also has an icon 2hich acts as blo" it link!
/ews by Topic: .r"ani=es incomin" content b/
bundles, displa/in" titles 2hich link to the
ori"inatin" post! Also has an icon 2hich acts as blo"
it link!
/ews !ources: Displa/s an alphabetical listin" of all
subscribed feeds and a description! The title acts as
a link to an individual feed pa"e, listin" information
Drupal Handbook: 20 April 2005 133
about that feed and incomin" content for that feed
onl/!
$ feed blocks
9n addition to providin" subscribed content throu"h the
ne2s a""re"ator, Drupal automaticall/ can create a block
for ever/ feed as 2ell as ever/ cate"or/, thou"h the
administrator can choose 2hether or not a feed or
cate"or/ "ets its o2n blocks b/ confi"urin" the individual
feeds and cate"ories! Hnable an/ or all of the blocks usin"
block mana"ement b/ clickin" administer h blocks!
C-tending user information 1profiles2
Drupal has a profile module for etendin" user information
fields! this allo2s /ou to add custom fields to a users
database entr/!
9n addition it allo2s /ou to specif/ 2hether these ne2
options are mandator/, public, private and if the/ are part
of the ne2 user re"istration process!
About e-tending the profile module0
The profile module can be etended to include additional
information b/ addin" in ne2 form fields! This adds
custom fields to the userDs database entr/!
Kou can choose from a variet/ of form fields to appear on
the profile entr/ pa"e:
sin"le+line tetfield
multi+line tetfield
checkbo
list selection
freeform list
'C0
date
Kou ma/ also specifi/ 2hether the profile options are
mandator/, public, privateR and if the/ are part of the ne2
user re"istration process!
Drupal Handbook: 20 April 2005 200
4o* to e-tend the profile module0
Hnable the profile module:
9n administer h modules select in the DHnableD
column 2here /ou see:
profile T *upport for confi"urable user profiles!
Add in custom fields:
;avi"ate to the administration area:
administer jh settin"s jh profiles
*elect a form field t/pe under DAdd ne2 fieldD
6ollo2 onscreen instructions for confi"urin"
this field, and Dsave fieldD!
Pictures 1a/atars2 in the user.module
;ote that user pictures 4or avatars5 or pictures are part of
the user!module, not the profile module!
;avi"ate to the administration area for user module
confi"uration pa"e under administer h users h
confi"ure
9n the )ictures settin"s, for )icture support, select
Hnabled 4Hnable picture support!5
;ote: /ou must 2rite in /our director/ name! <ake
sure the director/ is created and make sure /ou have
that director/ has 2rite permissions 4that is, chmod
to ?555!
(lick Dsave confi"urationD
,ocale or internationali)ation support
<ost pro"rams are 2ritten and documented in Hn"lish,
and primaril/ use Hn"lish to interact 2ith users! This is
also true for a "reat deal of 2eb sites! Ho2ever, most
people are less comfortable 2ith Hn"lish than 2ith their
native lan"ua"e, and 2ould prefer to use their mother
ton"ue as much as possible! <an/ people love to see their
2eb site sho2in" a lot less Hn"lish, and far more of their
o2n lan"ua"e! Therefore Drupal provides a frame2ork to
setup a multi+lin"ual 2eb site, or to over2rite the default
Hn"lish tets!
Drupal Handbook: 20 April 2005 201
4o* to interface translation *orks
,henever Drupal encounters an interface strin" 2hich
needs to be displa/ed, it tries to translate it into the
currentl/ selected lan"ua"e! 9f a translation is not
available, then the strin" is remembered, so /ou can look
up untranslated strin"s easil/!
Drupal provides t2o options to translate these strin"s!
6irst is the inte"rated 2eb interface, 2here /ou can
search for untranslated strin"s, and specif/ their
translations via simple 2eb forms! An easier, and much
less time consumin" method is to import translations
alread/ done for /our lan"ua"e! This is achieved b/ the
use of #;' "ettet )ortable .bFect files! These are
editable 2ith Iuite convenient desktop editors specificall/
architected for supportin" /our 2ork 2ith #;' #ettet
files! The import feature allo2s /ou to add strin"s from
such files into the site database! The eport functionalit/
enables /ou to share /our translations 2ith others,
"eneratin" )ortable .bFect files from /our site strin"s!
8oderation+ collaborati/e rating
,e like to eperiment 2ith moderation, trust metrics and
collaborative filterin"! ,h/E To help individuals and
communities address the challen"es of information
overload!
As each ne2 piece of information competes for attention,
people Iuickl/ tend to become over2helmed and seek
assistance in identif/in" the most interestin", 2orth2hile,
valuable or entertainin" items! ;ot to mention the fact
that reader+contributed content and other levels of
interactivit/ tend to become chaotic, bloated and
disreputable!
Therefore, 2e decided to develop a public s/stem po2ered
b/ a communit/ that aims to brin" Iualit/ content to
ever/oneDs attention and to filter out all Funk: to sort the
2heat from the chaff! The output should be somethin"
clean and homo"eni=ed featurin" Iualit/ content, and
should slide do2n the "ullet far more easil/!
Drupal Handbook: 20 April 2005 202
8oderation (ueue
An/one 2ho visits and has some ne2s or some thou"hts
the/Dd like to share, can submit ne2 content for
consideration! After someone has submitted somethin",
their node is added to a Iueue! All re"istered users can
access this list of pendin" nodes, that is, nodes that have
been submitted, but do not /et appear on the public front
pa"e! Those re"istered users can vote 2hether the/ think
the node should be posted or not! ,hen enou"h people
vote to post a node, the node is pushed over the threshold
and up it "oes on the public pa"e! .n the other hand,
2hen too man/ people voted to drop a node, the node 2ill
"et trashed!
<oderation depends upon activation of the Iueue module!
'sers need the Gaccess submission IueueG before the/ are
able to access the submission Iueue!
Comment rating
An/one 2ith a user account 2ill be able to moderate
comments! This lets people assi"n a score to a comment
on ho2 "ood the/ think the comment is or ho2 visible the/
think it should be!
,hen more than one person rates a comment, the overall
ratin" is Fust a simple avera"e of all ratin"s! (omments
2ith hi"h ratin"s are more visible than comments 2ith a
lo2er ratin"! That 2a/, comments that "ain the approval
of participants 2ill "raduall/ move up throu"h statistical
effects and pointless comments 2ill sink into oblivion!
Hence, the purpose of comment moderation is t2o+fold:
To brin" the reall/ "ood comments to ever/oneDs
attention!
To hide or "et "et rid of spam, flamebait and trolls!
9n the latter, comment moderation provides a technical
solution to a social problem!
Polls or en(uetes
'sers 2ith the correct permissions can create andJor vote
on polls!
Drupal Handbook: 20 April 2005 207
To create a poll a user needs the Gcreate pollsG
permission!
To vote on a poll Iuestion a user must have the Gvote
on pollsG permission!
To vie2 the results one needs the Gaccess contentG
permission!
To administer polls /ou need the Gadminister nodesG
permission!
(reatin" a poll is much like creatin" an/ other node! (lick
Gcreate pollG in /our user bo! The title of the poll should
be the Iuestion, then enter the ans2ers and the GbaseG
vote counts! Kou can also choose the time period over
2hich the vote 2ill run!
The )oll item in the navi"ation links 2ill take /ou to a
pa"e 2here /ou can see all the current polls, vote on them
4if /ou havenDt alread/5 and vie2 the results!
Post content using the &logger AP"
This module adds support for several 8<0+C)( based
blo""in" A)9s! *pecificall/, it currentl/ implements the
-lo""er A)9, <eta,eblo" A)9, and most of the <ovable
T/pe A)9! etensions! This allo2s users to contribute to
Drupal usin" eternal #'9 applications, 2hich can often
offer richer functionalit/ that online forms based editin"!
This module also allo2s site administrators to confi"ure
2hich node t/pes can be posted via the eternal
applications! *o, for instance, users can post forum topics
as 2ell as blo" posts! ,here supported, the eternal
applications 2ill displa/ each node t/pe as a separate
Gblo"G!
Putting blocks *ith content in the sidebars
-locks are the boes visible in the sidebar4s5 of /our 2eb
site! These are usuall/ "enerated automaticall/ b/
modules 4e!"! recent forum topics5, but /ou can also create
/our o2n blocks!
The sidebar each block appears in depends on both 2hich
theme /ou are usin" 4some are left+onl/, some ri"ht, some
both5, and on the settin"s in block mana"ement!
Drupal Handbook: 20 April 2005 20$
The block mana"ement screen lets /ou specif/ the vertical
sort+order of the blocks 2ithin a sidebar! Kou do this b/
assi"nin" a 2ei"ht to each block! 0i"hter blocks 4smaller
2ei"ht5 Gfloat upG to2ards the top of the sidebar! Heavier
ones Gsink do2nG to2ards the bottom of it!
A blockDs visibilit/ depends on:
9ts enabled checkbo! Disabled blocks are never
sho2n!
9ts throttle checkbo! Throttled blocks are hidden
durin" hi"h server loads!
9ts path options! -locks can be confi"ured to onl/
sho2Jhide on certain pa"es!
'ser settin"s! Kou can choose to let /our users
decide 2hether to sho2Jhide certain blocks!
9ts function! D/namic blocks 4such as those defined
b/ modules5 ma/ be empt/ on certain pa"es and 2ill
not be sho2n!
Administrator defined blocks
An administrator defined block contains content supplied
b/ /ou 4as opposed to bein" "enerated automaticall/ b/ a
module5! Hach admin+defined block consists of a title, a
description, and a bod/ 2hich can be as lon" as /ou 2ish!
The Drupal en"ine 2ill render the content of the block!
earch configuration
(heck that the *earch module is selected in Home jh
administer jh settin"s!
9n the *earch *ettin"s 4a submenu item under Home jh
administer jh settin"s5 pa"e, save the confi"uration!
Cecommended settin"s are belo2!
The *earch bo should no2 appear in /our banner!
-e sure cron!php is runnin"! 9t updates the search
ke/2ord indees!
9f /ou are usin" multiple virtual drupal sites 2ith their
o2n database instances in </*M0, the/ each 2ill need a
separate crontab entr/!
The normal entr/ looks like this:
Drupal Handbook: 20 April 2005 205
00 O O O O 2"et +. + +I http:JJdrupalJcron!php
Kou need to add:
00 O O O O 2"et +. + +I http:JJvhostJcron!php
for each of /our vhosts!
2ecommended search settings:
<inimum 2ord len"th to inde: 7 4the default5
<inimum 2ord len"th to search for: 7 4the default5
tatistics+ top nodes and access log
"ntroduction
The statistics module keeps track of numerous statistics
for /our site but be 2arned, statistical collection does
cause a little overhead, thus ever/thin" comes disabled
b/ default!
The module counts ho2 man/ times, and from 2here ++
usin" HTT) referrer ++ each of /our posts is vie2ed! .nce
2e have that count the module can do the follo2in" 2ith
it:
The count can be displa/ed in the nodeDs link section
net to Gk commentsG!
A confi"urable block can be added 2hich can displa/
a confi"urable number of the da/Ds top stories, the
all time top stories, and the last stories read!
A confi"urable user pa"e can be added, 2hich can
displa/ the da/Ds top stories, the all time top stories,
and the last stories read! Kou can individuall/
confi"ure ho2 man/ posts are displa/ed in each
section!
;otes on usin" the statistics:
9f /ou enable the vie2 counters for content, this adds
1 database Iuer/ for each node that is vie2ed 42
Iueries if itDs the first time the node has ever been
vie2ed5!
9f /ou enable the access lo", this adds 1 database
Iuer/ for each pa"e that Drupal displa/s! 0o""ed
information includes: HTT) referrer 4if an/5, node
bein" accessed 4if an/5, user 9D 4if an/5, the 9)
address of the user, and the time the pa"e 2as
Drupal Handbook: 20 April 2005 20%
vie2ed!
As 2ith an/ ne2 module, the statistics module needs to be
enabled before /ou can use it! Also refer to the
permissions section, as this module supports four separate
permissions!
Configuring the statistics module
There are some confi"uration options added to the main
administer h settin"s h statistics section:
enable access lo" ++ allo2s /ou to turn the access lo"
on and off! This lo" is used to store data about ever/
pa"e accessed, such as the remote hostDs 9) address,
2here the/ came from 4referrer5, 2hat node the/Dve
vie2ed, and their user name! Hnablin" the lo" adds
one database call per pa"e displa/ed b/ Drupal!
discard access lo"s older than ++ allo2s /ou to
confi"ure ho2 lon" an access lo" entr/ is saved,
after 2hich time it is deleted from the database
table! To use this /ou need to run Gcron!phpG
enable node vie2 counter ++ allo2s /ou to turn on
and off the node+countin" functionalit/ of this
module! 9f it is turned on, an etra database Iuer/ is
added for each node displa/ed, 2hich increments a
counter!
displa/ node vie2 counters ++ allo2s /ou to "loball/
disable the displa/in" of node vie2 counters!
Popular content block
This module creates a block that can displa/ the da/Ds top
vie2ed content, the all time top vie2ed content, and the
last content vie2ed! Hach of these links can be enabled or
disabled individuall/, and the number of posts displa/ed
for each can be confi"ured 2ith a drop do2n menu! 9f /ou
disable all sections of this block, it 2ill not appear!
DonDt for"et to enable the block!
upport for static pages
previous
net
Drupal Handbook: 20 April 2005 20?
up
*tatistics, top nodes and access lo"
Taonom/ 4alias sections and cate"ories5
Ta-onomy 1alias sections and categories2
'nlike man/ content mana"ement s/stems, Drupal does
much more than implement a simple cate"or/ list for each
content t/pe! 9nstead, DrupalDs fleible taonom/ s/stem
allo2s administrators to create a virtuall/ unlimited
number of separate classification schemes! ,hether
creatin" either ver/ simple or etremel/ comple
taonomies, administrators also choose 2ith 2hich Drupal
node t/pes to use these classifications! .nce nodes are
created and ta""ed, users have various options for
bro2sin" cate"or/ or"ani=ed content!
6ocabularies and Terms
Hach cate"or/ "roup, or vocabular/, can contain multiple
cate"or/ entries, or terms, for ta""in" content!
6or eample, a 2eb+based discussion communit/ mi"ht
have a vocabular/ Topics 2ith terms such as
Technolo"/
)olitics
Hducation
Celi"ion
*ports
An administrator mi"ht also choose to create multiple
vocabularies for use 2ith the same node t/pe! (onsider
another vocabular/ for use alon"side of Topics, one 2hich
classifies nodes in another 2a/:
(ontent 2ith terms
;e2s
Cevie2s
Announcements
.pinions
;e2 vocabularies can also be created or added to at an/
time, 2ith as fe2 or as man/ terms as the administrator
ma/ need! And do not 2orr/! 0on" before reachin"
DrupalDs limits at handlin" ver/ lar"e classification
Drupal Handbook: 20 April 2005 20&
schemes, users 2ould find lar"e vocabularies and terms
un2ield/ to use and maintain!
;.TH: ,hen creatin" terms for a ne2 vocabular/,
administrators mi"ht 2ant to provide users 2ith a catchall
term, such as <iscellaneous! Administrators can then
revie2 nodes ta""ed 2ith <iscellaneous to see if a need
eists for ne2 terms! .nce ne2 terms are created,
ambitious administrators can also update nodes 2ith the
ne2 ta" and remove the catchall cate"or/ ta"!
Creating a 6ocabularly
,hen settin" up a vocabular/, Drupal 2ill prompt for:
Iocabulary name 4CeIuired5 ++ A name for this
vocabular/R for eample,
Topics!
Description 4.ptional5 ++ A description of the
vocabular/ 4this
item ma/ be used b/ some modules and feeds5!
Types 4CeIuired5 ++ A vocabular/ ma/ be associated
2ith either a
sin"le or multiple node t/pes! *o, an administrator
mi"ht select to have a
vocabular/ associated 2ith stories and blo"s, but not
book pa"es! 9f an epected
node is unavailable, check and make sure that the
module for the specific
node t/pe has been activated!
2elated terms 4.ptional5 ++ Allo2s relationships
bet2een terms 2ithin this vocabular/! Think of these
as see also+references
4this item not used b/ man/ Drupal modules5!
-ierarchy 4.ptional5 ++ Allo2s a tree+like
taonom/ 4see 'sin" Hierarchies belo25!
$ultiple select 4.ptional5 ++ Allo2s users to
cate"ori=e nodes b/
more than one term! 'seful for cross+indein"
content! ;odes ma/ then appear
on multiple taonom/ pa"es!
2equired 4.ptional5 ++ CeIuires a user to select a
term in this vocabularl/
in order to submit the node! .ther2ise, 2hen
creatin" a node, users 2ill be
Drupal Handbook: 20 April 2005 203
offered a none option as the default for each
vocabular/!
Weight 4.ptional5 ++ Allo2s the administrator to set
the priorit/
of this vocabularl/ 2hen listed 2ith other
vocabularies! ;ormall/, 2hen vocabularlies
are left on the default of =ero, Drupal displa/s
multiple vocabularlies in
alphabetical order! *ettin" a vocabular/ 2ei"ht
heavier 4positive numbers5
than other vocabularies 2ill make the specific
vocabularl/ appear at the bottom
of the list! 0i"hter 4a ne"ative number5 2ill push the
vocabularl/ to the
top of the list! 'seful for specif/in" 2hich vocabular/
a user sees first
2hen creatin" a node!
Creating Terms
.nce finished definin" the vocabular/, a vocabular/ must
be populated 2ith terms! ,hen creatin" a term, note that
the available options ma/ depend on 2hat 2as selected for
related terms, hierarch/ and multiple select 2hen creatin"
the vocabular/:
Term name 4CeIuired5 ++ The name for this term!
Hample: Technolo"/!
Description 4.ptional5 ++ Description of the term
4this item ma/
be used b/ some modules and feeds5!
1arent 4CeIuired5 ++ *elect the term under 2hich
this term is a subset ++ the branch of the hierarch/
that this term belon"s
under 4onl/ reIuired 2hen heirarch/ is enabled for
the vocabular/5!
!ynonyms 4.ptional5 ++ Hnter s/non/ms for
this term, one s/non/m per line! */non/ms can be
used for variant spellin"s,
acron/ms, and other terms that have the same
meanin" as the added term, but
2hich are not eplicitl/ listed in this thesaurus, i!e!
unauthori=ed terms
4this item not used b/ man/ Drupal modules5!
Drupal Handbook: 20 April 2005 210
Weight 4.ptional5 ++ The 2ei"ht is used to sort the
terms of this
vocabular/ 4see eplanation of 2ei"ht above5!
Ad/anced0 Using 4ierarchies
6or man/ users needin" simple classification schemes, the
eamples above ma/ be the onl/ structure necessar/ for
ta""in" site content! 6or more elaborate classification
needs, consider the hierarch/ option 2hen creatin"
vocabularies! Hierarchies allo2 the creation of
sophisticated taonomies 2ith cate"ories and
subcate"ories in a tree structure, much like Kahoo
cate"ories or subFect classifications used b/ libraries!
6or eample, the vocabular/ 6ood could include the
follo2in" cate"ories and subcate"ories:
Dair/
<ilk
Drink
Alchohol
-eer
,ine
)op
<ilk
<eat
-eef
(hicken
0amb
*pices
*u"ar
;ote that the term <ilk appears 2ithin both Dair/ and
Drink! This is an eample of multiple parents for a term!
1ust select both parents 2hen creatin" the term <ilk!
DonDt for"et that that the order of term siblin"s 4e!"! -eef,
(hicken, 0amb5 can be controlled 2ith the 2ei"ht option!
6or an eample of a Drupal site 2hich makes use of both
multiple cate"ories and heirarchies to classif/ hundreds of
nodes, check out 0an"emarks (afeDs (ate"ories pa"e!
Using 6ocabularies0 Displaying 7odes by Terms
,hen displa/in" nodes, both in teaser listin"s on the
Drupal Handbook: 20 April 2005 211
Drupal home pa"es and in full, sin"le+node vie2, man/
Drupal themes displa/ the cate"ories applied to the node!
9f the user selects an/ cate"or/ term, Drupal 2ill then
displa/ a bro2sable listin" for all nodes ta""ed 2ith that
term!
Hamine the Taonom/ 'C0 for one such cate"or/ listin"!
The end of the 'C0 should look somethin" like this:
taonom/Jpa"eJorJ1
And another Taonom/ 'C0, for a different term,
somethin" like this
taonom/Jpa"eJorJ2
;ote that Taonom/ 'C0s al2a/s contain one or more
Term 9Ds at the end of the 'C0! These numbers, 1 and 2
above, tell Drupal 2hich cate"ories to displa/!
;o2 combine the Term 9DDs above in one 'C0 usin" a
comma as a delimter
taonom/Jpa"eJorJ1,2
The resultin" listin" includes all nodes ta""ed 2ith either
term! ,ant to combine more cate"oriesE 1ust add more
commas and numbers! >no2 that /ou can use the
taonom/ section in Drupal site administration to find out
an/ Term 9D! 1ust place the cursor over an/ edit term and
look to the status bar at the bottom of the bro2ser! Then
substitute the ne2 Term 9DDs found there to create a
different cate"or/ listin"!
*ometimes, listin" all nodes for either term returns more
than a user ma/ need! A user mi"ht onl/ be lookin" for
nodes 2hich eist in both cate"ories onl/! To create a
boolean GA;DG listin", chan"e the Iuer/strin" parameter
from GorG to GandG:
taonom/Jpa"eJandJ1,2 !
9n addition to displa/in" Drupal nodes b/ cate"or/ on site,
Drupal has cate"or/ specific C** feeds for other sites to
access /our site content! *ee ho2 the 'C0 format for the
C** feed is ver/ similar to the Taonom/ 'C0:
taonom/JfeedJorJ1,2
-uilt like a Taonom/ 'C0, it starts 2ith taonom/Jfeed,
then has the Iuer/ strin" parameter, and finall/ the term
Drupal Handbook: 20 April 2005 212
9Ds!
-uildin" individual Taonom/ 'C0Ds is not the most user
friendl/ 2a/ to provide site users access to bro2seable
listin"s! ;or do administrators necessaril/ 2ant to build
custom blocks for users 2ith links to each cate"or/ listin"!
To si"nificantl/ etend the means of accessin" nodes b/
cate"or/, do2nload and install the optional taonom/Nhtml
and taonom/Ndhtml modules from the Drupal do2nloads
pa"e! Hach module provides a sli"htl/ different approach
to creatin" vocabularl/ and term listin"s pa"es for users,
as 2ell as optional side blocks! Tr/ both and decide 2hich
is best for users on /our site! Hither 2ill certainl/ increase
each site userDs abilit/ to bro2se content
8ore about Ta-onomy
Taonom/ is more than Fust a module in Drupal! 9t is also
the stud/ of classification and a research area of
information science in the di"ital a"e! Drupal
admnistrators 2ho 2ant to push the limits of the Drupal
taonom/ s/stem mi"ht 2ant to read about classification
theor/ and application, as 2ell as ho2 it applies to Drupal
taonom/ module development!
Creating a &lock *ith links belonging to
certain ta-onomy terms
+uestion
2arNboar 2rote:
ho2 to have a block of links to all terms 2hich
match taonom/ like Cevie2s: Anime .r
Cevie2s: <ovies 2ithout doin" it manuall/
it should be titled, Cevie2s and underneath all
blo"s or stories 2hich matched!
Answer
As a demo, see the block named )h/sicians at
9nternists!net
Kou 2ill need to create a ne2 -lock of type=php! Kou 2ill
Drupal Handbook: 20 April 2005 217
then 2ant to paste in the code belo2, and customi=e the
D)h/siciansD subFect and the Wta arra/! Wta the list of tids
that /ou are inetrested in! The third element, named
DoperatorD, can be and or or! *o in /our case, assumin" the
term 9D for movies is D7D and the term 9D for Anime is D%D,
/ou 2ant:
$ta$ = array (@'-); *operator* =& *or*);
<?php
.. paste this code into a custom !oc( of type=php
.. customi4e the $ta$ array and the $su2ect as
needed
$ta$ = array(1' ,);
$operator = *or*;
$resu!t = ta$onomy_se!ect_nodes($ta$' $operator);
/hi!e ($o2 = d_fetch_o2ect($resu!t)) {
$node = node_!oad(array('nid' =& $o23&nid));
$items[" = !($node3&tit!e' *node.*+ $node3&nid);
)
return theme('item_!ist'' $items);
?&
Tracker
The tracker module is a hand/ module for displa/in" the
most recentl/ added or updated content to a Drupal site!
The link to the tracker is labeled recent posts in the userDs
navi"ation block! 'pdates include chan"es to the tet b/
either the ori"inal author or someone else that has
permission to edit the content, such as an editor or
administrator as 2ell as all comments added to an item!
The Tracker module presents a pa"e listin" the recentl/+
updated content 2ritten b/ the user 2ith the content t/pe,
the title, the userDs name, ho2 man/ comments that item
has received, as 2ell as ho2 lon" a"o it 2as updated! 9f an
item 2as 2ritten b/ someone else, tracker 2ill sho2 that
item at the top of the list! An eample:
A user named 1essica 2rites a blo" post, then some time
passes, and others 2rite blo" posts! Then if 1ohn posts a
comment to 1essicaDs post, and /ou have bookmarked
1ohnDs tracker pa"e 4see belo2 on ho2 to do this5 then
1essicaDs content 2ill appear at the top!
Drupal Handbook: 20 April 2005 21$
9f an user 2ith administer comments 4e!"! an administrator
or editor of a site5 deletes a comment 4e!"! it is off+topic,
inappropriate lan"ua"e, or unsolicited advertisement5, the
content item 2ill drop do2n to 2hen it 2as updated
previous to that deleted comment!
To use the Tracker module to G2atchG for a userDs updated
content, click on that userDs profile, then the GtrackG tab!
U$, aliasing
&ackground
A ver/ po2erful feature of Drupal is the abilit/ to have
control over all paths! The path module is the tool that
provides this functionalit/ and is part of the basic Drupal
installation, althou"h it is not enabled b/ default! *ome
eamples of re+mappin" paths are:
user.!ogin =& !ogin
image.tid.1- =& store
ta$onomy.term.XW1YW,?W,1 =& store.products./hir!ygigs
node.@ =& contact
This functionalit/ inte"rates seamlessl/ into node forms
and also provides the administrator an interface to vie2 all
aliases that have been created!
Aliases have a man/ to one relationship 2ith their ori"inal
Drupal 'C0s! 9n other 2ords /ou can have man/ different
aliases map to a sin"le path! An eample of 2here a
multiple aliases come in hand/ is creatin" a standard C**
feed 'C0:
node.feed =& rss+$m!
node.feed =& inde$+rdf
,hen Drupal "enerates links for a path 2ith multiple
aliases it 2ill choose the first alias created per s/stem
'C0! *o in our above eample, Drupal 2ould use rss!ml
as the default alias rather than inde!rdf! To chan"e this
behavior, delete the aliases for nodeJfeed and create the
inde!rdf alias before rss!ml!
Drupal Handbook: 20 April 2005 215
Permissions
T2o permissions are related to 'C0 aliasin": create url
aliases and administer url aliases!
create url aliases + Allo2s users to create aliases
for nodes! Hnablin" this permission 2ill displa/ a
path field to the user in an/ node form, allo2in"
them to enter an alias for that node! The/ 2ill be
able to editJdelete the alias after it is created usin"
the same form!
administer url aliases + Allo2s users to access the
alias administration interface! This interface displa/s
all aliases and provides a 2a/ to create and modif/
them! This is also the location to build aliases for
thin"s other than nodes! 6or eample, /ou can
create an alias for a taonom/ 'C0 or even re+map
the admin path 4althou"h the ori"inal admin path
2ill still be accessible since aliases do not cancel out
ori"inal paths5!
8ass U$, aliasing
Drupal also comes 2ith user defined mass 'C0 aliasin"
capabilities! Kou mi"ht like to see completel/ different
'C0s used b/ Drupal, or even 'C0s translated to the
visitorsD native lan"ua"e, in 2hich case this feature is
hand/! .nl/ an administrator 2ith access to the 2ebsite
source code can set up this kind of aliases! Kou can define
a conf_ur!_re/rite function in conf!php, follo2in" this
eample:
function conf_ur!_re/rite($path' $mode = 'incoming') {
if ($mode == 'incoming') { .. IG= coming from a c!ient
return preg_rep!ace('Z^disp!ay.(UdW)$Z'' 'node.U1''
$path);
)
e!se { .. IG= going out to a c!ient
$a!iased = preg_rep!ace('Z^node.(UdW)$Z'' 'disp!ay.U1''
$path);
if ($a!iased Z= $path) { return $a!iased; )
)
)
This function 2ill shorten ever/ node.$node_id t/pe of
'C0 to disp!ay.$node_id! 9ndividual 'C0 aliases defined
on the bro2ser interface of Drupal take precedence, so if
Drupal Handbook: 20 April 2005 21%
/ou have the DcontactD pa"e alias from the eample above,
then the disp!ay.@ alias 2ill not be effective 2hen
out"oin" links are created! 9ncomin" 'C0s ho2ever
al2a/s 2ork 2ith the mass 'C0 aliased variant! .nl/ the
Dincomin"D and Dout"oin"D modes are supposed to be
supported b/ /our conf_ur!_re/rite function!
Kou cannot onl/ use this feature to shorten the 'C0s, or to
translate them to /ou o2n lan"ua"e, but also to add
completel/ ne2 sub'C0s to an alread/ eistin" moduleDs
'C0 space, or to compose a bunch of eistin" stuff
to"ether to a common 'C0 space! Kou can create a ne/s
section for eample aliasin" nodes and taonom/ overvie2
pa"es fallin" under a Dne2sD vocabular/, thus havin"
ne/s.16 and ne/s.sections.@ instead of node.16 and
ta$onomy.term.@! Kou need etensive kno2led"e of
DrupalDs inner 2orkin"s and re"ular epressions thou"h to
make such advanced aliases!
!atchdog
previous
net
up
'C0 aliasin"
,eblo"s!com, technorati!com and blo!"s notification
!eblogs.com+ technorati.com and blo.gs
notification
Drupal can automaticall/ send notifications 4called
Gpin"sG5 to the http:JJpin"omatic!comJ to tell them that
/our site has chan"ed! 9n turn pin"omatic!com 2ill pin"
other services like 2eblo"s!com, Technorati, blo!"s,
-lo"Collin", 6eedster!com, <oreover, etc!
The pin" feature reIuires crontab!
User management system
Drupal offers a po2erful access s/stem that allo2s users
to re"ister, lo"in, lo"out, maintain user profiles, etc! 'ser
mana"ement can be easil/ accessed in administer h users
and administer jh access control!
Drupal Handbook: 20 April 2005 21?
8anaging access control *ith permissions and user
roles.
Coles, a 2a/ of assi"nin" specific permissions to a "roup,
allo2 /ou to fine tune the securit/, use and administration
of Drupal! 'sers assi"ned to the role, or "roup, are
"ranted those permissions assi"ned to the role! (ommon
eamples of roles used 2ith 2hich /ou ma/ be familiar
include: anon/mous user, authenticated user, moderator,
and administrator!
-/ default, Drupal automaticall/ defines t2o roles as a
part of site installation:
anonymous user ++ readers of the site 2ho are
either do not have an account or are not lo""ed in!
authenticated user ++ the role assi"ned to ne2
accounts on a Drupal site!
The anon/mous user role should t/picall/ have the least
access to the site of all roles! Authenticated users, because
the/ took the time to re"ister, mi"ht be "iven more
permissions, such as the abilit/ to create some t/pes of
content! 9f administrator approval is reIuired for ne2
users, or if the/ match certain criteria 4such as havin" a
compan/ email address5, /ou ma/ be able to "rant more
permissions that 2a/!
The first Drupal account created on a ne2 installation,
sometimes referred to as the Groot userG, al2a/s has full
permissions for all Drupal activities, includin"
administration and content creation, editin" and removal!
<ore trusted users mi"ht be "ranted special privile"es
throu"h an administrator+created role, and must be
manuall/ added to that role throu"h the user
administration interface! To create ne2 roles:
(lick administer jh access control jh roles tab!
Hnter a label for the ne2 role in the available tet
field at the bottom of the current list of roles!
.nce /ouDve added the role, select the permissions
tab!
Kour ne2 role 2ill be listed as a ne2 column in the
permission matri! #rant permissions to the ne2
role!
To add users to this role /ou 2ill need to edit
Drupal Handbook: 20 April 2005 21&
individual user accounts! (lick administer jh users
and the edit link for the user /ou 2ish to add to the
role! Then /ou can add this user to /our ne2 role
under the Coles section of the user edit pa"e!
Assigning permissions and users to roles
Access to almost all Drupal modules can be controlled b/
either enablin" or disablin" permissions for a "iven role!
As a securit/ precaution, the anon/mous and
authenticated users are confi"ured 2ith ver/ minimal
permissions durin" a site install! KouDll have to consider
2hich permissions to enable!
#o to the permissions administration pa"e 4administer jh
access control jh permissions tab to be"in enablin" or
disablin" permissions! (onsider the follo2in" descriptions
of permissions:
Administer ++ Administer permissions, such as
Gadminister contentG and Gadminister usersG, are
usuall/ reserved for the most trusted site users!
These administration privile"es "rant users
etensive control of the specific module4s5 described
b/ the permission title! 6or eample, 2hen
administer permissions are "ranted on modules
associated 2ith specific node t/pes, the user 2ill be
able to edit and delete all content for that node t/pe
on the entire site! Ceminder: /ouDll have to assi"n
access administration pa"es ri"hts to an/ role 2hich
also needs to confi"ure site options in the
administration menu!
Access ++ )ermissions 2hich "rant access allo2 users
read+onl/ ri"hts or "eneral use of specific site
modules, 2ithout an/ si"nificant confi"uration
privile"es! T/picall/, these roles do not permit the
creation of content! <ost access permissions are
safe to assi"n to an/ user role, althou"h "ivin"
access administration should "enerall/ be reserved
for the most trusted users!
(reate ++ Allo2s users to create, but not necessaril/
edit later, the specified t/pe of content! #enerall/
applies to node t/pes!
<aintain ++ These permissions "enerall/ enable a
user to create content, as 2ell as allo2in" the author
Drupal Handbook: 20 April 2005 213
of the submitted content to edit their o2n content! 9f
/ou 2ant to allo2 ne2 site members to keep a
2eblo" or 2ork on the collaborative book, /ouDll
need to enable maintain permissions for the
authenticated user!
AdBusting permissions after adding modules
,henever a module is enabled, even if it is merel/ turned
off and on, permissions for that module are unassi"ned to
all roles! As a securit/ precaution, an administrator al2a/s
needs to assi"n permissions to roles an/ time a module is
enabled!
User authentication
Ce"istered users need to authenticate b/ suppl/in" either
a local username and pass2ord, or a remote username and
pass2ord such as a Fabber, Delphi, or one from another
Drupal 2ebsite! *ee distributed authentication for more
information on this innovative feature!
The local username and pass2ord, hashed 2ith <essa"e
Di"est 5 4<D55, are stored in /our database! ,hen /ou
enter a pass2ord it is also hashed 2ith <D5 and
compared 2ith 2hat is in the database! 9f the hashes
match, the username and pass2ord are correct!
.nce a user authenticated session is started, and until that
session is over, the user 2onDt have to re+authenticate! To
keep track of the individual sessions, Drupal relies on
)H)Ds session support! A visitor accessin" /our 2ebsite is
assi"ned an uniIue 9D, the so+called session 9D, 2hich is
stored in a cookie! 6or securit/Ds sake, the cookie does not
contain personal information but acts as a ke/ to retrieve
the information stored on /our serverDs side! ,hen a
visitor accesses /our site, Drupal 2ill check 2hether a
specific session 9D has been sent 2ith the reIuest! 9f this
is the case, the prior saved environment is recreated!
User preferences and profiles
Hach Drupal user has a profile, and a set of preferences
2hich ma/ be edited b/ clickin" on the m/ account link! .f
course, a user must be lo""ed into reach those pa"es!
Drupal Handbook: 20 April 2005 220
There, users 2ill find a pa"e for chan"in" their preferred
time =one, lan"ua"e, username, e+mail address, pass2ord,
theme, si"nature, homepa"e, and distributed
authentication names! (han"es made here take effect
immediatel/! Also, administrators ma/ make profile and
preferences chan"es administer jh users on behalf of their
users!
<odule developers are provided several hooks for addin"
custom fields to the user vie2Jedit pa"es! These hooks are
described in the Developer section of the Drupal
Handbook! 6or an eample, see the 2aer_user()
function in JmodulesJFabber!module!
Using distributed authentication
Distributed authentication
.ne of the more tedious moments in visitin" a ne2 2ebsite
is fillin" out the re"istration form! Here at drupal!or", /ou
do not have to fill out a re"istration form if /ou are alread/
a member of Drupal! This capabilit/ is called distributed
authentication, and is uniIue to Drupal, the soft2are
2hich po2ers drupal!or"!
Distributed authentication enables a ne2 user to input a
username and pass2ord into the lo"in bo, and
immediatel/ be reco"ni=ed, even if that user never
re"istered at drupal!or"! This 2orks because Drupal
kno2s ho2 to communicate 2ith eternal re"istration
databases! 6or eample, lets sa/ that ne2 user D1oeD is
alread/ a re"istered member of Delphi 6orums! Drupal
informs 1oe on re"istration and lo"in screens that he ma/
lo"in 2ith his Delphi 9D instead of re"isterin" 2ith
drupal!or"! 1oe likes that idea, and lo"s in 2ith a username
of FoeUremote!delphiforums!com and his usual Delphi
pass2ord! Drupal then contacts the
remote!delphiforums!com server behind the scenes
4usuall/ usin" 8<0+C)(, HTT) ).*T, or *.A)5 and asks:
G9s the pass2ord for user 1oe correctEG! 9f Delphi replies
/es, then 2e create a ne2 drupal!or" account for 1oe and
lo" him into it! 1oe ma/ keep on lo""in" into drupal!or" in
the same manner, and he 2ill al2a/s be lo""ed into the
same account!
Drupal Handbook: 20 April 2005 221
Drupal
Drupal is the name of the soft2are 2hich po2ers
drupal!or"! There are Drupal 2eb sites all over the 2orld,
and man/ of them share their re"istration databases so
that users ma/ freel/ lo"in to an/ Drupal site usin" a
sin"le Drupal 5D!
*o please feel free to lo"in to /our account here at
drupal!or" 2ith a username from another Drupal site! The
format of a Drupal 9D is similar to an email address:
usernameUserver! An eample of a valid Drupal 9D is
mwlilyU222!drupal!or"!
Upgrading from pre/ious /ersions
This chapter contains articles that discuss the up"radin"
process of /our drupal installation!
please note that comments are not meant to address
problems /ou fund durin" installation! 6or problems 2ith
installation, please address /our Iuestions at proper
places
Upgrading from Drupal ?.GG to H.GG
'p"radin" /our Drupal database can be tedious and
sometimes painful! 9 2ould like to make available to the
Drupal communit/ an update
script to make this process easier! )lease keep in mind it
is not perfect and onl/ one possible solution! 9 have also
added some thou"hts on the up"rade process in "eneral!
This ma/ also be useful if /ou are considerin" s2itchin"
from another (<* to Drupal v7!
The script is available to do2nload here:
http:JJ222!nodalpoint!or"Jdo2nloadsJupdate!t"=
;otes on the script:
The update script needs to be run under Drupal rc2 since
it includes various Drupal functions! 9n itDs current state it
is onl/ useful for up"radin" from post node v2 Drupal!
Ho2ever the functions are simple enou"h that onl/
minimal hackin" should be reIuired to up"rade from
Drupal Handbook: 20 April 2005 222
different table structures! *ome brief instructions are
included in the do2nload!
.ther considerations:
'sers, roles and permissions
'sers 2ill need to be "iven a role 2hen the/ are insert
into the database! (heck the insert statement in the
updateNusers45 function! Cead about roles and permissions
here!
*ections vs <eta+ta"s
9n up"radin" from sections to meta+ta"s, 9 chose to dump
sections as meta+ta"s all belon"in" to the one collection!
The script creates the collection! This is of course not the
best 2a/ to utili=e meta+ta"s, Fust a simple 2a/ of dumpin"
sections!
9f others have useful information re"ardin" ho2 to move
from dupal2JnukeJphpslashJslash etc! to Drupal please
submit a revised cop/ of this pa"e or anther book pa"e!
0astl/: remember the usual caveats about backin" up /our
dataL
Upgrading from Drupal H.GG to 4.GG and
later /ersions
Drupal $!0 has an automatic up"rade script 2hat up"rates
/our database from version 7!0 to $!0! )oint /our bro2ser
to http:%%yoursitename.com%update.php and follo2 the
instructions!
;ote: same update script also allo2s to update /our $!0
database to the latest development version!
&ackups
9t is a "ood idea to backup an/ data 2hich /ou 2ould be
sad to lose! .r if /ou 2ould "et fired if /ou lost it!
To backup Drupal data, /ou need to backup /our Drupal
database! 9f /ou use <K*M0, the techniIue for doin" this
is here! *ome2hat obscured on that pa"e is a su""estion
to Fust cop/ the ri"ht m/sIl files to another computer
4the Jdata director/5! That is a "ood, eas/ option!
Drupal Handbook: 20 April 2005 227
Kou mi"ht also 2ish to backup the conf!php file, and an/
Drupal )H) scripts 2hich /ou mi"ht have customi=ed!
&est practices guidelines
9f /ou are "oin" to invest in the time to setup a (<*, then
/ou should make sure /ou protect /our investment 2ith
some simple best practices "uidelines! These "uidelines
are onl/ su""estions on thin"s that need to be considered
2hen mana"in" a 2eb site or (<*! 9t is up to /ou to
decide 2hat is appropriate for /ou to implement for /our
sites!
&acking Up @our Drupal ite
9nIuire about /our 9*) or 2eb hostDs backup
policies! Hven better, do it /ourself periodicall/!
<onthl/, 2eekl/, dail/ or 2hatever fits /our siteDs
needs! Hven if /ou tell /ourself, G9tDs no bi" dealG, it
is and /ou do not 2ant to lose /our content!
-ackin" up /our </*M0 database is covered in
section 5!? of the </*M0 handbook! 6or more
information on backin" up a </*M0 database, read
the disaster prevention "uidelines! 9f /ou are usin" a
different database, then that vendorDs documentation
should have that information!
There are man/ files that are not part of the
database that are important to /our site, so
periodicall/ backup /our entire drupal director/!
This 2ill ensure that an/ uploaded files, pictures,
confi"uration and theme customi=ations are backed
up!
Date /our backups! *ave them in a director/ 2ith the
date of the backup! Kou do not 2ant to be tr/in" to
fi"ure out 2hen /ou last backed up /our site 2hen
/ou are tr/in" to recover it! )anic is not conducive to
a "ood recover/!
.ne alternative solution to backin" up the database
of /our site, is to install the Database Administration
module! 9t has the option to backup the database
tables from 2ithin Drupal itself! 4;ote: -e careful
2ith the permissions!5
9f /ou are usin" third part/ database mana"ement
Drupal Handbook: 20 April 2005 22$
tools such as php</Admin, check out the
php</Admin online documentation that can help
2ith creatin", mana"in" and backin" up /our
databases!
Document /our backup and restore procedure so
that /ou can repeat the process easil/ if necessar/!
9deall/ /ou 2ant to store the backup and restore
process offline or on a site on a different server than
/our Drupal site!
Test ites
*et up a test site usin" /our live data! Kou do not 2ant to
have to ask in the forums ho2 to save /our site! Kou have
2orked hard to build it, it 2ould be a shame to lose it!
;ever do development or testin" on /our live
production site! Drupal is fast and eas/ to install!
Al2a/s test on a test site first!
Test that /our backups 2ork and that /ou kno2 ho2
to do a restore of /our site! The test s/stem can be
/our local desktop, Fust edit /our conf!php file to
localhost! Kou do not 2ant to discover the hard 2a/
that /ou for"ot a file or did not kno2 ho2 to do this
2hen /our site is do2n!
Test /our site up"rade procedure before riskin" /our
live site and document the steps /ou take!
Documentation aids repeatin" the process if
necessar/!
3ile # directory management
<odules that are not part of core ma/ or ma/ not be
supported b/ their contributor for a Drupal version
up"rade!
(reate a sub director/ in modules for each contrib
module /ou install! This helps /ou track contributed
modules vs included core modules!
6or eample: a module named foo!module 2ould "o
in a sub director/ of modules fooR modulesJfoo
Cename or remove update!php from the root of /our
Drupal director/ unless /ou are actuall/ updatin"
/our site! There are protections for it in the update
script, but 2h/ take a chance!
Drupal Handbook: 20 April 2005 225
9f /ou mana"e more then one site, consider puttin" a
version!tt file in the root of /our drupal director/
2ith the Drupal version, date and modules /ou are
usin"! 9f /ou onl/ mana"e a fe2 sites /ou 2ill
probabl/ remember them all, but if /ou set them up
for other people, these reminders can help /ou if /ou
are asked back to do additional 2ork! Also, it can
help the net site admin if /ou move on!
Accounts and roles
Do not use the first user account for da/ to da/ stuff
on /our site! This account should be used for the site
setup, maFor confi"uration chan"es and up"rades
onl/!
*et up some appropriate roles 4do not for"et to
update these roles as /ou add ne2 modules5! *ome
role su""estions are Dsite adminD, Duser adminD, Dsite
contributorD! ,hat roles /ou need to create 2ill
depend on the t/pe of site /ou have desi"ned! ;ote
that an/one 2ho can administer users can "rant
themselves additional permissions!
Troubleshooting 3A9
)erhaps /our Iuestion has been asked and ans2ered
alread/! (heck this 6AM or perform a search to find an
ans2er! 9f /ou donDt find an ans2er here, ask /our
Iuestion in the *upport forum!
"nstallation # Configuration
Dheaders already sentD error
9f /ou "et a Gheaders alread/ sentG error, there are t2o
likel/ causes!
9f this error is not the first error messa"e on the pa"e,
then it is most likel/ a Daalance effectD of previous errors
and /ou ma/ i"nore it! 9nstead, focus on fiin" the errors
before it! ,hen /ou fi the first error messa"e4s5, the
Gheaders alread/ sentG error4s5 2ill most likel/ disappear!
Drupal Handbook: 20 April 2005 22%
Ho2ever, if /ou "et an error Gheaders alread/ sentG as the
first error, especiall/ 2hen tr/in" to lo" in and it tells /ou
the error is near the end of a file 4check 2hich file Goutput
started atG points to5, that probabl/ means that there are
e0tra spaces or lines after the closin" E_ php ta"! 1ust
delete them, and ever/thin" should 2ork fine!
The etra 2hitespace bein" added probabl/ is caused b/ a
bad unpackin" pro"ram and J or a 2indo2s editor addin"
it!
9f /ou 2ant to learn more about this, Hvil ,alrus has a
"ood tutorial about this!
D,'C; TA&,C se(uences !$"TCD Crror
This is in reference to the follo2in" kind of error:
user error% <ccess denied for user% 'PCIG H<;<M<:A
I:AGS!oca!host' to dataase 'PCIG H<;<M<:A'
7uery% =CBT ;<M=A: se7uences OG8;A in .your
/esite.dataase+mys7!+inc on !ine $$
,hen /ou installed Drupal, /ou created a database and a
database user! This error is caused b/ that user not havin"
a certain privile"e over /our database! As far as 9 can tell,
it does not prevent /ou from postin" content, but it does
make a lot of u"l/ errors!
,hen /ou come across this problem, first, double check
that /ou have "ranted all privile"es to /our user! There
are instructions on ho2 to do this in the install file that
comes 2ith /our Drupal installation!
9f /ou still "et this problem, and /ou are usin" shared
hostin", it is ver/ likel/ that /our host does not usuall/ let
users have the kind of permission reIuired! 6or reference,
/ou ma/ 2ant to read these forum posts! Kou need to
contact /our host 4e+mail seems better than live support
for this5 and ask 4if /ou are usin" m/*M0 $5 for global
"DCJ TAB",! priilege for /our user in that database!
Althou"h there are fies in the forums, these are not
recommended! 9f /our host denies /our reIuest, the/ ma/
not be an appropriate place for /our Drupal site!
Drupal Handbook: 20 April 2005 22?
Dmethod P'T is not allo*ed for the U$, #
inde-.htmD Crror
*olution b/: Al
Kour Drupal director/ contains both an inde!html and
inde!php file! Cemove the inde!html file or confi"ure
/our 2eb server to look for inde!php first before
inde!html!
.ri"inal postin"
.htaccess page forbidden
*olution: Add G6ollo2*/m0inksG to the .ptions line to the !
htaccess file 2hich b/ default onl/ has G+9ndeesG! ie use
somethin"s like:
.ptions 6ollo2*/m0inks +9ndees
.ri"inal postin"
C%8ail from Drupal is &ouncing or not being
ent
9f /ou are not receivin" an/ H+mails from Drupal, or if H+
mail sent b/ Drupal is bouncin", then ensure that the
*<T) confi"uration is set properl/ in /our php!ini!
9f /ou continue to have problems, the use the
GuserNmailN2rapperG option included 2ith Drupal!
Kou can no2 hook up /our o2n custom *<T)
librar/ to Drupal instead of usin" the default )H)
mail45 function! 6or more people mail45 2ill 2ork
Fust fine, but for others this is a maFor problem
and it does not 2ork properl/! 9f /ou Fust 2ant to
"et started /ou 2ill have to do2nload a custom
2rapper function from the Drupal contrib
repositor/! 9f /ou alread/ have a favorite *<T)
function /ou 2ant to use /ou 2ill have to create
/our o2n 2rapper function!
<ake an include file that defines a
userNmailN2rapper function: userNmailN2rapper
Drupal Handbook: 20 April 2005 22&
4Wmail, WsubFect, Wmessa"e, Wheader5R This
function should take the parameters and pass
them to the *<T) lib! Kou 2ill probabl/ have to
confi"ure the *<T) lib in some 2a/!
<odif/ /our confi"uration file 4conf!php5 to
include: $conf[*smtp_!irary*" =
*path.to./rapper+inc*;
(heck out
http:JJcvs!drupal!or"Jvie2cvsJcontributionsJtricks
JsmtpJ for an eample!
.ri"inall/ 2ritten b/ >Fartan on 1anuar/ 3, 2002,
2ith modifications!
(ustomi=e smtp!inc from the repositor/ above to ensure
that the proper settin"s for /our *<T) server are bein"
used!
3ile permissions
4related to Drupal $!5!2, other versionsE5
http:JJ222!/ourhomepa"e!tldJEI`adminJsettin"s mi"ht
/ield error messa"es like this:
/arning% m(dir(fi!es)% Kermission denied in .
data.///@?1?.pu!ic.inc!udes.fi!e+inc on !ine XX+
/arning% m(dir(fi!es.tmp)% 9o such fi!e or
directory in .
usr.data.///@?1?.pu!ic.inc!udes.fi!e+inc on !ine
XX+
This means that Drupal needs 2rite access to create 4and
later access5 the files and filesJtmp directories! .ne 2a/ to
solve this is to "ive the 2ebserver 2rite access in the
director/! Another common solution seems to be "rantin"
ever/bod/ 2rite access to the GfilesG director/! -oth
solutions has the dra2back that somebod/ else is able to
2rite files into that director/! Zif /ou kno2 a better
solution, please mention it here[
olution I 1recommended2
9n the drupal root director/:
Drupal Handbook: 20 April 2005 223
m(dir 3p fi!es.tmp
cho/n 3G /// fi!es
;ote: /ou ma/ need to substitute 222 2ith the user id of
/our 2ebserver process!
olution ?
9n the drupal root director/:
m(dir 3p fi!es.tmp
chmod 3G XXX fi!es
4o* can " adminstrate my na/igation on
my drupal siteA
A lot of Iuestions come up about ho2 navi"ation on drupal
can be modified, t2eaked, altered or an/ other s/non/m!
The theme: eample, 9nternet eplorer, ;etscape, .pera,
0/n has t2o ;avi"ation block that look like this
4assumin" /ou have mana"ed to
add link D</pa"eD there b/ definin" a Dpa"eD5:
2ill sho2:
O ;avi"ation
O home
O ne2s feeds
O archives
O blo"s
O books
O forums
O </ )a"e
O polls
O search
but also:
;avi"ation
O create content
O recent posts
O ne2s a""re"ator
,here the second one 4create content etc!5 chan"es its
name to name of the user after the user lo"s in!
Themes: marvin and unconed have no "eneric navi"ation
block but has the same links in the menu on the top of the
Drupal Handbook: 20 April 2005 270
pa"e!
.ther themes do not have an/ version of "eneric
navi"ation block!
9n the poast drupal used to have a , 2hat 9 call Gfunctional
navi"ationG! Hach module +each function+ could add a link
to a "eneral list of links! That list could then be displa/ed
an/2here in drupal! The list has onl/ one level! so sub+
elements 2ere not possible!
6or most of the (<* po2ered sites a functional navi"ation
is the best method of navi"ation: forums, blo"s etc all have
their o2n specific content+displa/ and content navi"ation,
based on their function!
-ut as of drupal $!7 people started inventin" all sorts of
navi"ation modules! These modules 2ould use tabs,
blocks, or even hardcoded 4D5html to make the navi"ation
eas/!
*o in drupal $!$ there 2as a "eneral, standard
Gnavi"ationG block introduced! -ut this one 2as not
confi"urable! .nl/ modules could add items in that block!
*o as of $!5C( 1on-ob to"ether 2ith lots of others came
up 2ith a nice menu s/stem, full/ confi"urable, 2ith
permissions and of course multi+levelled 4as 2as the
previous too5!
M: 9 like the first, "eneric ;avi"ation block but most of the
themes do not displa/ it, even after 9 enable ;avi"ation
block in the confi"uration of blocks!
A: The links list is still present in drupal, even in $!5! Kou
can print a list of linkes usin" for eample:
<?php
$output += theme(*!in(s*' !in(_page()' *
* %% * );
?&
the list 2ill then be somethin" like blo"s :: forum ::
m/pa"e :: 2eblinks
;ot all themes use this function! 9n fact, no2ada/s onl/
ver/ fe2 do! *o /ou 2ill need to add this manuall/
som2here!
Drupal Handbook: 20 April 2005 271
6or eample in a custommade sideblock /ou can sa/:
<?php
return $output += theme(*!in(s*' !in(_page()
*<r .&* );
?&
)lease refer to the documentation on drupal!or" about
printin" vs returnin" in blocks! This is different in some
releases of drupalL
M: ,hat does the ;avi"ation block in block confi" refer
toE 42hich block displa/ed above is THH navi"ation
blockE5
A: That is the default drupal navi"ation blok! 9t offers
multi+levelled navi"ation! 9t is also a place 2here some
modules place their navi"ation too 4event!module for
eample5!
Kou can disable this block, but /ou 2ill then not be able to
"et into /our adminstration, other than t/pin" in the urls
b/ hand! *o be carefullL
M: ,here is the first 4"eneric5 ;avi"ation block definedE
,hat to look for if 9 2ant to add it to m/ themeE 9 like
template so far so thatDs 2here 9 2ould like to have the
"eneric navi"ation block!
A: That is an implementaion of
<?php
print $output += theme(*!in(s*' !in(_page() *<r .
&* ); ..Cr something very simi!ar
?&
4o* do " unset the clean urlsA
After enablin" the clean urls in confi"uration all content is
inaccessible, because the s/stem /ou run drupal on, does
not support 4all5 clean urls!
(lean urls are those fanc/ lookin" addresses: instead of
222!server!comJEI`JfooJbar /ou see
222!server!comJfooJbar 2ith clean urls!
)roblem is that /ou cannot set it back, because /ou cannot
bro2se to the specific pa"e an/more!
Drupal Handbook: 20 April 2005 272
There are t2o solutions:
The first one is ver/ hand/ if /ou have m/sIl access!
Cun the m/sIl command:
IKH<;A varia!e :A; va!ue = 's%1%*?*;' OEAGA name =
'c!ean_ur!';
HA=A;A DGC1 cache;
And the net one is to modif/ /ou confi" file J
includesJconf!php
Kou should add the line
$conf['c!ean_ur!'" = ?;
some2here in this file!
/DT,: Drupal $!% 4currentl/ (:*5 has added the abilit/ to
detect 2hether /our site is capable of runnin" 2ith clean
urlDs! 9f the option to turn them on is "re/ed out, then /ou
2ill be unable to activate it until /ou resolve the
underl/in" issue!
no content on main page for non admin
users
Hi thereL 6irst of all thanks for the effort /ou put in
Drupal! 9t reall/ is a "reat tool! 9 Fust installed $!1!0 on
0inuJApache1!7 and 9Dm tr/in" to build m/ 2ebsite! 9Dve
created an admin user follo2in" the installation manual
and posted a test stor/! The stor/ is visible on the main
pa"e 4http:JJlocalhostJ5 onl/ if 9Dm still lo""ed in as admin!
9f 9 click Glo"outG 9 "et an empt/ pa"e 2ith the lo"in bo
on the ri"ht and no content! 9Dve checked the status of the
item and ever/thin" seems .>! An/one can helpE Thanks
in advance!
P4P afe 8ode "ssue
The error 2e all hate:
2arnin": (annot set time limit in safe mode in
JhomeJvirtualJsite12JfstJvarJ222JhtmlJcron!php on line 11!
The reasons:
15 'sin" a host that has *afe <ode enabled
25 )HAC is missin"
Drupal Handbook: 20 April 2005 277
Ho2 to 6i it:
15 edit /our includesJconf!php to sho2 the correct location
of )HAC
This line looks like:
k 9f reIuired, update )H)Ds include path to include /our
)HAC director/:
JJ iniNset4GincludeNpathG, G!:JpathJtoJpearG5R
25 9nstall )HAC and set the above line
75 CeIuest /our Host to install )HAC
$5 6ind a ne2 host
9 hope this helps all those posts re"ardin" the *afe <ode
issue!
9f /ou can think of an/ otehr solutions please add them
here!
!hat is the minimum /ersion of P4PA
,hich :ersion of )H) is reIuiredE 9 am runnin" CedHat
%!2 J Apache 1!7!12 J )H) 7!0!15 J </*M0 7!27!51
4o* can " install modulesA
Hi, 9Dm ne2 4ver/ :HCK ne25 to this, and Fust installed
Drupal toda/! are the etra modules i do2nloaded to m/
hard drive installed in the same manner as the re"ular
siteE do 9 need to create individuals files for each module
in m/ public fileE 49Dm usin" opensourcehost5 Do i need to
create a m/sIl database, etc!, for each additional moduleE
Do /ou kno2 of an/ eas/+to+understand instructions
onlineE 9 keep onl/ comin" up 2ith partial instructions!
ThanksL
7odes
cant create static php page
9n an attempt to find a temporar/ 2ork around for
kevinleboDs static pa"e problem 9 created a director/
called static in the drupal root director/ and in that
Drupal Handbook: 20 April 2005 27$
director/ 9 created a an test!html file! 9 then created a
static php pa"e in drupal that consisted of include45 for the
html file tr/in" to avoid the lar"e html file from bein" put
in the database 2here 9 believe it is "ettin" man"led!
Ho2ever, 2hen 9 do this 9Dm "ettin" a parse error in
pa"e!module! 9 onl/ "et this 2hen 9 select php from the list
bo! This is on Drupal $!7!0 and an/ help 2ould be
appreciated so kevin can "et his site live! Thanks!
P4P content *on:t parse
Are /ou "ettin" errors like thisE
Karse error% parse error in
.home.htdocs.drupa!.modu!es.page+modu!e(1?6) % eva!()'d code
on !ine 1
,hen puttin" a piece of )H) code in pa"esJnodes, /ou
must not include the VEphp E_ ta"s around it! 9f /ou 2ant
to use a mi of )H) and HT<0 4like in a !php file5, start
/our entr/ 2ith E_!
chedule and C-pire 7odes
Hello, 9 have a Iuestion about nodes! 9 didnDt see an/thin"
about this in the manual! 9f itDs there please ecuse the
Iuestions! 159s it possible to schedule 2hen a node is to
appear on the front pa"eE 9 2ould like to "reat a node in
advance and schedule 2hen it is to appear! 259s it possible
to set an epiration date on a node so that it appears static
on the front pa"e until a certain date then loses the static
fla"E Thanks 1oe (otellese (learstatic!or"
earch
earch inde- db empty # incomplete
HiL, 9 run cron!php, then 4tr/in" to fi somethin"5 9 empt/
the search inde db! ;o2 2hen 9 run cron!php a"ain donDt
process the old nodes 4the ones 2hich 2ere in db before
empt/5! Ho2 can 9 do to process those nodes a"ainE
ThanksL
Drupal Handbook: 20 April 2005 275
search multibytes language
9 am tr/in" to setup a chinese portal 2ebsite usin" drupal!
9n m/ eperimentin" 9 seems to have problem searchin"
chinese! 9 kno2 the phpbb has no problem searchin"
chinese, so it should not be a php issue! Does an/bod/
have an/ clueE Thanks!
Polls
)olls allo2 /ou to create interactive Iuestionaires that are
livin" parts of /our Drupal documents!
Are polls supported in DrupalA
Muestion: Does Drupal let /ou create pollsE
Kes! Hnable the polls module!
Can a user /ote more than once in a pollA
+uestion: (an a user vote more than once in a pollE
9n theor/ but it is actuall/ Iuite hard! )olls are tied to the
userDs 9) address so he 2ould have to be usin" at least a
different machine!
8iscellaneous
Do*nload offline copy of drupaldocs.org %
stuck *ithout net access
9 live out in the sticks 2ithout broadband 9nternet access
4and 9 canDt "et m/ blood/ laptop modem 2orkin" under
linu /et for dial+up access5 and need the content of
drupaldocs!or"! 9Dve do2nloaded the drupal!or" handbook
as one massive HT<0 file b/ openin" the Dprinter friendl/
versionD 4not ideal, but its a start5 but also need the
drupaldocs!or" content to help me understand the module
A)9 better! 9deall/, all Drupal documentation should be
Drupal Handbook: 20 April 2005 27%
available for do2nloadin" to vie2 offline! 9 alread/ have
such documentation for )H), </*M0, Apache, 1avascript,
(** etc! and it makes life so much easier 2hen /ouDre
stuck 2ithout net access! Drupal documentation is all
thatDs missin"! 9deall/ the documentation should be
do2nloadable as a series of HT<0 pa"es! -etter still,
thereDd be a 2a/ to do2nload the code and m/sIldump of
drupaldocs!or"!
4o* can " change Drupal:s character
encodingA 1UT3%J and Unicode2
*everal people have asked ho2 to specif/ the character
encodin" that Drupal uses! The short ans2er is: /ou canDt,
but /ou donDt have to!
Drupal uses 'T6+& for encodin" all its data! This is a
'nicode encodin", so it can contain data in an/ lan"ua"e!
Kou no lon"er need to 2orr/ about lan"ua"e specific
encodin"s for /our 2ebsite 4such as -i"5, #-2712,
,indo2s+1251 or 125%, !!!5! Also, 2hen Drupal imports
eternal 8<0 data 4such as C** or 8<0+C)(5, it is
automaticall/ converted into 'T6+& 4iconv support for )H)
2ill be reIuired for most encodin"s5!
9f /ou reall/ 2ant to chan"e DrupalDs encodin", /ou 2ill
eperience a lot of troubles, because of the various 2a/s
Drupal can receive and send out data 42eb, e+mail, C**,
8<0+C)(, etc5!
4o* do " report a bug in Contributed
modules
,hat is the procedure for reportin" bu"s in the separatel/
do2nloadable modulesE The bu" s/stem does not seem to
include these!
8aking a custom script *ork
1independently2 along *ith a Drupal setup
This is a doc 2hich deals 2ith runnin" /our o2n 4custom5
script, alon" 2ith an eistin" drupal setup!
0et us assume the file is called test1!php ! To "et it
Drupal Handbook: 20 April 2005 27?
runnin", these are the steps 2hich can be follo2ed!
15(reate a ne2 director/ 4sa/ test5, and put the file in it!
;et, cop/ the !htaccess file from the drupal dir into the
dir Fust created!
Hdit the !htaccess file to read
session!saveNhandler files
This is because Drupal uses a custom session handler, and
this needs to be overridden back to default!
259n case of an error like
6atal error: sessionNstart45: 6ailed to initiali=e stora"e
module! in JhomeJ/=JpublicNhtmlJtest1!php on line 2$
Fust do a iniNset4Dsession!saveNhandlerD, DfilesD5R before
sessionNstart45 in /our custom script! This creates a ne2
session for the script Oonl/! 4or follo2 step 15
7540on" method5
(han"e the main !htaccess file 4in the drupal dir5to read
session!saveNhandler files
;.TH: This ho2ever chan"es the "lobal settin"s, meanin"
Drupal will /DT WD2J, unless the settin" is reverted
back to user! The custom script ho2ever, 2ill 2ork!
HTH,
:iksit #aur
222!viksit!com
meUviksit!com
8o/e e-isting site to ne* ser/er
9 have a drupal site setup on one server! Ho2ever 9 2ant
to move it to another server! ;e2 domain name, include
files in different location, is even in a different countr/! 9s
there an eas/ 2a/ to achieve this 2ithout havin" to start
from scratch! As in mi"rate all content and user accounts!
Ce"ards, -a2do2001!
8o/ing your site to another url
9f /ou 2ant to move /our drupal site to a ne2 url itDs a
"ood idea to plan this 2ell in advance!
Drupal Handbook: 20 April 2005 27&
6irstl/ bear in mind that /our ne2 site 2ill not /et be
kno2n to search en"ines, portals etc! Kou should also take
the opportunit/ to inform people on the old site of the
impendin" chan"es, "ivin" them the opportunit/ to update
their bookmarks!
-ut 9 leave the or"ani=ational part up to /ou!
6or the benefit of this eercise 9Dll assume /ou have clean
urls enabled on both sites, and the ne2 site contains at
least the same articles that /ou had available on /our old
site!
<ovin" a site is not difficult, because apache can do most
of the 2ork for /ou usin" Cedirect Directives!
All /ou have to do is chan"e the !htaccess in /our old
drupal root! That file should contain onl/ the line:
Cedirect permanent J http:JJ/ourne2domain!comJ
9f /ou are runnin" multiple drupal sites on one domain
4e!"! drupal1!/ourolddomain!com5 /ou should use:
Cedirect permanent J
http:JJdrupal1!/ourne2domain!comJEI`
'pload the !htaccess and /ouDre done! The old urls 2ill
point all users, bots and a"ents that respect a 701 http
header 4most do5 to /our ne2 site! *ome bro2sers 2ill
even modif/ /our bookmarks 9 am told, but mine 4firefo5
does not!
8y U$, is *rong in the list of Drupal ites
make sure /ou call cron!php 2ith a full/ Iualified domain
name 46MD;5!
-ad: http:JJ12?!0!0!1Jcron!php
#ood: http:JJ222!m/domain!or"Jcron!php
truncated fields # unable to login # php
4.?.H bug
*o 9 finall/ 2orked out some issues 9 had settin" up a
second m/*M0 database 2ith m/ hostin" service, and
created the initial database for m/ site! 9n "eneral, m/
preferred method of 2orkin" is to set up a local cop/ of
Drupal Handbook: 20 April 2005 273
apache, install the soft2are and misc! add+ons, and then
eport a cop/ of the database, 2hich 9 then import into the
database on the server! After doin" this, 2hen 9 tried to
lo" in on the hosted cop/, the pa"e refreshed and sho2ed
onl/ a portion of the username 9Dd t/ped, as 2ell as a
shorter pass2ord, and the messa"e G9 donDt reco"ni=e that
user!G After clearin" the auto+complete cache in Hplorer
and simpl/ t/pin" each field out b/ hand 2ith the same
result, 9 reverted to a GcleanG cop/ of the database 2ith no
user info! The ne2 account 2as created 2ithout incidentR 9
chose the user name G<iddle -rotherG, "ave it m/ email
address 42ebmasterUatlasisshru""in"!or"5, and it spat
back out GbarnerdG as a pass2ord! ,hen 9 tried to lo" in
a"ain, ho2ever, the same thin" happened! The tet fields
sho2ed Gle -rotherG and m/ pass2ord 2as somethin" like
GOOOG! ,hile 9 kno2 ver/ little about m/*M0, 9 did check
the ne2 database and sure enou"h, the user name had
been stored as Gle -rotherG, m/ email address 2as
GasterUatlasisshru""in"!or"G, etc! 9 donDt have a lot of
2ork invested into the setup and so 9Dm not "oin" to lose
an/thin" if 9 start over from scratch, 2hich is 2hat 9 plan
to do net! -ut 9Dm 2orried that 9Dll run into the same
problem! Does an/one have an/ idea 2hat mi"ht cause
this or ho2 to fi itE
4o* to install a PatchA
9Dve read the GDiff vs! )atchG thread, but 9 "uess 9Dm
missin" somethin"! )erhaps thatDs because itDs about
creatin" a patch, not installin" a patch! (ould someone
please eplain:
Does a patch patch the *M0 tablesE
9s GpatchG a </*M0 command or Fust a descriptive
suffiE
9f this affects the </*M0 database, is there a 2a/ to
install it usin" php</AdminE
Does a patch patch the module fileE
9f so, ho2E 9s it a php pro"ramE Do 9 ftp it and point
to it 2ith a bro2serE
4,hat is it 9Dm not askin" that 9 should be askin"E5
9Dve searched the posts and cannot find an/thin" that
speaks to m/ dim 2its! An/ clues 2ould be much
appreciatedL 6,9,, 9Dm usin" remote shared hostin"
Drupal Handbook: 20 April 2005 2$0
4Debian5, and, comin" from older media, 9 am comfortable
2ith 45html and css but still ver/ much learnin" )H) and
kno2 nada re </*M0! ThanksL
Contributor:s guide
The Drupal en"ine is open source! 9t is possible for each
and ever/ user to become a contributor! The fact remains
that most Drupal users, even those skilled in pro"rammin"
arts, have never contributed to the code even thou"h most
of us had da/s 2here 2e thou"ht to ourselves: G9 2ish
Drupal could do this or that !!!G! Throu"h this pa"e, 2e
hope to make Drupal pro"rammin" more accessible!
The "uide pa"es found here are collaborative, but not
linked to particular Drupal versions! -ecause of this,
documentation can become out of date! To combat this, 2e
are movin" most developer documentation into the
Do/"en documentation that is versioned b/ (:* and
"enerated from the source code! 0ook there for up+to+date
and version+specific information!
(:* lo" messa"es
-ro2se (:* repositor/
Contributing to Drupal
Drupal is a collaborative, communit/+driven proFect! This
means that the soft2are and its supportin" features
4documentation, the drupal!or" 2ebsite5 are
collaborativel/ produced b/ users and developers all over
the 2orld!
There are several 2a/s to contribute to Drupal:
9mprove or enhance the soft2are
)rovide support and documentation for other users
4e!"!, b/ postin" additions or updates to the Drupal
Handbook or ans2erin" reIuests on user forums or
issues5!
)rovide financial support to Drupal development !
This section focuses on the first of these three!
Drupal Handbook: 20 April 2005 2$1
Types of Contributions
There are t2o basic t/pes of contributions /ou can make
to DrupalDs code base: 4a5 GcontributedG modules or
themes and 4b5 contributions to the drupal GcoreG!
G(ontributionsG are the communit/+produced
modules and themes
available on the Drupal site! To make a contribution,
/ou need to appl/ for contributor privile"es, produce
/our contribution, and then notif/ the contributions
mana"er to reIuest a revie2 of /our 2ork before
postin"! As lon" as contributions meet some
minimal criteria + the/ do 2hat the/ claim to and
have some demonstrable benefit 2ithout undul/
replicatin" alread/+available functionalit/ + the/ are
approved!
9f /ou have maFor enhancements /ou 2ish to
contribute, doin" so via a contributed module is in
man/ 2a/s the easiest 2a/ to be"in! (ontributed
code has a relativel/ lo2 set of reIuirements to
meet!
9n contrast, chan"es to the Drupal core are made
throu"h a thorou"h consultative process to ensure
the overall inte"rit/ of the soft2are!
(han"es to the Drupal core are "enerall/ of three
t/pes:
-u" fies ! These chan"es respond to identified
problems in
the eistin" code!
;e2 features ! These chan"es are
enhancements on 2hat is alread/ available!
(ode maintenance! These chan"es are to
improve the Iualit/ of the code or brin" it up
to date 2ith chan"es else2here in Drupal!
This can include brin"in" code in line 2ith
codin" standards, improvin" efficienc/ 4e!"!,
eliminatin" unneeded database Iueries5,
introducin" or improvin" in+line comments,
and doin" up"rades for compliance 2ith a ne2
release version!
,hile /ou can create /our o2n issues, /ou can also
Drupal Handbook: 20 April 2005 2$2
be"in b/ simpl/ takin" on eistin" tasks on the task
list!
&ug reports
9f /ou found a bu", send us the bu" report and 2e 2ill fi
it provided /ou include enou"h dia"nostic information for
us to "o on! Kour bu" reports pla/ an essential role in
makin" Drupal reliable!
-u" reports can be posted in connection 2ith an/ proFect
hosted on drupal!or"! Kou can submit a ne2 bu" via the
submit issue form! )rovide a sensible title for the bu", and
choose the proFect /ou think /ou have found the bu" in!
After previe2in" the submission, /ou 2ill need to choose a
related component and /ou 2ill be able to provide more
details about the bu", includin" the description of the
problem itself! )lease include an/ error messa"es /ou
received and a detailed description of 2hat /ou 2ere
doin" at the time!
;ote that /ou donDt have to be lo""ed in nor a member of
drupal!or" to submit bu"s!
The first thin" 2e 2ill do 2hen /ou report a bu" is tell /ou
to up"rade to the ne2est version of Drupal, and then see if
the problem reproduces! *o /ouDll probabl/ save us both
time if /ou up"rade and test 2ith the latest version before
sendin" in a bu" report!
3eature suggestions
Ho2 man/ times /ou have dreamed G#ee!!!9 2ish Drupal
could do thatG or G9 like the feature, but it should 2ork
betterG! 9f /ou 2ant to improve Drupal, send us /ou 2ishes
as a feature su""estions! Kour su""estions pla/ an
essential role in makin" Drupal more usable and feature+
rich!
The core features provided b/ Drupal are listed on the
features pa"e! Kou can submit a feature reIuest b/
creatin" a ne2 issue connected to the component the
feature is related to! )lease note that there is a Drupal
contributed module named D6eaturesD 2hich is used on the
feature pa"e mentioned above! Hver/ module has a feature
Drupal Handbook: 20 April 2005 2$7
reIuest subcate"or/, and thus the 83eature8 module is
not the appropriate place to submit feature reIuests! To
properl/ file a feature reIuest, first choose the proFect it is
related to and then after hittin" previe2 set the other
related options! Kou 2ill be able to cate"ori=e the issue as
a feature reIuest 2ith the 9ssue 9nformation J (ate"or/
dropdo2n!
;ote that /ou donDt have to be lo""ed in nor to be a
member of drupal!or" to su""est features!
Task ,ist
The Drupal bu" database contains man/ issues classified
as Gbite+si=edG tasks ++ tasks that are 2ell+defined and self+
contained, and thus suitable for a volunteer lookin" to "et
involved 2ith the proFect! Kou donDt need broad or detailed
kno2led"e of DrupalDs desi"n to take on one of these, Fust
a prett/ "ood idea of ho2 thin"s "enerall/ 2ork, and
familiarit/ 2ith the codin" "uidelines! Hach task is
somethin" a volunteer could pick off in a spare evenin" or
t2o!
9f /ou start one of these, please notif/ the other developers
b/ mailin" drupal+develUdrupal!or" 4of course, /ou should
be subscribed to that list5! 9f /ou have Iuestions as /ou "o,
ask the dev list or update the task 4updates are sent to the
list automaticall/5! *end the patch to the list 2hen read/!
The re/ision process
(han"es to the Drupal core are usuall/ made after
consideration, plannin",
and consultation! The/ are also made on a priorit/ basis++
fies come
before additions, and chan"es for 2hich there is a hi"h
demand come before
proposals that have "one relativel/ unnoticed! An/
potential chan"e has to
be considered not onl/ on its o2n merits but in relation to
the aims and
principles of the proFect as a 2hole!
The particular sta"es that a ne2 feature "oes throu"h
var/, but a t/pical
Drupal Handbook: 20 April 2005 2$$
c/cle for a si"nificant chan"e mi"ht include:
#eneral discussion of the idea, for eample throu"h
a postin" in a
drupal!or" forum! This can be a chance to "au"e
support and interest, scope the issue, and "et some
direction and su""estions on approaches to take! 9f
/ouDre considerin"
substantive chan"es, startin" out at the discussion
level + rather than
Fumpin" strai"ht into code chan"es + can save /ou a
lot of time!
)ostin" an issue throu"h the drupal!or" proFect
s/stem!
Discussion raisin" issues on the proposed direction
or solution, 2hich ma/
include a real+time meetin" throu"h 9C(!
9ndividual Drupal communit/ members ma/ vote for
4X15 or a"ainst 4+15 the
chan"e! ,hile informal, this votin" s/stem can help
Iuantif/ support!
)roducin" a patch 2ith specific proposed code
chan"es!
Cevie2 of the chan"es and further discussion!
Cevisions to address issues!
)ossible application of the patch!
The process of discussion and revision mi"ht be repeated
several times to
encompass diverse input! At an/ point in the process, the
proposal mi"ht
be:
*helved as impractical or inappropriate!
)ut off until other lo"icall/ prior decisions are made!
Colled into another related initiative!
*uperceded b/ another chan"e!
9f /ou submit su""estions that donDt end up bein" adopted,
please donDt be
discoura"edL 9t doesnDt mean that /our ideas 2erenDt
"ood++Fust that the/
didnDt end up findin" a place! The discussion itself ma/
have beneficial outcomes!
9tDs all part of collaborativel/ buildin" a Iualit/ open
source proFect!
Drupal Handbook: 20 April 2005 2$5
Criteria for e/aluating proposed changes
The follo2in" criteria are used b/ core developers in
revie2in" and approvin"
proposed chan"es:
The chan"es support and enhance Drupal proFect
aims!
The proposed chan"es are current! Hspeciall/ for
ne2 features,
priorit/ is usuall/ "iven to development for the
GHHADG 4the most
recent development version of the code, also
referred to as the (:* version5
as opposed to released versions! There ma/ have
been si"nificant
chan"es since the last release, so developin" for the
(:* version means
that
The proposed chan"e doesnDt raise an/ si"nificant
issues or
risks! *pecificall/, issues that have been raised in
the revie2
process have been satisfactoril/ addressed!
The chan"es are 2ell coded! At a minimum, this
means codin" in accordance 2ith the Drupal codin"
standards! -ut
it also means that the codin" is intelli"ent and
compact! Hle"ant
solutions 2ill have "reater support than cumbersome
ones that accomplish the
same result!
There is demonstrated demand and support for the
chan"e! Demand
is indicated b/, e!"!, comments on the drupal!or"
issues s/stem or comments
in forums or the drupal+dev email list!
The chan"e 2ill be used b/ a si"nificant portion of
the installed Drupal base as opposed bein" relevant
onl/ to a small subset of Drupal users!
The benefits of the chan"e Fustifies additional code
and resource
demands! Hver/ addition to the code base increases
the Iuantit/ of
Drupal Handbook: 20 April 2005 2$%
code that must be activel/ maintained 4e!"!, updated
to reflect ne2 desi"n
chan"es or documentation approaches5! Also, added
code increases the
overall Drupal footprint throu"h, e!"!, added
procedure calls or database
Iueries! -enefits of a chan"e must out2ei"h these
costs!
Tips for contributing to the core
The follo2in" tips mi"ht improve the chances of /our
contributions bein" accepted:
Take a step back and obFectivel/ evaluate 2hether
the chan"es are appropriate for the Drupal core! Ask
/ourself:
9s the feature alread/ implementedE *earch
the forums and issue tracker!
(ould the feature be implemented as a
contributed module rather than a patch to the
coreE
,ill the chan"e benefit a substantial portion of
the Drupal install baseE
9s the chan"e sufficientl/ "eneral for others to
build upon cleanl/E
-e eplanator/, provide descriptions and
illustrations, make a "ood
case! DonDt count on others do2nloadin", installin",
and testin" /our
chan"es! Cather, sho2 them in a nutshell 2hat /our
chan"es 2ould
mean! Anticipate and address Iuestions or concerns!
9f
appropriate, provide screenshots!
-e friendl/ and respectful! Ackno2led"e the effort
others put in!
-e open to su""estions and to other 2a/s of
accomplishin" 2hat /ouDre
aimin" for!
-e persistent! 9f /ou donDt "et an/ response ri"ht
a2a/, donDt
necessaril/ "ive up! 9f /ouDre still convinced /our
idea has merit,
Drupal Handbook: 20 April 2005 2$?
find another 2a/ to present it!
Cespond, in a timel/ 2a/, to su""estions, reIuests,
or issues
raised! Cevise /our 2ork accordin"l/!
9f some time has "one b/, update /our chan"es to
2ork 2ith the current (:* version!
8ailing lists
Drupal%support
9f /ou need help 2ith installin", runnin" or an/thin"
Drupal related this is the list to post /our Iuestions!
vie2 archive jq search archive jq mailman pa"e
Drupal%de/el
This list is for those 2ho 2ant to either take part or Fust
observe Drupal development!
vie2 archive jq search archive jq mailman pa"e
Drupal%docs
The place for non+pro"rammers that 2ant to contribute
and 2ork on documentation!
vie2 archive jq search archive jq mailman pa"e
Drupal%c/s
All (:* commits are posted to this list, a dail/ di"est is
also posted to drupal+devel thou"h!
vie2 archive jq search archive jq mailman pa"e
!ubscribe
<ail address:

0ists:
drupal+support
drupal+devel
drupal+docs
drupal+cvs
ce!5156Scyerdash+com
Drupal Handbook: 20 April 2005 2$&

Accessing the Drupal mailing lists using a
ne*s ser/er
The #<ane ne2s server 4http:JJ"mane!or"5 archives
mailin" lists, and lets /ou access and post to them usin" a
ne2sreader! 9f /ou find such an access convenient, point
/our ne2s reader to nntp:JJne2s!"mane!or" !
'nlike other ne2s servers, "mane offers a""resive anti+
spam features, encr/pted email addresses and onl/ allo2s
people to post after their email address is verified!
As of toda/, 4;ovember 2, 20075, the follo2in"
ne2s"roups on this server offer /ou access to the drupal
mailin" lists:
"mane!comp!php!drupal!cvs
"mane!comp!php!drupal!devel
"mane!comp!php!drupal!support
"mane!comp!php!drupal!user
The best thin"s in life are freeL #<ane is one of them! :5
8ailing of proBect issues
Hver/ proFect issue for Drupal 2ith patch status is emailed
to the drupal+devel mailin" list 2hen updated! These are
mailed to promote peer revie2 of code potentiall/ "oin"
into Drupal! .ther issues are not emailed because it 2ould
make the mailin" list less useful as email volume
increases! Kou can subscribe to proFect issue updates for
an/ contributed module, theme, or translation!
Coding standards
Drupal Coding tandards
;ote: The Drupal (odin" *tandards applies to code that is
to become a part of Drupal! This document is based on the
)HAC (odin" standards!
Subscribe
Drupal Handbook: 20 April 2005 2$3
"ndenting
'se an indent of 2 spaces, 2ith no tabs!
Control tructures
These include if, for, 2hile, s2itch, etc! Here is an eample
if statement, since it is the most complicated of them:
if (condition1 ]] condition,) {
action1;
)
e!seif (condition@ ## condition5) {
action,;
)
e!se {
defau!taction;
)
(ontrol statements should have one space bet2een the
control ke/2ord and openin" parenthesis, to distin"uish
them from function calls!
Kou are stron"l/ encoura"ed to al2a/s use curl/ braces
even in situations 2here the/ are technicall/ optional!
Havin" them increases readabilit/ and decreases the
likelihood of lo"ic errors bein" introduced 2hen ne2 lines
are added!
6or s2itch statements:
s/itch (condition) {
case 1%
action1;
rea(;
case ,%
action,;
rea(;
defau!t%
defau!taction;
rea(;
)
3unction Calls
6unctions should be called 2ith no spaces bet2een the
function name, the openin" parenthesis, and the first
parameterR spaces bet2een commas and each parameter,
and no space bet2een the last parameter, the closin"
Drupal Handbook: 20 April 2005 250
parenthesis, and the semicolon! HereDs an eample:
$var = foo($ar' $a4' $7uu$);
As displa/ed above, there should be one space on either
side of an eIuals si"n used to assi"n the return value of a
function to a variable! 9n the case of a block of related
assi"nments, more space ma/ be inserted to promote
readabilit/:
$short = foo($ar);
$!ong_varia!e = foo($a4);
3unction Declarations
function funstuff_system($fie!d) {
$system[*description*" = t(*;his modu!e insert funny te$t
into posts random!y+*);
return $system[$fie!d";
)
Ar"uments 2ith default values "o at the end of the
ar"ument list! Al2a/s attempt to return a meanin"ful
value from a function if one is appropriate!
Comments
9nline documentation for classes should follo2 the
Do/"en convention! <ore information about Do/"en can
be found here:
Document block s/nta
(omment commands
;ote that Drupal uses the follo2in" docblock s/nta:
.FF
F Bomments+
F.
And all Do/"en commands should be prefied 2ith a U
instead of a J!
;on+documentation comments are stron"l/ encoura"ed! A
"eneral rule of thumb is that if /ou look at a section of
code and think G,o2, 9 donDt 2ant to tr/ and describe
thatG, /ou need to comment it before /ou for"et ho2 it
2orks!
( st/le comments 4JO OJ5 and standard (XX comments 4JJ5
Drupal Handbook: 20 April 2005 251
are both fine! 'se of )erlJshell st/le comments 4k5 is
discoura"ed!
"ncluding Code
An/2here /ou are unconditionall/ includin" a class file,
use reIuireNonce45! An/2here /ou are conditionall/
includin" a class file 4for eample, factor/ methods5, use
includeNonce45! Hither of these 2ill ensure that class files
are included onl/ once! The/ share the same file list, so
/ou donDt need to 2orr/ about miin" them + a file
included 2ith reIuireNonce45 2ill not be included a"ain b/
includeNonce45!
;ote: includeNonce45 and reIuireNonce45 are statements,
not functions! Kou donDt need parentheses around the
filename to be included!
P4P Code Tags
Al2a/s use VEphp E_ to delimit )H) code, not the VE E_
shorthand! This is reIuired for Drupal compliance and is
also the most portable 2a/ to include )H) code on
differin" operatin" s/stems and setups!
4eader Comment &locks
All source code files in the core Drupal distribution should
contain the follo2in" comment block as the header:
<?php
.F $8d$ F.
This ta" 2ill be epanded b/ the (:* to contain useful
information
<?php
.F $8d% BCH89Q_:;<9H<GH:+htm!'v 1+5 ,??5.1?.,X 11%66%@, u/e
A$p $ F.
Using C6
9nclude the 9d (:* ke/2ord in each file! As each file is
edited, add this ta" if itDs not /et present 4or replace
eistin" forms such as G0ast <odified:G, etc!5!
The rest of this section assumes that /ou have basic
Drupal Handbook: 20 April 2005 252
kno2led"e about (:* ta"s and branches!
(:* ta"s are used to label 2hich revisions of the files in
/our packa"e belon" to a "iven release! -elo2 is a list of
the reIuired (:* ta"s:
DC')A0+8+K
4reIuired5 'sed for ta""in" a release! 9f /ou donDt use
it, thereDs no 2a/ to "o back and retrieve /our
packa"e from the (:* server in the state it 2as in at
the time of the release!
C-ample U$,s
'se Geample!comG for all eample 'C0s, per C6( 2%0%!
7aming Con/entions
3unctions and 8ethods
6unctions and methods should be named usin" lo2er caps
and 2ords should be separated 2ith an underscore!
6unctions should in addition have the "roupin"Jmodule
name as a prefi, to avoid name collisions bet2een
modules!
)rivate class members 4meanin" class members that are
intended to be used onl/ from 2ithin the same class in
2hich the/ are declaredR )H) $ does not support trul/+
enforceable private namespaces5 are preceded b/ a sin"le
underscore! 6or eample:
_node_get()
$this3&_status
Constants
(onstants should al2a/s be all+uppercase, 2ith
underscores to separate 2ords! )refi constant names
2ith the uppercased name of the module the/ are a part
of!
Global 6ariables
9f /ou need to define "lobal variables, their name should
Drupal Handbook: 20 April 2005 257
start 2ith a sin"le underscore follo2ed b/ the
moduleJtheme name and another underscore!
3ilenames
All documentation files should have the filename etension
G!ttG to make vie2in" them on ,indo2s s/stems easier!
Also, the filenames for such files should be all+caps 4e!"!
CHAD<H!tt instead of readme!tt5 2hile the etension
itself is all+lo2ercase 4i!e! tt instead of T8T5!
Hamples: CHAD<H!tt, 9;*TA00!tt, T.D.!tt,
(HA;#H0.#!tt etc!
Comments
9nline documentation for classes should follo2 the )H)Doc
convention, similar to 1avadoc! <ore information about
)H)Doc can be found here:
http:JJphpdocu!sourcefor"e!netJspecJho2to!html
;on+documentation comments are stron"l/ encoura"ed! A
"eneral rule of thumb is that if /ou look at a section of
code and think G,o2, 9 donDt 2ant to tr/ and describe
thatG, /ou need to comment it before /ou for"et ho2 it
2orks!
( st/le comments 4.F F.5 and standard (XX comments
4..5 are both fine! 'se of )erlJshell st/le comments 405 is
discoura"ed!
"ndenting
'se an indent of 2 spaces, 2ith no tabs! ;o trailin"
spaces!
P4P Code tags
Al2a/s use <?php ?& to delimit )H) code, not the <? ?&
shorthand! This is reIuired for Drupal compliance and is
also the most portable 2a/ to include )H) code on
differin" operatin" s/stems and setups!
Drupal Handbook: 20 April 2005 25$
9, naming con/entions
DonDt use 4A;*95 *M0 J </*M0 J )ost"re*M0 J <*
*M0 *erver J !!! Ceserved ,ords for column andJor
table names! Hven if this ma/ 2ork 2ith /our
4</*M05 installation, it ma/ not 2ith others or 2ith
other databases! *ome references:
4A;*95 *M0 Ceserved ,ords
</*M0 Ceserved ,ords: $!, 7!27!, 7!21!
)ost"re*M0 Ceserved ,ords
<* *M0 *erver Ceserved ,ords
*ome commonl/ misused ke/2ords: ;81A:;<1K'
;PKA' ;PKA:' 1CHI=A' H<;<' H<;A' ;81A' +++
*ee also Zbu"[ *M0 Ceserved ,ords!
(apitali=ation, 9ndentation
'))HC(A*H reserved 2ords
lo2ercase 4or (apitali=e5 table names
lo2ercase column names
Hample:
:A=AB; r+rid' p+perm
DGC1 {ro!e) r
=AD; NC89 {permission) p C9 r+rid = p+rid 33 may
e on one !ine /ith prev+
CGHAG MP name

;amin"
'se plural or collective nouns for table names
since the/ are sets and not scalar values!
;ame ever/ constraint 4primar/, forei"n,
uniIue ke/s5 /ourself! .ther2ise /ouDll see
funn/+lookin" s/stem+"enerated names in error
messa"es! This happened 2ith the
moderation_ro!es table 2hich initiall/ defined
a ke/ 2ithout eplicite name as TAP (mid)!
This "ot m/sIldumpDed as TAP mid (mid)
2hich resulted in a s/nta error as mid() is a
m/sIl function 4see Zbu"[ m/sIl ++ansi cannot
import install database5!
9nde names should be"in 2ith the name of the
table the/ depend on, e"! 89HAL
users_sid_id$!
Ceferences:
Drupal Handbook: 20 April 2005 255
1oe (elko + Ten Thin"s 9 Hate About Kou
1oe (elko + *M0 for *marties: Advanced *M0
)ro"rammin"
CD-<* ;amin" conventions
*M0 ;amin" (onventions
3unctions
6unctions should be named usin" lo2er caps and 2ords
should be separated 2ith an underscore! 6unctions should
have the "roupin"Jmodule name as a prefi, to avoid name
collisions bet2een modules!
Constants
(onstants should al2a/s be all+uppercase, 2ith
underscores to separate 2ords! )refi constant names
2ith the uppercased name of the module the/ are a part
of!
Control structures
These include if, for, /hi!e, s/itch, etc! Here is an
eample if statement, since it is the most complicated of
them:
if ((condition1) ]] (condition,)) {
action1;
)
e!seif ((condition@) ## (condition5)) {
action,;
)
e!se {
defau!taction;
)
(ontrol statements should have one space bet2een the
control ke/2ord and openin" parenthesis, to distin"uish
them from function calls!
Kou are stron"l/ encoura"ed to al2a/s use curl/ braces
even in situations 2here the/ are technicall/ optional!
Havin" them increases readabilit/ and decreases the
likelihood of lo"ic errors bein" introduced 2hen ne2 lines
are added!
6or s2itch statements:
Drupal Handbook: 20 April 2005 25%
s/itch (condition) {
case 1%
action1;
rea(;
case ,%
action,;
rea(;
defau!t%
defau!taction;
rea(;
)
4eader comment blocks
All Drupal source code files should start 2ith a header
containin" the C(* W9dW ke/2ord:
<?php
.. $8d% BCH89Q_:;<9H<GH:'v 1+1 ,??1.11.?6 ?X%@,%1X natra(
A$p $
;ote that ever/thin" after the startin" W9d and before the
closin" W is automaticall/ "enerated b/ (:* + /ou
shouldnDt edit this manuall/! 9f /ou add a ne2 file to (:*,
Fust 2rite .. $8d$!
C6 repositories
(:* is a tool to mana"e soft2are revisions and release
control in a multi+developer, multi+director/, multi+"roup
environment! 9t comes in ver/ hand/ to maintain local
modifications!
Thus, (:* helps /ou if /ou are part of a "roup of people
2orkin" on the same proFect! 9n lar"e soft2are
development proFects, itDs usuall/ necessar/ for more then
one soft2are developer to be modif/in" modules of the
code at the same time! ,ithout (:*, it is all too eas/ to
over2rite each othersD chan"es unless /ou are etremel/
careful!
9n addition, (:* helps to keep track of all chan"es!
Therefore, the (:* server has been setup to mail all (:*
commits to all maintainers! Thus, it does not reIuire an/
effort to inform the other people about the 2ork /ou have
Drupal Handbook: 20 April 2005 25?
done, and b/ readin" the mails ever/one is kept up to
date!
Additional references
(:* book
(:* docs
(:* 6AM
(:* "uide from T0D)
Drupal C6 repositories
8ain repository
There are t2o 2a/s to access the latest Drupal sources in
the main (:* repositor/! 9f /ou Fust 2ant to have a Iuick
look at some files, use the :ie2(:* 2eb interface! 9f /ou
need the complete source tree to stud/ and 2ork 2ith the
code, follo2 these steps:
9f /ou donDt have it /et, install a recent cop/ of (:*
4if /ou are on ,indo2s, /ou ma/ check (:* front
ends for ,indo2s5!
0o"in b/ runnin" the command:
$ cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa!
!ogin
The reIuired pass2ord is Danon/mousD 42ithout the
Iuotes5!
To check out the latest drupal sources, run the
command:
$ cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa!
chec(out drupa!
This 2ill create a director/ called drupa! containin"
the latest drupal source tree!
.nce /ou have a cop/ of the Drupal source tree, use
$ cvs update 3dK
in the source root dir to update all files to itDs latest
versions 43d: (reate an/ 4ne25 directories that eist
in the repositor/ if the/Dre missin" from the 2orkin"
director/! 3K: )rune empt/ directories + directories
that "ot removed in the repositor/ 2ill be removed
Drupal Handbook: 20 April 2005 25&
in /our 2orkin" cop/, too5!
9f /ou canDt or donDt 2ant to use (:*, /ou can do2nload
ni"htl/ (:* snapshots from
http:JJdrupal!or"JfilesJproFectsJdrupal+cvs!tar!"=!
Contributions repository
The (ontributions repositor/ is a seperate (:* repositor/
2here people can submit their modules, themes,
translations, etc! *ee the contributions 6AM!tt and
CHAD<H!tt for more information!
As the <ain repositor/, /ou can bro2se it via the 2eb
interface! 6or anon/mous 4read+onl/5 access, do the
follo2in":
0o"in b/ runnin" the command
$ cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa!3
contri !ogin
The reIuired pass2ord is Danon/mousD 42ithout the
Iuotes5!
To check out the latest drupal contributions, run the
command:
$ cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa!3
contri chec(out contriutions
To check out contributions for a certain Drupal
version, do
$ cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa!3
contri chec(out
3r <version tag> contriutions
2here Vversion ta"_ is one of the ta"s listed under
GM: Ho2 do 9 control the releases of m/
moduleJthemeEG here!
To update /our tree to the latest version, do
$ cvs update 3dK
in the source root dir!
9f /ou 2ant to add /our o2n modules, themes,
translations, etc!, /ou need (:* 2rite access:
Drupal Handbook: 20 April 2005 253
Adding a file to the C6 repository
9f /ou 2ould like to add a file or a director/, first /ou need
to do2nload the parent director/! .nce a"ain: the parent
director/, not the director/ /ou 2ant to add somethin" to,
but the parent of it! 9 can not find an/ lo"ic in this, but this
is so!
6irst, issue the follo2in" command:
e$port
BR:GCC;=%pserver%icvs!ogin%cvspass/dScvs+drupa!+or
g%.cvs.drupa!3contri
Kou 2ould like to add a ne2 file to a moduleE
cvs co contriutions.modu!es.modu!ename
cd contriutions.modu!es
cp sourcefi!e modu!ename
cvs add modu!es.sourcefi!ename
cvs commit
*a/ /ou 2ant to create a sandbo named mysando$! Then
do the follo2in":
cvs co contriutions.sando$./e!in(s [1"
cd contriutions
m(dir sando$.mysando$
cvs add sando$.mysando$
cvs commit
Z1[ does not reall/ matter 2hich director/, Fust s"! from
sandbo! 9 like this one, because it is small!
.f course, /ou ma/ do several thin"s in one commit,
addin" files, removin" files, updatin" files! ;either remove
4cvs remove5 nor update 4cvs update5 is such a tedious
process! ,arnin": /ou need to check out 2ith /our (:*
account, because (:* i"nores (:*C..T for eistin"
checkouts!
C6 front ends for !indo*s
TortoiseC6
Tortoise(:* lets /ou 2ork 2ith files under (:* version
control directl/ from ,indo2s Hplorer! 9tDs freel/
available under the #)0! The follo2in" tutorial teaches
ho2 to use Tortoise(:* 2ith Drupal!
Drupal Handbook: 20 April 2005 2%0
Do2nload Tortoise(:* from
http:JJ222!tortoisecvs!or"Jdo2nload!shtml and
install it!
9n ,indo2s Hplorer, select the folder under 2hich
/ou 2ant the Drupal source director/ to live! Ci"ht+
click on it! There are t2o ne2 sections in the contet
menu + CI! Chec#out and CI! :! *elect CI!
Chec#out!
6ill in the follo2in" fields:
)rotocol: Kass/ord server (%pserver%)
*erver: [cvs+"drupa!+org
Cepositor/ folder: .cvs.drupa! 4main distro5 or .
cvs.drupa!3contri 4contributions5
'ser name: anonymous
<odule: drupa! 4main distro5 or
contriutions
4contributions5
and press G.>G!
Kou 2ill be asked for pass2ord! Hnter anon/mous
and press G.>G!
A lo" 2indo2 2hich monitors the checkout process
2ill appear! (heckin" out the 2hole (:* repositor/
2ill take a 2hile!
9f ever/thin" 2orks, /ou 2ill see the messa"e
G*uccess, (:* operation completedG at the end of
the lo"! A ne2 director/ 4named like the module
selected before5 2ith the sources 2ill be created!
To brin" /our Drupal source tree up+to+date, select
itDs root folder 4GdrupalG J GcontributionsG5, ri"ht+click
it and do a G(:* 'pdateG!
The process above retrieves the freshest files from the
repositor/ 4the so+called HHAD branch5! These are
sometimes unstable! To "et Drupal modules and themes
that are stable and read/ for production 42hich /ou can
also do2nload from the Drupal do2nloads pa"e5, follo2
the process described above, but before hittin" G.>G /ou
need to:
(lick on the GCevisionG tab on the (:* checkout
dialo"!
Hnable G#et ta"JbranchG!
Hnter HGIK<=35313? or HGIK<=353?? dependin" on
the version /ou are usin" in the ta"Jbranch field!
Drupal Handbook: 20 April 2005 2%1
Hit .>!
Kou can also "enerate patch files 2ith Tortoise(:*! 1ust
select the files 2hich /ou have patched in ,indo2s
Hplorer! Then ri"ht click into the BR: =& 1a(e Katch
menu item! Then /ou ma/ 2ish to read (reatin" and
sendin" /our patches
!inC6
,in(:* is another "raphical (:* client available for <*
,indo2s and for <acs! Kou can do2nload the latest
version from http:JJ222!2incvs!or"J! The checkout J
update process is similar to the one described above!
C6 on 8ac ' 5
6or <ac users 2ho are unused to the command line, (:*
can at first look a bit dauntin"! 6ortunatel/ there is an
application called (:0 that provides control of (:*
throu"h a point and click interface! <ost of the
instructions for usin" (:0 2ill also appl/ 2hen usin" other
applications to control (:*!
Concepts of C6
Drupal uses (oncurrent :ersions */stem 4(:*5 to co+
ordinate development, 2hich can be thou"ht of as a
s/stem for controllin" the contents of a librar/! Describin"
(:* in terms of a librar/, books, and editions is onl/ a
metaphor + unlike a real, phisical librar/, no matter ho2
man/ people check out a book, it 2ill al2a/s be available
to the net person!
As 2ith an/ librar/ thou"h, there are rules of behaviour
to2ards other users and ho2 /ou treat the librar/
materials, no need to 2orr/ about overdue librar/ tickets
or leavin" coffee stains on pa"es, but please be sure to act
responsibl/ 2hen contributin" content to the librar/!
$epository
A repositor/ can be thou"ht of as a book, Drupal has t2o
repositories 2hich can be checked out 4do2nloaded to
Drupal Handbook: 20 April 2005 2%2
/our local computer5:
Drupal
the core Drupal code, i!e! 2hat is do2nloaded as
DDrupalD!
Contributions
modules, themes, translations, etc! supplied b/
contributors, i!e! all Drupal material that is not in the
core!
&ranch
(:* tracks different versions of content! 9ma"ine different
editions of a tet book, each edition includin" amendments
and additions + each edition is kno2n as a DbranchD, and
has a branch ta" to identif/ it, e!"! Drupal $!5! Hver/
branch corresponds to a particular version of Drupal that
"ets released!
4ead
This is a special edition of the book 4repositor/5 2hich has
not been published /et, or in (:* speak has not been
GbranchedG /et! Think of GheadG as a manuscript of the
net edition of the book! Amendments and additions are
added to the manuscript, itDs proof+read and tested, and
once itDs read/ it "ets published 4branched5 as a ne2
edition!
!orking copy # !ork area
'sers can check out a cop/ of a book to 2ork on locall/,
the ori"inal remains in the librar/ and can be checked out
b/ other users! ,hen checkin" out a book remember that
it is an edition 4branch or head5 of the book 4repositor/5!
The cop/ of the book 2hich is on the userDs local computer
is kno2n as the G,orkin" cop/G, G,ork areaG or G,ork
director/G!
(han"es the user makes to the local cop/ can be sent back
to the librar/ for inclusion in the repositor/!
ProBect
<odules, themes or translations can be added 4committed5
Drupal Handbook: 20 April 2005 2%7
b/ users to the (ontributions book 4repositor/5 at an/
time! 9tDs possible to add to the manuscript 4head5 of
(ontributions, or an/ of the previous editions 4branches5!
The 2ebsite drupal!or" tracks user additions to the
(ontributions book 4repositor/5 as G)roFectsG! Hach proFect
has a description pa"e from 2hich it can be do2nloaded,
and 2here issues and feature reIuests can be added b/
users!
Patch
.nl/ a fe2 Drupal developers are able to make chan"es
directl/ to the Drupal book 4repositor/5! All other users
2ho 2ant to include chan"es the/Dve made 2hile 2orkin"
on their local cop/ of the Drupal book 4repositor/5, must
create a file sho2in" the differences bet2een the local
version and the version at drupal!or"! This differences file
is kno2n as a GpatchG, and is sent to the rest of the
development communit/ b/ creatin" an GissueG at
drupal!or" and attachin" the file!
etting up
tep &y tep C6
!tep one to usin" an/ application is of course to install it +
(:* is installed as standard b/ the Apple Developer tools,
so if /ou havenDt installed these /et, do2nload the latest
version and install it, the/ also include a lot of other useful
stuff like )roFect -uilder and 6ile <er"e 4Developer
<embership reIuired, but free5!
C6,
9f /ouDre ne2 to (:* it can look a bit dauntin", but
fortunatel/ for <ac .* 8 users thereDs an ecellent
application called (:0 2hich means that /ou donDt need to
"o an/2here near the Terminal to make use of (:*L
!tep two is to do2nload (:0 and install it:
http:JJ222!sente!chJsoft2areJcvlJ
Drupal Handbook: 20 April 2005 2%$
etup
!tep three is to set (:* to i"nore the invisible !D*N*tore
files 2hich .* 8 creates in each folder! To do this /ou
need to open the Terminal 4Application+_'tilities+
_Terminal5, and t/pe the follo2in":
cd
takes /ou to root of /our account
pico
opens the )ico tet application
+H:_:tore
specifies 2hich file t/pes /ou 2ant (:* to i"nore
;o2 press the ke/s: Control and 0 at the same time
This closes the document /ouDve Fust 2ritten, it 2ill ask
/ou if /ou 2ant to save it + press y for /es, then t/pe in the
name of the file .csignore 4note the D.D5 and press return!
KouDve finished 2ith the Terminal, so /ou can Iuit it!
!tep four is to create a folder to put the (:* files into!
The best place to do this is in the D*itesD folder, to make it
eas/ to use them throu"h the Apache server built into /our
s/stem! Kou can name the folder an/thin" /ou 2ant, m/
one is called DdrupalNcvsD!
!tep fie open the (:0 application, /ou no2 need to
(heckout 4do2nload5 the latest version of the Drupal (:*
like this:
Tools+_Cepositories+_*ho2 Cepositories
(lick Add
Choose a repository dialo" bo 2ill appear!
9n 2epository type choose pserer!
CI! 4ser: /our 4sername 4that /ou applied for (:*
2ith5
-ost: cs.drupal.org
1ath: %cs%drupal 4main distro5 or %cs%drupal-contrib
4contributions5
Drupal Handbook: 20 April 2005 2%5
1assword: /our password 4that /ou applied for (:* 2ith5
(lick Add!
;et "o to Tools+_Cepositories+_*ho2 Cepositories
The Drupal repositor/ is no2 listed in the 2epositories
2indo2! *elect it and press Chec#out...
Chec#out $odule dialo" bo appears!
Choose $odule: drupal 4main distro5 or contributions
4contributions5
/ew wor# area location: Choose... select the folder /ou
created in step four!
)ress Chec#out!
,ait patientl/, this ma/ take some time, as the 2hole of
the Cepositor/ needs to be do2nloaded + /ou can see this
happenin" if /ou open the console 2indo2 4Tools+
_(onsole+_*ho2 (onsole5, donDt 2orr/ if /ou donDt see
an/thin" at first, (:0 usuall/ thinks about 2hat itDs doin"
for a minute or t2o before takin" action!
,hen this is finished /ou 2ill have a cop/ of the Drupal
repositor/ files in the folder /ou created on /our hard
drive, this is /our Wor# Area, 2here /ou 2ork on proFects
before uploadin" them to the repositor/ for others to use!
Using C6 # C6,
Kou no2 have a Wor# Area on /our hard drive 2hich is a
mirror of the Cepositor/ on the Drupal server! Kou can see
this b/ usin" the (:0 menu ,ork Area+_.pen Cecent and
selectin" the repositor/ /ou Fust do2nloaded 4drupal or
contributions5!
Kou can use this 2ork area in the same 2a/ /ou 2ould an/
other folder on /our hard drive + create ne2 files 2ith
--Hdit 4or 2hatever /ou use5, dra" files to the trash, add
ne2 folders, delete folders + itDs Fust a re"ular folder!
.nce /ouDve done some 2ork /ou 2ant to upload back to
the Drupal server hereDs 2hat /ou do:
'pdate the (:* b/ selectin" the folder the ne2 2ork is in,
then ControlKClic# on the folder and choose 4pdate
from the contetual menu that pops up 4or throu"h the
Drupal Handbook: 20 April 2005 2%%
menu 6ile+_'pdate5! (:* no2 sho2s an/ ne2 files or
folders that /ou have added 42ith a blue L in front5!
;et /ou need to tell (:* to mark the files and folders for
upload net time /ou send /our chan"es to the Drupal
repositor/! To do this select the files and folders and
ControlKClic#, choose Add To Wor# Area 4or throu"h
the menu 6ile+_Add To ,ork Area5!
To upload /our 2ork to the Drupal repositor/, select /our
files and folders and ControlKClic#, choose Commit...
4or throu"h the menu 6ile+_(ommit!!!5! (:* 2ill no2 add
/our 2ork to the Drupal repositor/!
Preparing a proBect
;e2 module, theme or translation proFects should be
started in the cvs contributions repositr/!
9n the 6inder, "o to the folder 2here /ou saved the cvs
contributions 2orkin" cop/, and create a ne2 folder in the
appropriate sub folder + e!"! for a ne2 module create ne2
folder in the module folder! ;ame the ne2 folder to
2hatever /ou 2ant to call the proFect, tr/ to make the
name short and descriptive, avoid spaces, use G=G to
separate 2ords!
9n (:0 open the cvs contributions 2ork area, navi"ate to
the folder containin" the ne2 folder /ou Fust created,
control+click on it and select G2efreshG from the menu
that pops up!
The ne2 folder, and an/ files /ou put in it, should no2
sho2 up in (:0 2ith a blue L net to it!
The blue O si"nifies that the files have not been added to
the 2ork area /et!
9n (:0 select the ne2 folder, control+click on it and select
G$ar# 3ile@sA for AdditionG from the menu that pops up!
The blue O 2ill no2 chan"e to a "reen K net to each of
the ne2 files and folders, si"nif/in" that the files are part
of the 2orkin" cop/ and can be added to the repositor/ at
drupal!or" once /ou 2ant to commit them!
Drupal Handbook: 20 April 2005 2%?
Committing a proBect
.nce /our ne2 module, theme or translation is complete
/ou ma/ 2ant to add it to DrupalDs contributed repositor/,
and create a proFect for it at 222!drupal!or"!
C6
Kour ne2 proFect should first be added to the trunk of the
contrib repositor/, 2hich is kno2 as the DcvsD or DHHADD
branch! 4see *ettin" up5
Add the files to the DcvsD version of the contrib repositor/
4see )reparin" a proFect5! .nce added to (:*, the proFect
folder and each of itDs files 2ill have a "reen DXD net to it,
this means the/ are read/ to be commited!
*elect the proFectDs folder, for eample:
banana.module
contribJmodulesJbananaJbanana!module
select folder DbananaD
,ith the proFect folder selected, control+click, select
D(ommit!!!D
A dialo" bo 2ill appear into 2hich /ou can t/pe a lo"
messa"e! The lo" messa"e should briefl/ eplain 2hat ne2
features have been added to this version of the files or
2hat bu"s have been fied!
ProBect
Kour files are no2 in the contrib repositor/, no2 /ou need
to make drupal!or" a2are of /our ne2 proFect!
-/ creatin" a DproFectD at 222!drupal!or" the files in (:*
become available for do2nload on the DDo2nloadsD pa"e, it
also allo2s users to submit feature reIuests and bu"
reports for the proFect!
0o" in to 222!drupal!or", in the side account block click
on Gcreate contentG, then click GproFectG!
6ill in the proFect form pa"e to create the ne2 proFect! The
proFect 2ill apear on drupal!or" in a da/ or t2o!
Drupal Handbook: 20 April 2005 2%&
Promoting a proBect to be an official
release
To promote a proFect from the HHAD of the (:* tree to an
official release state, the author needs to move the (:*
ta"!
6or instance, to promote the (:* HHAD of the 6rench
translation to the official $!5 release, usin" the command
line from 2ithin inside the contributionsJtranslationJfr, Fust
do:
$ cvs up 3d<
$ cvs tag 3D HGIK<=3536
Apply for contributions C6 access
VEphp drupalN"oto4Dcvs+applicationD5R E_
Using C6 *ith branches and tags
To mana"e the different Drupal versions, 2e use ta"s and
branches! A branch specifies a maFor Drupal version! 6or
eample, all $!$! versions belon" in the DC')A0+$+$
branch! ,henever 2e release a specific version, 2e create
a ta"! A ta" is a marker 2hich defines a snapshot of all the
files in the (:* at a certain moment! 6or eample, the ta"
DC')A0+$+$+0 specifies all files at the time of the $!$!0
release! The HHAD branch is special and is used to refer to
the latest development version!
6or an up+to+date complete list of branches and ta"s, see
G*ho2 files usin" ta":G at :ie2(:* 4at the bottom5!
HereDs a Iuick "uide on usin" ta"s and branches! This
assumes /ou have successfull/ checked out the DmainD and
DcontributionsD repositories! 9n m/ case, 9 usuall/ make a
folder in m/ home director/ for each cvs server! 9n
DrupalDs case, cvs+drupa!+org! 6or instance, /ouDve made
the (:* folder and here /ou check out /our cop/ of the
(:* version of Drupal!
[cvs+drupa!+org$ cvs 3d %
pserver%anonymousScvs+drupa!+org%.cvs.drupa! !ogin
[cvs+drupa!+org$ cvs co drupa!
Drupal Handbook: 20 April 2005 2%3
This should leave /ou 2ith a folder
cvs+drupa!+org.drupa! 2hich contains the current (:*
code! Kou can keep this up+to+date b/ "oin" into the
cvs+drupa!+org.drupa! director/ and usin" the command
[.cvs+drupa!+org.drupa!$ cvs update 3dK
2hich 2ill "ive /ou the latest cop/, create an/ ne2
directories that eist in the repositor/ 4+d5, and trim
unused directories 4+)5! ;ote that /ou donDt need to specfi/
the server at this point since the drupa! director/ contains
a BR: folder that contains the repositor/ and root
information!
KouDve also done this for the contributions,
[cvs+drupa!+org$ cvs 3d %
pserver%anonymousScvs+drupa!+org%.cvs.drupa!3contri !ogin
[cvs+drupa!+org$ cvs co contriutions
,hich leaves /ou 2ith the latest contributions in the
cvs+drupa!+org.contriutions director/!
-ut no2 /ou 2ant to have a nice cop/ of the $!7!0 version,
and /ou donDt 2ant to have to do2nload the t"= file all the
time! The (:* maintainer has branched the drupal
repositor/ and ta""ed it to keep track of this release! 9f
/ou do2nload it directl/ 2ith the release ta" itDs "oin" to
over2rite /our drupal folder! Kou probabl/ 2ant to keep it
simple and use this command:
[cvs+drupa!+org$ cvs 3d %
pserver%anonymousScvs+drupa!+org%.cvs.drupa! 37 chec(out 3d
drupa!35+@ 3r HGIK<=353@ drupa!
ThatDs "oin" to create a ne2 director/
cvs+drupa!+org.drupa!35+@+? that contains the $!7!0
version! .nce itDs been checked out, /ou donDt need to
2orr/ about specif/in" it a"ain! The BR: director/ in the
drupa!35+@+? director/ has the ta" information alon" 2ith
repositor/ and root information like 2e sa2 before! 1ust "o
into the drupa!35+@ folder and eecute
[.cvs+drupa!+org.drupa!35+@$ cvs update 3dK
to keep /our cop/ of the $!7!0 branch up to date!
Drupal Handbook: 20 April 2005 2?0
!indo*s
Kou ma/ have noticed this 2as "eared to2ards the linu
user! *orr/, 9 havenDt used the 2indo2s clients for (:*!
9Dm sure the/ 2ould 2ork, 9 Fust havenDt tried them 4for
ver/ lon"5! Kou could probabl/ do this same thin" on /our
2indo2s bo b/ installin" one of the 2indo2s #'9s or
usin" (/"2in, a #;'J';98 client for 2indo2s! )robabl/
the easiest 2a/ it to use Tortoise(:*!
A/ailable &ranches
The available branches currentl/ are:
HHAD
DC')A0+$+5
DC')A0+$+$
DC')A0+$+7
DC')A0+$+2
DC')A0+$+1
DC')A0+$+0
DC')A0+7+0
The DC')A0+$+7+0 ta" 2e used above is a marker in the
DC')A0+$+7 branch! .ther ta"s for DC')A0+$+7 are
DC')A0+$+7+1 and DC')A0+$+7+2!
Tracking Drupal source *ith C6
;ote: The follo2in" assumes /ou have both basic
kno2led"e of (:* and /our o2n local repositor/ set up
and 2orkin"!
9f /ourve been modif/in" the Drupal source code for /our
o2n purposes 4or developin" a module or theme5 and
manuall/ appl/in" /our chan"es to the Drupal source
ever/ time it updates, /ou ma/ be "lad to learn that (:*
can help make this easier!
This is usuall/ referred to as strackin" third+part/ sourcesr
and reIuires kno2led"e of the (:* concepts branchin",
release ta"s, and the vendor ta"! ,erll 2ork throu"h an
eample here and eplain these concepts as 2e "o!
Drupal Handbook: 20 April 2005 2?1
An C-ample
0ets assume 2erd like to track current Drupal (:* HHAD,
and start b/ do2nloadin" the source! 9n this case 2erll
eport usin" anon/mous (:* 42e could also Fust do2nload
a tarball5!
-e"in b/ lo""in" in to the anon/mous (:* server, the
reIuired pass2ord is sanon/mousr:
cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa! !ogin
Then eport the ne2est development version of drupal
usin" the HHAD release ta":
cvs 3d%pserver%anonymousScvs+drupa!+org%.cvs.drupa! e$port
3r EA<H drupa!
;o2 that 2e have a local cop/ of the drupal source 2e can
import it into our o2n (:* repositor/! 9n this eample 2e
import 2ith a lo" messa"e includin" the date s3m
*message te$t*r, a module locationJname of
ssites.drupa!r 4customi=e that to suit /our o2n (:*
repositor/5, a vendor ta" of sdrupa!r and a release ta" of
sEA<H,??5?11?r! ,e also use the +ko option to prevent
ke/2ord epansion 4this preserves the (:* W 9d W ta"s
used on drupal!or"5:
cd drupa!
cvs import 3(o 3m *8mport BR: EA<H on Nan 1?th ,??5*
sites.drupa! drupa! EA<H,??5?11?
-efore 2e can customi=e 2e need to checkout into a
2orkin" director/! Then 2e can modif/ a file or files and
commit:
cvs chec(out drupa!
cd drupa!
+++modify a fi!e or fi!es+++
cvs commit
,e no2 have a drupal module 2ith a special svendor
branchr 4identified b/ the vendor ta"5, 2hich contains the
drupal source files 2e imported, and a main trunk 2ith our
modified files! An/ files modified at this point are no2
HHAD on the main trunk of the module, 2hilst the
Drupal Handbook: 20 April 2005 2?2
unmodified files remain HHAD on the vendor branch
4HHAD bein" 2hat is produced b/ cvs update5! 6or an
individual file 4fileone!php5 the version histor/ no2 looks
like somethin" like this:
EA<H
W33333W
[1ain trun(" fi!eone+php F333333333333W 1+, W
U W33333W
W333333333W
[Rendor Mranch" W 1+1+1+1 W
W333333333W
(tag%EA<H,??5?11?)
Updating the /endor branch
At some later point the drupal source code 2ill have been
updated and 2erll 2ant to add the updated version to our
repositor/! ,e do this b/ repeatin" the process described
above, 2e "et a fresh cop/ of the source from drupal!or",
and import usin" the same vendor ta" but chan"e the
release ta" from sEA<H,??5?11?r to reflect the ne2er
version:
cvs import 3(o 3m *8mport BR: EA<H on Nan 11th ,??5*
sites.drupa! drupa! EA<H,??5?111
This updates the vendor branch, a sin"le files revision
histor/ can no2 appear four different 2a/s, dependin" on
2hether it has been modified b/ us, b/ the vendor
4drupal!or"5, b/ both, or not at all!
9f the file 2as modified onl/ b/ us, our modified version
remains the head revision:
EA<H
W33333W
[1ain trun(" fi!eone+php F333333333333W 1+, W
U W33333W
U
W333333333W
[Rendor Mranch" W 1+1+1+1 W
W333333333W
(tag%EA<H,??5?11?)
9f the file 2as modified onl/ b/ the vendor, the ne2
version becomes the HHAD revision:
[1ain trun(" fi!et/o+php F
U
U EA<H
W333333333W W333333333W
Drupal Handbook: 20 April 2005 2?7
[Rendor Mranch" W 1+1+1+1 W3333333333W 1+1+1+, W
W333333333W W333333333W
(tag%EA<H,??5?11?)
(tag%EA<H,??5?111)
And if the file 2as modified b/ both us and the vendor:
EA<H
W33333W
[1ain trun(" fi!ethree+php F333333333333W 1+, W
U W33333W
U
W333333333W W333333333W
[Rendor Mranch" W 1+1+1+1 W3333333333W 1+1+1+, W
W333333333W W333333333W
(tag%EA<H,??5?11?)
(tag%EA<H,??5?111)
.ur version of filethree!php remains the HHAD revision,
but this is clearl/ not desirable since it doesnrt carr/ the
latest chan"es! 9n fact, durin" our import of the latest
source (:* 2ould have 2arned us of conflicts bet2een the
t2o versions of filethree!php, 2e need to mer"e the
chan"es to remove this conflict:
cvs chec(out 32EA<H,??5?11? 32EA<H,??5?111 drupa!
Hamine the mer"ed file to ensure the chan"es (:* made
2ere sane and then scvs commitr the chan"es back to the
main trunk! 0eavin" us 2ith a ne2 revision 2hich becomes
HHAD:
EA<H
W33333W W33333
W
[1ain trun(" fi!ethree+php F333333333333W 1+, W3333333W 1+@
W
U W33333W W33333
W
U
W333333333W W333333333W
[Rendor Mranch" W 1+1+1+1 W3333333333W 1+1+1+, W
W333333333W W333333333W
(tag%EA<H,??5?11?)
(tag%EA<H,??5?111)
ummary
9t should no2 be clear that usin" the (:* vendor ta" to
create a vendor branch in /our o2n drupal module /ou
can track chan"es to the drupal source code 2hilst also
maintainin" and developin" /our o2n customi=ations and
Drupal Handbook: 20 April 2005 2?$
ne2 features for drupal! This eample has been kept ver/
simple for the purposes of eplanation, but the basic
process can be used to achieve man/ different thin"s,
some eamples:
Track a specific release of Drupal 4e!"! $!7, or $!25,
instead of the development 4(:* HHAD5 version!
<aintain /our customi=ed sites 2ith modules,
themes, static pa"es, ima"es etc all added to /our
(:* repositor/, 2hilst still trackin" and importin"
updates to the drupal core!
-ranch /our module to maintain several customi=ed
2eb sites off a sin"le tracked branch of the drupal
core!
Ceadin" the follo2in" resources is hi"hl/ recommended!
Additional $esources
Article b/ ;ick )atavalis: The mechanics and a
methodolo"/ for trackin" 7rd part/ sources 2ith
(:*
The section tTrackin" third+part/ sourcesn in the
(:* manual
The section tTrackin" third+part/ sourcesn in a book
on (:*
andbo- maintenance rules
Al2a/s document /our chan"es!
*plit different set of patches into different
directories! 9t takes lon"er to find the set of files
relatin" to one chan"e if it is mied in 2ith 2 other
patches!
>eep the documentation current! Tr/ to keep some
track of /our reasonin" too! 9f 9 read in a CHAD<H
that chan"e 8 2asnDt a "ood idea after all it makes
the revie2er 2onder 2h/!
Document the status of /our patch! 9t is important to
kno2 if this is an earl/ test, or considered stable and
2orkable but the author of the patch!
All patches should be a"ainst the latest (:* version
of Drupal, and include in the CHAD<H 2hen it 2as
last s/nced!
DonDt use a sandbo for developin" modules! There
Drupal Handbook: 20 April 2005 2?5
is a different director/ structure for that!
9f /our patch is $ lines lon" donDt bother to put it in a
sandbo! 1ust mail it to the devel list and find out
Iuicker if people like it or not! *mall patches are
Iuick to check and find out if 2ork! *andboes
should be for more etensive chan"es!
Tr/ to maintain patches in the sandbo! The/ are so
much easier to check than compete files! 9f /ou are
usin" (:* then /ou can use diff 4cvs +H diff5
)lease make sure /our script passes the code+st/le!pl
script! 9t isnDt perfect, and sometimes a bit too strict,
but it 2ill ensure some level of compliance 2ith the
codin" standards!
P4P Debugger
,hat do /ou folks use for debu""in" )H)E 9Dm "ettin"
Wconf and header errors on m/ Drupal installation and
2ould like to track them do2n, learnin" Drupal in the
process! 9s there a debu""er for )H) 2here 9 can set
breakpoints, see values chan"e, etc!E Thanks for /our
help!
AP"s and functions 1Do-ygen2
9f /ou are interested in developin" Drupal modules or
hackin" a2a/ at the Drupal core then this is the place to
find details about all the functions and classes defined in
Drupal!
,e no2 use Do/"en to automaticall/ "enerate
documentation from the latest drupal sources! This allo2s
us to ensure that documentation is up+to+date, and to
simultaneousl/ track multiple versions of the
documentation!
A)9 Documentation is available from drupaldocs!or" for:
Drupal (:* HHAD
Drupal $!5!
Drupal $!$!
)lease also read the Drupal (odin" *tandards pa"e, 2hich
contains some "uidelines for 2ritin" Do/"en comments!
Drupal Handbook: 20 April 2005 2?%
Do-ygen 3ormatting Con/entions
Do/"en is a documentation "eneration s/stem! The
documentation is etracted directl/ from the sources,
2hich makes it much easier to keep the documentation
consistent 2ith the source code!
There is an ecellent manual at the Do/"en site! The
follo2in" notes pertain to the Drupal implementation of
Do/"en!
General documentation synta-
To document a block of code, the s/nta 2e use is:
.FF
F Hocumentation here
F.
Do/"en 2ill parse an/ comments located in such a block!
.ur st/le is to use as fe2 Do/"en+specific commands as
possible, so as to keep the source le"ible! An/ mentions of
functions or file names 2ithin the documentation 2ill
automaticall/ link to the referenced code, so t/picall/ no
markup need be introduced to produce links!
Documenting files
9t is "ood practice to provide a comment describin" 2hat a
file does at the start of it! 6or eample:
<?php
.F $8d% theme+inc'v 1+,?, ,??5.?X.?> 1-%?>%,1 dries A$p $ F.
.FF
F Sfi!e
F ;he theme system' /hich contro!s the output of Hrupa!+
F
F ;he theme system a!!o/s for near!y a!! output of the
Hrupa! system to e
F customi4ed y user themes+
F.
The line immediatel/ follo2in" the Ufile directive is a
short description that 2ill be sho2n in the list of all files in
the "enerated documentation! 6urther description ma/
follo2 after a blank line!
Drupal Handbook: 20 April 2005 2??
Documenting functions
All functions that ma/ be called b/ other files should be
documentedR private functions optionall/ ma/ be
documented as 2ell! A function documentation block
should immediatel/ precede the declaration of the function
itself, like so:
.FF
F Rerify the synta$ of the given e3mai! address+
F
F Ampty e3mai! addresses are a!!o/ed+ :ee GDB ,>,, for
detai!s+
F
F Sparam $mai!
F < string containing an emai! address+
F Sreturn
F ;GIA if the address is in a va!id format+
F.
function va!id_emai!_address($mai!) {
The first line of the block should contain a brief
description of 2hat the function does! A lon"er description
2ith usa"e notes ma/ follo2 after a blank line! Hach
parameter should be listed 2ith a Uparam directive, 2ith
a description indented on the follo2in" line! After all the
parameters, a Ureturn directive should be used to
document the return value if there is one! 6unctions that
are easil/ described in one line ma/ omit these directives,
as follo2s:
.FF
F Bonvert an associative array to an anonymous o2ect+
F.
function array,o2ect($array) {
The parameters and return value must be described 2ithin
this one+line description in this case!
Documenting hook implementations
<an/ modules consist lar"el/ of hook implementations! 9f
the implementation is rather standard and does not
reIuire more eplanation than the hook reference
provides, a shorthand documentation form ma/ be used:
.FF
F 8mp!ementation of hoo(_he!p()+
F.
function !og_he!p($section) {
Drupal Handbook: 20 April 2005 2?&
This "enerates a link to the hook reference, reminds the
developer that this is a hook implementation, and avoids
havin" to document parameters and return values that are
the same for ever/ implementation of the hook!
Documenting themeable functions
9n order to provide a Iuick reference for theme
developers, 2e ta" all themeable functions so that
Do/"en can "roup them on one pa"e! To do this, add a
"roupin" instruction to the documentation of all such
functions:
.FF
F Dormat a 7uery pager+
F
F +++
F Singroup themea!e
F.
function theme_pager($tags = array()' $!imit = 1?' $e!ement
= ?' $attriutes = array()) {
+++
)
The same pattern can be used for other functions
scattered across multiple files that need to be "rouped on
a sin"le pa"e!
Creating and sending your patches
9f /ou donDt kno2 2hat a patch is, check the diff and patch
eplanation!
6or a person or compan/ 2ho 2ishes to submit a chan"e,
the process can sometimes be dauntin" if /ouDre not
familiar 2ith Gthe s/stemG! This tet is a collection of
su""estions 2hich can "reatl/ increase the chances of
/our chan"e bein" accepted!
The easiest 2a/ to "et set up for makin" and sendin"
patches is to "et (:* 2orkin"! Then /ou can Fust t/pe: cvs
diff 3u 3D^f [fi!e to patch" to "enerate a patch! To
output it to a file, "o: cvs diff 3u 3D^f [fi!e to
patch" & [outfi!e"
Coding style:
9f /our code deviates too much from the (ode
(onventions, it is more likel/ to be reFected 2ithout
Drupal Handbook: 20 April 2005 2?3
further revie2 and 2ithout comment!
diff -u:
'se diff 3u or diff 3ur9 to create patches: 2hen
creatin" /our patch, make sure to create it in Gunified
diffG format, as supplied b/ the 3u ar"ument to diff!
)atches should be based in the root source director/,
not in an/ lo2er subdirector/! <ake sure to create
patches a"ainst a GvanillaG, or unmodified source tree!
diff -3Mf:
'se the additional 3D^f ar"ument to diff to create
patches that are easier to read! 3D^f tells diff to
include the last matchin" line in the header of the
created patch! This 2ill be the last function definition
if the files adhere to the Drupal (ode (onventions!
Describe your changes:
Describe the technical detail of the chan"e4s5 /our
patch includes and tr/ to be as specific as possible!
;ote that 2e prefer technical reasonin" above
marketin": "ive us clear reasons 2h/ Gthis 2a/G is
"ood! 1ustif/ /our chan"es and tr/ to carr/ enou"h
2ei"ht! 9t is important to note the version to 2hich
this patch applies!
!eparate your changes:
*eparate each lo"ical chan"e into its o2n patch! 6or
eample, if /our chan"es include both bu" fies and
performance enhancements, separate those chan"es
into t2o or more patches! 9f /our chan"es include an
A)9 update, and a ne2 module 2hich uses that ne2
A)9, separate those into t2o patches!
Ierifying your patch
The (:* revie2 team is overloaded revie2in" patch
submissions! )lease make their lives easier b/
assurin" the follo2in":
Test /our codeL
<ake sure /our code is clean and secure! 9f /our
patch is Fust a Iuick hack, then donDt set /our
issue to 1atch status!
Drupal Handbook: 20 April 2005 2&0
)atch a"ainst HHAD! 9f /ou onl/ have a patch
a"ainst a prior revisision, then donDt assi"n /our
issue to 1atch status
!ubmitting your patch:
)atches should be submitted via the issue tracker!
(reate a bu" report or feature reIuest, attach /our
patch usin" the file upload form and set the issueDs
status to patch! *ettin" the status to patch is
important as it adds the patch to the patch Iueue!
Diff and patch
Diff and patch are t2o complementar/ tools for recordin"
and appl/in" chan"es bet2een t2o sets of files!
,e use them for content control even thou"h 2e distribute
our code via (:*! ,h/E -ecause diff and patch provide an
immense amount of control! )atches can be submitted via
e+mail and in plain tetR maintainers can read and Fud"e
the patch before it ever "ets near a tree! 9t allo2s
maintainers to look at chan"es easil/ 2ithout blindl/
inte"ratin" them!
Diff is the first command in the set! 9t has the simple
purpose to create a file called a patch or a diff 2hich
contains the differences bet2een t2o tet files or t2o
"roups of tet files! Diff can 2rite into different formats,
althou"h the unified difference format is preferred! The
patches this command "enerates are much easier to
distribute and allo2 maintainers to see Iuickl/ and easil/
2hat chan"ed and to make a Fud"ement!
)atch is diffDs complement and takes a patch file "enerated
b/ diff and applies it a"ainst a file or a "roup of files!
The actual usa"e of diff and patch is not complicated!
At its simplest, a diff command for comparin" t2o files
2ould be:
diff o!d+t$t ne/+t$t & o!dne/+patch
6or drupal, 2e prefer patches in unified format, so 2e add
+u to the command line:
diff 3u o!d+t$t ne/+t$t & o!dne/+patch
Drupal Handbook: 20 April 2005 2&1
9t is helpful to keep a reference in the patch file to 2hich
function 2as patched, so the follo2in" form of the
command is often used! 6or eample, if /ou have made a
chan"e in foo!module, to create a patch a"ainst the (:*
tree:
cvs diff 3u 3D ^function foo+modu!e & foo+patch
.r if /ou had do2nloaded Drupal instead of checkin" it out
from (:* and 2ere creatin" a patch a"ainst a local cop/
of foo!module:
diff 3u 3D ^function foo+modu!e ne/foo+modu!e & foo+patch
#enerall/, ho2ever, a comparison of t2o source trees is
often desired! A possible command to do so is:
diff 3ru9 o!d ne/ & tree+diff
.nce a patch is "enerated, the process of patchin" the file
is even simpler! -ased on our eamples above, 2e could
do:
patch < o!dne/+patch
.r if /ou 2ant to patch an entire director/, /ou should
use:
patch 3p? 3u < tree+diff
To unappl/ the patch, use:
patch 3p? 3G < tree+diff
Diff and patch on !indo*s
diff
4a"ainst a cvs source 2ith the cvs!ee built+in diff! do diff
local files, /ou need a 2indo2s diff pro"ram, command
line or visual5
7eneric:
find the cvs!ee of /our cvs packa"e 4,in(:*,
Tortoise(:*, c/"2in, !!!5 and make sure it is in
/our )ATH
Drupal Handbook: 20 April 2005 2&2
cd to /our drupal root dir
cvs diff 3u [[3r rev1]3H date1" [3r
rev,]3H date,"" [fi!e_to_diff" [#gt;
fi!e_to_diff+patch"
3u: unified format
3r: revision4s5 to diff
no +r: compare the 2orkin" file
2ith the revision it 2as based on
one +r: compare that revision 2ith
/our current 2orkin" file
t2o +r: compare those t2o revisions
3H: use a dateNspec to specif/ revisions!
eamples: G13?2+03+2$ 20:05G, G2$ *ep
13?2 20:05G!
fi!e_to_diff: path to the file or
director/ /ou 2ant to diff! if /ou specif/ a
director/, the output 2ill include the diff
of all differin" files in this director/ and
all subdirectories!
#gt; fi!e_to_diff+patch: creates a
patch + saves the diff in
fi!e_to_diff+patch instead of
outputtin" it on stdout! if /ou send a
patch, make sure it has the proper line
endin"s
see the (:* manual for a complete list of
and additional options
ia WinCI! 745
1ust select the file /ou edited and ri"ht+mouse+click
_ Gdiff selectionG 4or press the Gdiff selectedG+icon on
the toolbar, or do <enubar _ GMuer/G _ Gdiff
selectionG5! This brin"s up a GDiff settin"sG dialo"
bo that offers some limited options as Grevisions to
diffG and Gi"nore 2hitespaceJcaseG Zupdate 2007+
6eb+0?: startin" 2ith ,in(vs 1!7b11, G6ull diff
options Zare[ available from the diff dialo"G[! The
resultin" diff is output to the ,in(:*+(onsole and
can be copied and pasted!
ia WinCI!%TortoiseCI! e0ternal diff
,in(:*: <enubar _ GAdminG _ G)referencesG
_ G,in(:*G _ GHternal diff pro"ram G! This
pro"ram 2ill be invoked b/ the GDiff selectionG
2hen G'se the eternal diffG is checked!
Drupal Handbook: 20 April 2005 2&7
Tortoise(:*: (:* _ G)referencesG _ GHternal
diff applicationG! This pro"ram 2ill be invoked
b/ G(:* Diff !!!G
*ome eternal visual diff pro"rams for ,indo2s:
Arais <er"e 4commercial5
HamDiff
(*Diff
for those 2ho can live 2J Fava: #uiff/
4commercial5
,in<er"e
/ou ma/ find more here
;otes:
,hile these pro"rams do a nice Fob in sho2in"
file differences visuall/, side b/ side, non of
them 4as i can tell5 allo2s to actuall/ save the
difference in unified format 4most allo2 to save
a standard diff, thou"h5 + update: Tortoise(:*
lets /ou save patches! 9t does unified format b/
default! *ee its <ake )atch option! ;ote that
this D<ake )atchD option can make recursive
patches 2hen applied to directories!
Kou cannot specif/ the G+uG in the Hternal diff
preferences 4e" Gdiff +uG5 as this 2ill result in
G'nable to open Ddiff +uD 4The s/stem cannot
find the file specified!5G! A 2orkaround for this
is to, in the preferences, specif/ a batch+file
that calls the eternal diff 2ith the +u option!
Another 2orkaround is meta+diff, 2hich allo2s
for launchin" of special diff pro"rams for
certain file t/pes!5
line endings: an issue 2ith usin" diff on 2indo2s is that
"enerated patches have 2indo2s line endin"s, 2hich
makes them impossible to appl/ on uni boes Z1[Z2[!
unfortunatel/, there seems to be no 2a/ to convince Gcvs
diffG to output uni line endin"sO! so the onl/ 2a/ for
makin" a proper patch on 2indo2s that i see is to
convert J filter the output from Gcvs diffG to uni line
endin"s:
filter: pipe Gcvs diffGs output throu"h some dos2uni
tool 4like the one from Cobert -! (lark, or like
c/"2insDs dos2uni J d2u5:
Drupal Handbook: 20 April 2005 2&$
cvs diff [options" fi!e_to_diff ] uni$,dos 3u &
fi!e_to_diff+patch
convert: save Gcvs diffGs output to a file:
cvs diff [options" fi!e_to_diff & fi!e_to_diff+patch
and manuall/ convert fi!e_to_diff+patch to uni
line endin"s! ever/ developers editor should be
capable of thisR besides, there are man/ dos2uni
versions that operate on files!
patch
9 havenDt found an/ ,indo2s+#'9 for patch, so the onl/
choice is a ,indo2s+port of the uni+command+line+tool! 9f
/ou kno2 of a ,indo2s+#'9 for patch, please let me kno2
(/"2in + a ';98 environment for ,indo2s,
includin" man/ standard ';98+tools 4includin" diff
and patch5
pre+compiled binaries, available from various places!
*ome 9Dve found:
http:JJ222!sIuirrel!nlJpeopleJFvromansJtpF0$0
7+001%b!html
http:JJ222!"nu!or"Jsoft2areJemacsJ2indo2sJf
aI11!htmlkpatch
;ote:
9 found man/ of the precompiled binaries havin"
problems 2ith pathnames etc! and not 2orkin"
properl/! *o 9 2ould recommend installin" c/"2in +
it takes a 2hile, but after that, /ou have a nice uni
environment + that 2orks!
O and i tried a lot: checkin" out all files 2ith uni line
endin"s, various +kb options, eternal diffs, patched cvs
versions !!! nothin"! for a discussion of this, check (:* and
binar/ files
diff and patch
Kou can tr/ also inte"rated diffJpatch packa"es like a #;'
diffutils for ,indo2s
or "et the #;' utilities for ,in 72!
Drupal Handbook: 20 April 2005 2&5
$ules of re/ie*ing patches
Do revie2 the code not the person!
Do not take a revie2 personall/! 9f /ou "et a bad
revie2 deal 2ith it and make /our patch better! 9t is
a learnin" eperience!
Do help to revie2 other peoples code as it 2ill make
/our o2n code better! 9t 2ill make /our more critical
and likel/ to spot /our o2n mistakes! <i"ht also
teach /ou a trick or t2o /ou didnDt kno2 about!
Do not feel obli"ated to revie2 others code even if
people revie2 /our code! 49t comes hi"hl/
recommended!5
Do "ive friendl/ su""estions on ho2 a person can
improve their code!
Do not demand that /our code "ets revie2ed! Kour
time 2ill come!
Do remind people nicel/ that it 2ould be nice if
someone revie2ed /our code, but onl/ once a 2eek!
Do this "et "ood revie2:
Do make sure the code actuall/ 2orks!
,orkin" code is a bi" plus!
Do make sure the patch is current 2ith Drupal
(:*! 6eel free to refuse to revie2 patches that
donDt appl/ nicel/ to Drupal (:*!
Do look at the code and make sure it follo2s
the Drupal codin" standards!
Do make sure the code uses available support
functions and doesnDt re+invent the 2heel!
Do 2rite documentation both in the code and
for the users!
Do this 2hen revie2in":
Do make sure the patch does ever/thin" in
item &!
Do comment on the "eneral codin" st/le!
Do comment on the user interface!
Do make su""estions on ho2 to improve the
patch!
Do "ive /our vote 4X1J+15 as to 2ether this
should be included in Drupal!
1ust do it!
Drupal Handbook: 20 April 2005 2&%
8aintaining a proBect on drupal.org
Creating a proBect
Hach drupal!or" proFect 4a contributed theme, module or
translation5 needs to be maintained in the contributions
repositor/! -efore creatin" a proFect pa"e on drupal!or",
appl/ for a (:* account and commit /our proFect to the
repositor/! 9f /ou are not usin" the drupal!or"
infrastructure, /ou canDt setup a proFect pa"e on
drupal!or" nor can /ou offer /our module for do2nload at
drupal!or"!
To "et /our proFect listed on drupal!or" after it has been
committed to (:*, fill in the form at
http:JJdrupal!or"JnodeJaddJproFectNproFectJ! <ake sure
that the D*hort proFect nameD matches the director/ name
in the (:* repositor/! 6or eample, the
contributionsJmodulesJm/Nmodule module has the short
name m/Nmodule!
;ote that the ne2l/ created proFect 2ill not be instantl/
available as it 2ill need to be approved b/ one of the
administrators! After that, it 2ill appear soon after /ou
committed some codeJupdates to the contributions
repositor/! .nce the proFect pa"e became available,
people 2ill be able to file bu"s a"ainst /our proFect, add
tasks or reIuest ne2 features! Kour proFect 2ill also
become available for do2nload!
Do*loads and packaging
As soon /our proFect pa"e has been activated and "iven it
is properl/ confi"ured, drupal!or" 2ill automaticall/
packa"e /our proFect and make it available for do2nload!
The proFects are packa"ed once or t2ice a da/ so it 2ill
not be available instantl/!
8anaging releases
Celeases are handled usin" (:* branches! -/ default, onl/
the (:* HHAD version 4development version5 of /our
proFect is packa"ed and offered for do2nload!
Ho2ever, if /ou branch /our proFect usin" the DC')A0+$+
Drupal Handbook: 20 April 2005 2&?
5 branch name, drupal!or" 2ill packa"e the Drupal $!5
compatible release of /our proFect! 6or this to 2ork, /ou
must use the correct branch names! A list of valid branch
names can be found in the contributions repositor/Ds
6AM!tt!
As proFects are onl/ packa"ed once or t2ice a da/, it
mi"ht take up to 2$ hours for ne2 releases to become
available on the 2ebsite or for updates to propa"ate to the
do2nloads!
9f /ou found a bu" that needs to be fied in several
releases of /our proFect, make sure to commit the fi to
the different branches unless /ou are no lon"er
maintainin" certain releases of /our proFect!
-ranchin" and releases are restricted to the modu!es,
themes, theme3engines and trans!ations directories in
the contributions repositor/! )ersonal sandboes in the
sando$ director/ canDt be branched, 2onDt be packa"ed
and canDt "et a proFect pa"e on drupal!or"!
'rphaned proBects
9f /ou are no lon"er capable of maintainin" /our proFect,
please add a note to /our proFect pa"e and ask in the
forums 2hether someone is 2illin" to take over
maintenance! )roper communication is ke/ so make sure
to mark /our proFect as orphaned! 9f /ou found a ne2
maintainer or if /ou are 2illin" to maintain an orphaned
proFect, "et in touch 2ith a site maintainer so 2e can
transfer maintainership!
Drupal.org site maintainers
-elo2 is an alphabetical list of users 2ho have additional
permissions to help maintain the drupal!or" 2ebsite:
adrian
a
-@Sr >essels
-oris <ann
br/an kenned/
cel$1$5
ch
Development *eed
Drupal Handbook: 20 April 2005 2&&
d""reenber"
Dries
drumm
eric"undersen
6actor/1oeUcivi!!!
#oba
1on-ob
1un/or
Fvand/k
kbahe/
>ieran Hu""ins
kika
killesU222!drop!or"
>Fartan
mathias
moshe 2eit=man
n/sus
Cichard Hriksson
Cobert (astelo
robertDou"lass
Coland Tan"laoU!!!
sepeck
*teven
TDobes
'2e Hermann
2alkah
2norri
9f /ou have been around for a 2hile, and /ou 2ant to help
maintain Drupal!or", "et in touch 2ith Dries!
Drupal test suite
Drupal is currentl/ lackin" some test suite to be run b/
developers before submittin" important patches! The
follo2in" setup isnDt reall/ a test suite but it is a start to
avoid the most embarrassin" errors! A more complete
solution 2ould be unit tests as proposed b/ <oshe
,eit=man! but the/Dd also be a lot more 2ork!
.k, here is 2hat 9 2ill do in the future:
Hnable the menu module and disable the Dlo" outD
link!
Cun
Drupal Handbook: 20 April 2005 2&3
/get 3r 33de!ete3after
http%..(i!!es+drupa!devs+org.
2here killes!drupaldevs!or" is m/ development site!
Kou can add ++2ait`5 to the options if /ou donDt 2ant
a free stress test!
9f 9 2ant to test as an authenticated user 9 do
/get 3r 33de!ete3after 33coo(ies=off 33
header='Boo(ie% KEK:A::8H=$$$'
http%..(i!!es+drupa!devs+org.
2here is m/ cookie that 9 "ot out of cookies!tt
inside m/ !mo=illa director/!
;ote that this can take some time! 2"et 2ill access ever/
Drupal pa"e linked from the frontpa"e! Kou can later have
a look at the error lo"s and find out if an/ errors 2here
caused!
8odule de/eloper:s guide
Developer documentation can be found at
http:JJdrupaldocs!or"J and in the remainder of the Drupal
developerDs "uide belo2!
drupaldocs!or" documents the Drupal A)9s and
presents an overvie2 of DrupalDs buildin" blocks
alon" 2ith hand/ eamples!
The Drupal developer "uide provides "uidlines as
ho2 to up"rade /our modules 4A)9 chan"es5 alon"
2ith development tipsJtutorials!
"ntroduction to Drupal modules
,hen developin" Drupal it became clear that 2e 2anted
to have a s/stem 2hich is as modular as possible! A
modular desi"n 2ill provide fleibilit/, adaptabilit/, and
continuit/ 2hich in turn allo2s people to customi=e the
site to their needs and likin"s!
A Drupal module is simpl/ a file containin" a set of
routines 2ritten in )H)! ,hen used, the module code
eecutes entirel/ 2ithin the contet of the site! Hence it
can use all the functions and access all variables and
structures of the main en"ine! 9n fact, a module is not an/
Drupal Handbook: 20 April 2005 230
different from a re"ular )H) file: it is more of a notion
that automaticall/ leads to "ood desi"n principles and a
"ood development model! <odularit/ better suits the
open+source development model, because other2ise /ou
canDt easil/ have people 2orkin" in parallel 2ithout risk of
interference!
The idea is to be able to run random code at "iven places
in the en"ine! This random code should then be able to do
2hatever needed to enhance the functionalit/! The places
2here code can be eecuted are called GhooksG and are
defined b/ a fied interface!
9n places 2here hooks are made available, the en"ine calls
each moduleDs eported functions! This is done b/ iteratin"
throu"h the modules director/ 2here all modules must
reside! *a/ /our module is named foo 4i!e!
modulesJfoo!module5 and if there 2as a hook called bar,
the en"ine 2ill call fooNbar45 if this 2as eported b/ /our
module!
*ee also the overvie2 of module hooks, 2hich is "enerated
from the Drupal source code!
Drupal:s page ser/ing mechanism
A ,alk Throu"h DrupalDs )a"e *ervin" <echanism
or
Tiptoein" *pri"htl/ Throu"h the )H)
This is a commentar/ on the process Drupal "oes throu"h
2hen servin" a pa"e! 6or convenience, 2e 2ill choose the
follo2in" 'C0, 2hich asks Drupal to displa/ the first node
for us! 4A node is a thin", usuall/ a 2eb pa"e!5
http:JJ12?!0!0!1Jlvand/kJdrupalJEI`nodeJ1
A visual companion to this narration can be found hereR
/ou ma/ 2ant to print it out and follo2 alon"! -efore 2e
start, letDs dissect the 'C0! 9Dm runnin" on an .* 8
machine, so the site 9Dm servin" lives at J
'sersJvand/kJ*itesJ! The drupal director/ contains a
checkout of the latest Drupal (:* tree! 9t looks like this:
(HA;#H0.#!tt
cron!php
(:*J
Drupal Handbook: 20 April 2005 231
databaseJ
favicon!ico
includesJ
inde!php
9;*TA00!tt
09(H;*H!tt
<A9;TA9;HC*!tt
miscJ
modulesJ
phpinfo!php
scriptsJ
themesJ
tiptoe!tt
update!php
mlrpc!php
*o the 'C0 above 2ill be be reIuestin" the root
director/ J of the Drupal site! Apache translates that into
inde!php! .ne variableJvalue pair is passed alon" 2ith
the reIuest: the variable DID is set to the value DnodeJ1D!
*o, letDs pick up the sho2 2ith the eecution of inde!php,
2hich looks ver/ simple and is onl/ a fe2 lines lon"!
0etDs take a broad look at 2hat happens durin" the
eecution of inde!html! 6irst, the includesJbootstrap!inc
file is included, brin"in" in all the functions that are
necessar/ to "et DrupalDs machiner/ up and runnin"!
ThereDs a call to drupalNpa"eNheader45, 2hich starts a
timer, sets up cachin", and notifies interested modules
that the reIuest is be"innin"!G ;et, the
includesJcommon!inc file is included, "ivin" access to a
2ide variet/ of utilit/ functions such as path formattin"
functions, form "eneration and validation, etc! The call to
fiN"pcNma"ic45 is there to check on the status of Gma"ic
IuotesG and to ensure that all escaped Iuotes enter
DrupalDs database consistentl/! Drupal then builds its
navi"ation menu and sets the variable Wstatus to the result
of that operation! 9n the s2itch statement, Drupal checks
for cases in 2hich a ;ot 6ound or Access Denied messa"e
needs to be "enerated, and finall/ a call to
drupalNpa"eNfooter45, 2hich notifies all interested modules
that the reIuest is endin"! Drupal closes up shop and the
pa"e is served! *imple, ehE
0etDs delve a little more deepl/ into the process outlined
Drupal Handbook: 20 April 2005 232
above!
The first line of inde!php includes the
includesJbootstrap!inc file, but it also eecutes code
to2ards the end of bootstrap!inc! 6irst, it destro/s an/
previous variable named Wconf! ;et, it calls confNinit45!
This function allo2s Drupal to use site+specific
confi"uration files if it finds them! 9t returns the name of
the site+specific confi"uration fileR if no site+specific
confi"uration file is found, sets the variable Wconfi" eIual
to the strin" DconfD! ;et, it includes the named
confi"uration file! Thus, in the default case it 2ill include
Dconf!phpD! The code in confNinit 2ould be easier to
understand if the variable Wfile 2ere instead called
WpotentialNfilename! 0ike2ise WconfNfilename 2ould be a
better choice than Wconfi"!
The selected confi"uration file 4normall/ J
includesJconf!php5 is no2 parsed, settin" the WdbNurl
variable, the optional WdbNprefi variable, the WbaseNurl
for the 2ebsite, and the Wlan"ua"es arra/ 4default is
GenG`_Gen"lishG5!
The database!inc file is no2 parsed, 2ith the primar/ "oal
of initiali=in" a connection to the database! 9f </*M0 is
bein" used, the database!m/sIl!inc files is brou"ht inR if
)ost"res is bein" used, the pear database abstraction
la/er is used! Althou"h the "lobal variables WdbNprefi,
WdbNt/pe, and WdbNurl are set, the most useful result of
parsin" database!inc is a "lobal variable called WactiveNdb
2hich contains the database connection handle!
;o2 that the database connection is set up, itDs time to
start a session b/ includin" the includesJsession!inc file!
.ddl/, in this include file the eecutable code is located at
the top of the file instead of the bottom! ,hat the code
does is to tell )H) to use DrupalDs o2n session stora"e
functions 4located in this file5 instead of the default )H)
session code! A call to )H)Ds sessionNstart45 function thus
calls DrupalDs sessNopen45 and sessNread45 functions! The
sessNread function creates a "lobal Wuser obFect and sets
the Wuser+_roles arra/ appropriatel/! *ince 9 am runnin"
as an anon/mous user, the Wuser+_roles arra/ contains
one entr/, 1+_anon/mous user!
,e have a database connection, a session has been set
Drupal Handbook: 20 April 2005 237
up!!!no2 itDs time to "et thin"s set up for modules! The
includesJmodule!inc file is included but no actual code is
eecuted!
The last thin" bootstrap!inc does is to set up the "lobal
variable Wconf, an arra/ of confi"uration options! 9t does
this b/ callin" the variableNinit45 function! 9f a per+site
confi"uration file eists and has alread/ populated the
Wconf variable, this populated arra/ is passed in to
variableNinit45! .ther2ise, the Wconf variable is null and an
empt/ arra/ is passed in! 9n both cases, a populated arra/
of name+value pairs is returned and assi"ned to the "lobal
Wconf variable, 2here it 2ill live for the duration of this
reIuest! 9t should be noted that name+value pairs in the
per+site confi"uration file have precedence over name+
value pairs retrieved from the GvariableG table b/
variableNinit45!
,eDre done 2ith bootstrap!incL ;o2 itDs time to "o back to
inde!php and call drupalNpa"eNheader45! This function has
t2o responsibilities! 6irst, it starts a timer if Wconf
ZDdevNtimerD[ is setR that is, if /ou are keepin" track of pa"e
eecution times! *econd, if cachin" has been enabled it
retrieves the cached pa"e, calls moduleNinvokeNall45 for
the DinitD and DeitD hooks, and eits! 9f cachin" is not
enabled or the pa"e is not bein" served to an anon/mous
user 4or several other special cases, like 2hen feedback
needs to be sent to a user5, it simpl/ eits and returns
control to inde!php!
-ack at inde!php, 2e find an include statement for
common!inc! This file is chock+full of miscellaneous utilit/
"oodness, all kept in one file for performance reasons! -ut
in addition to puttin" all these utilit/ functions into our
namespace, common!inc includes some files on its o2n!
The/ include theme!inc, for theme supportR pa"er!inc for
pa"in" throu"h lar"e datasets 4it has nothin" to do 2ith
callin" /our pa"er5R and menu!inc! 9n menu!inc, man/
constants are defined that are used later b/ the menu
s/stem!
The net inclusion that common!inc makes is mlrpc!inc,
2ith all sorts of functions for dealin" 2ith 8<0+C)( calls!
Althou"h one 2ould epect a Iuick check of 2hether or
not this reIuest is actuall/ an 8<0+C)( call, no such
check is done here! 9nstead, over 70 variable assi"nments
Drupal Handbook: 20 April 2005 23$
are made, apparentl/ so that if this reIuest turns to
actuall/ be an 8<0+C)( call, the/ 2ill be read/! An
mlrpcNinit45 function instead ma/ help performance hereE
A small tablesort!inc file is included as 2ell, containin"
functions that help behind the scenes 2ith sortable tables!
#iven the paucit/ of code here, a performance boost could
be "ained b/ movin" these into common!inc itself!
The last include done b/ common!inc is file!inc, 2hich
contains common file handlin" functions! The constants
690HND.,;0.AD*N)'-09( ` 1 and
690HND.,;0.AD*N)C9:ATH ` 2 are set here, as 2ell as
the 690HN*H)ACAT.C, 2hich is mm for ,indo2s machines
and J for all others!
6inall/, 2ith includes finished, common!inc sets )H)Ds
error handler to the errorNhandler45 function in the
common!inc file! This error handler creates a 2atchdo"
entr/ to record the error and, if an/ error reportin" is
enabled via the errorNreportin" directive in )H)Ds
confi"uration file 4php!ini5, it prints the error messa"e to
the screen! DrupalDs errorNhandler45 does not use the last
parameter Wvariables, 2hich is an arra/ that points to the
active s/mbol table at the point the error occurred! The
comment GJJ set error handler:G at the end of common!inc
is redundant, as it is readil/ apparent 2hat the function
call to setNerrorNhandler45 does!
The (ontent+T/pe header is no2 sent to the bro2ser as a
hard coded strin": G(ontent+T/pe: tetJhtmlR charset`utf+
&G!
9f /ou remember that the 'C0 2e are servin" ends 2ith J
lvand/kJdrupalJEI`nodeJ1, /ouDll note that the variable I
has been set! Drupal no2 parses this out and checks for
an/ path aliasin" for the value of I! 9f the value of I is a
path alias, Drupal replaces the value of I 2ith the actual
path that the value of I is aliased to! This slei"ht+of+hand
happens before an/ modules see the value of I! (ool!
<odule initiali=ation no2 happens via the moduleNinit45
function! This function runs reIuireNonce on the admin,
filter, s/stem, user and 2atchdo" modules! The filter
module defines 690THCNHT<0O and 690THCN*TK0HO
constants 2hile bein" included! ;et, other modules are
includeNonceDd via moduleNlist45! 9n order to be loaded, a
Drupal Handbook: 20 April 2005 235
module must 415 be enabled 4that is, the status column of
the Gs/stemG database table must be set to 15, and 425
DrupalDs throttle mechanism must determine 2hether or
not the module is eli"ible for eclusion 2hen load is hi"h!
6irst, it determines 2hether the module is eli"ible b/
lookin" at the throttle column of the Gs/stemG database
tableR then, if the module is eli"ible, it looks at Wconf
ZGthrottleNlevelG[ to see 2hether the load is hi"h enou"h to
eclude the module! .nce all modules have been
includeNonceDd and their names added to the Wlist local
arra/, the arra/ is sorted b/ module name and returned!
The returned Wlist is discarded because the moduleNlist45
invocation is not part of an assi"nment 4e!"!, it is simpl/
moduleNlist45 and not WmoduleNlist ` moduleNlist455! The
strate"/ here is to keep the module list inside a static
variable called Wlist inside the moduleNlist45 function! The
net time moduleNlist45 is called, it 2ill simpl/ return its
static variable Wlist rather than rebuildin" the 2hole arra/!
,e see that as 2e follo2 the final obFective of moduleNinit
45R that is, to send all modules the GinitG callback!
To see ho2 the callbacks 2ork letDs step throu"h the init
callback for the first module! 6irst moduleNinvokeNall45 is
called and passed the strin" enumeratin" 2hich callback
is to be called! This strin" could be an/thin"R it is simpl/ a
s/mbol that call modules have a"reed to abide b/, b/
convention! 9n this case it is the strin" GinitG!
The moduleNinvokeNall45 function no2 steps throu"h the
list of modules it "ot from callin" moduleNlist45! The first
one is GadminG, so it calls moduleNinvoke4GadminG,GinitG5!
The moduleNinvoke45 function simpl/ puts the t2o to"ether
to "et the name of the function it 2ill call! 9n this case the
name of the function to call is GadminNinitG! 9f a function b/
this name eists, the function is called and the returned
result, if an/, ends up in an arra/ called Wreturn 2hich is
returned after all modules have been invoked! The lesson
learned here is that if /ou are 2ritin" a module and intend
to return a value from a callback, /ou must return it as an
arra/! Z1onathan (haffer: Hach GhookG 4our 2ord for 2hat
/ou call a callback5 defines its o2n return t/pe! *ee the
full list of hooks available to module developers, 2ith
documentation about 2hat the/ are epected to return![
-ack to common!inc! There is a check for suspicious input
Drupal Handbook: 20 April 2005 23%
data! To find out 2hether or not the user has permission to
b/pass this check, userNaccess45 is called! This retrieves
the userDs permissions and stashes them in a static
variable called Wperm! ,hether or not a user has
permission for a "iven action is determined b/ a simple
substrin" search for the name of the permission 4e!"!,
Gb/pass input data checkG5 2ithin the Wperm strin"! .ur
Wperm strin", as an anon/mous user, is currentl/ G0access
content, G! ,h/ the 0 at the be"innin" of the strin"E
-ecause Wperm is initiali=ed to 0 b/ userNaccess45!
The actual check for suspicious input data is carried out
b/ validNinputNdata45 2hich lives in common!inc! 9t simpl/
"oes throu"h an arra/ itDs been handed 4in this case the
WNCHM'H*T arra/5 and checks all ke/s and values for the
follo2in" GevilG strin"s: Favascript, epression, alert,
d/nsrc, datasrc, data, lo2src, applet, script, obFect, st/le,
embed, form, blink, meta, html, frame, iframe, la/er,
ila/er, head, frameset, ml! 9f an/ of these are matched
2atchdo" records a 2arnin" and Drupal dies 4in the )H)
sense5! 9 2ondered 2h/ both the ke/s and values of the
WNCHM'H*T arra/ are eamined! This seems ver/ time+
consumin"! Also, 2ould it die if m/ 'C0 ended 2ith
GJEml`trueG or GJEformat`mlGE
The net step in common!incDs eecutable code is a call to
localeNinit45 to set up locale data! 9f the user is not an
anon/mous user and has a lan"ua"e preference set up, the
t2o+character lan"ua"e ke/ is returnedR other2ise, the
ke/ of the sin"le+entr/ "lobal arra/ Wlan"ua"e is returned!
9n our case, thatDs GenG!
The last "asp of common!inc is to call initNtheme45! KouDd
think that for consistenc/ this 2ould be called themeNinit45
4of course, that 2ould be a namespace clash 2ith a
callback of the same name5! This finds out 2hich themes
are available, 2hich the user has selected, and then
includeNonceDs the chosen theme! 9f the userDs selected
theme is not available, the value at WconfZGthemeNdefaultG[
is used! 9n our case, 2e are an anon/mous user 2ith no
theme selected, so the default template theme is used!
Thus, the file themesJtemplateJtemplate!theme is
includeNonceDd! The inclusion of template!theme calls
includeNonce4GthemesJtemplateJtemplate!incG, creates a
ne2 obFect called template as a "lobal variable! 9nside
Drupal Handbook: 20 April 2005 23?
this obFect is an template obFect called GtemplateG 2ith
lots of attributes! Then there is a nonfunctional line 2here
*et;ull-lock is called! A comment indicates that someone
is a2are that this doesnDt 2ork!
;o2 2eDre back to inde!phpL A call to fiN"pcNma"ic45 is
in order! The G"pcG stands for #et, )ost, (ookie: the three
places that unescaped Iuotes ma/ be found! 9f deemed
necessar/ b/ the status of the boolean ma"icNIuotesN"pc
directive in )H)Ds confi"uration file 4php!ini5, slashes 2ill
be stripped from WN#HT, WN).*T, WN(..>9H, and
WNCHM'H*T arra/s! 9t seems odd that the function is not
called fiN"pcNma"icNIuotes, since it is the Gma"ic IuotesG
that are bein" fied, not the ma"ic! 9n m/ distribution of
)H), the ma"icNIuotesN"pc directive is set to G.ffG, so
slashes do not need to be stripped!
The net step is to set up menus! 9Dm not sure 2h/ 2eDre
settin" up menus for an anon/mous user, but letDs "o
ahead and follo2 the lo"ic an/2a/! Z'pdate: 1onathan
(haffer enli"htens me: This step is crucial! The menu
s/stem doesnDt Fust handle displa/in" menus to the user,
but also determines 2hat function 2ill be handed the
responsibilit/ of displa/in" the pa"e! The GIG variable 42e
usuall/ call it the Drupal path5 is matched a"ainst the
available menu items to find the appropriate callback to
use! <uch more information on this topic is available in
the menu s/stem documentation for developers![ ,e Fump
to menuNeecuteNactiveNhandler45 in menu!inc! This sets
up a WNmenu arra/ consistin" of items, local tasks, path
inde, and visible arra/s! Then the s/stem reali=es that
2eDre not "oin" to be buildin" an/ menus for an
anon/mous user and bo2s out! The real meat of the node
creation and formattin" happens here, but is comple
enou"h for a separate commentar/! -ack in inde!php, the
s2itch statement doesnDt match either case and 2e
approach the last call in the file, to drupalNpa"eNfooter in
common!inc! This takes care of cachin" the pa"e 2eDve
built if cachin" is enabled 4itDs not5 and calls
moduleNinvokeNall45 2ith the GeitG callback s/mbol!
Althou"h /ou ma/ think 2eDre done, )H)Ds session handler
still needs to tid/ up! 9t calls sessN2rite45 in session!inc to
update the session database table, then sessNclose45 2hich
simpl/ returns 1!
Drupal Handbook: 20 April 2005 23&
,eDre done!
Tips for database compatibility
9n order to ensure that /our module 2orks 2ith all
compatible database servers 4currentl/ )ost"res and
</*M05, /ouDll need to remember a fe2 points!
,hen /ou need to 09<9T /our result set to certain
number of records, /ou should use the
dbNIuer/Nran"e45 function instead of dbNIuer/45! The
s/nta of the t2o functions is the same, 2ith the
Drupal Handbook: 20 April 2005 233
addition of t2o reIuired parameters at the end of
dbNIuer/Nran"e45! Those parameters are Wfrom and
then Wcount! 'suall/, Wfrom is 0 and Wcount is the
maimum number of records /ou 2ant returned!
9f possible, provide *M0 setup scripts for each
supported database platform! The differences
bet2een each platform are sli"ht + 2e hope
documentation on these differences 2ill be
forthcomin"!
Kou should test an/ comple Iueries for A;*9
compatibilit/ usin" this tool b/ <imer
9f /ou are developin" on </*M0, use itDs A;*9
compatibilit/ mode
9f /ou can install all database servers in /our
environment, it is helpful to create shell databases in
each and then run sample Iueries in each platformDs
Iuer/ dispatch tool! .nce /our Iuer/ succeeds in all
tools, con"ratulate /ourself!
DonDt use '' 2hen /ou mean 9I==
Avoid table and field names that mi"ht be reserved
2ords on an/ platform!
DonDt use auto+increment or *HC9A0 fields! 9nstead,
use an inte"er field and levera"e DrupalDs o2n
seIuencin" 2rapper: d_ne$t_id
(<ta!ename_fie!dname&)
Updating your modules
As Drupal develops 2ith each release it becomes
necessar/ to update modules to take advanta"e of ne2
features and sta/ functional 2ith DrupalDs A)9!
Con/erting H.G modules to 4.G
$e(uired changes
8odified form function0
Drupal F.(:
function form($action' $form' $method = *post*' $options =
?)
.. A$amp!e
Drupal Handbook: 20 April 2005 700
g!oa! $GAJIA:;_IG8;
$form = form_hidden(*nid*' $nid);
print form($GAJIA:;_IG8' $form);
Drupal N.(:
function form($form' $method = *post*' $action = ?' $options
= ?)
.. A$amp!e
$form = form_hidden(*nid*' $nid);
print form($form);
Con/erting 4.G modules to 4.I
$e(uired changes
8odified block hook0
Drupal 4.G0
function F_!oc(() {
$!oc(s[?"[*info*" = *Dirst !oc( info*;
$!oc(s[?"[*su2ect*" = *Dirst !oc( su2ect*;
$!oc(s[?"[*content*" = *Dirst !oc( content*;
$!oc(s[1"[*info*" = *:econd !oc( info*;
$!oc(s[1"[*su2ect*" = *:econd !oc( su2ect*;
$!oc(s[1"[*content*" = *:econd !oc( content*;
.. return array of !oc(s
return $!oc(s;
)
)
Drupal 4.I0
function F_!oc(($op = *!ist*' $de!ta = ?) {
if ($op == *!ist*) {
$!oc(s[?"[*info*" = *Dirst !oc( info*;
$!oc(s[1"[*info*" = *:econd !oc( info*;
return $!oc(s; .. return array of !oc( infos
)
e!se {
s/itch($de!ta) {
case ?%
$!oc([*su2ect*" = *Dirst !oc( su2ect*;
$!oc([*content*" = *Dirst !oc( content*;
Drupal Handbook: 20 April 2005 701
return $!oc(;
case 1%
$!oc([*su2ect*" = *:econd !oc( su2ect*;
$!oc([*content*" = *:econd !oc( content*;
return $!oc(;
)
)
)
8odified ta-onomy AP"0
Drupal 4.G0
function ta$onomy_get_tree($vocau!ary_id' #$tree' $parent =
?' $depth = 31' $(ey = *tid*)
Drupal 4.I0
$tree = ta$onomy_get_tree($vocau!ary_id' $parents = ?'
$depth = 31' $(ey = *tid*)
(han"es:
+ there is no more a GparentG propert/, but GparentsG 2hich
is an arra/
+ the result tree is no2 returned instead of passed b/
reference
'ptional changes
Take advanta"e of ne2 taonom/ functions
ta$onomy_get_vocau!ary_y_name($name);
ta$onomy_get_term_y_name($name);
Take advanta"e of pa"er functions
<ove hardcoded markup from modules to themes,
usin" themeNinvoke
Con/erting 4.I modules to 4.?
*ome points posted b/ Ael on drupal+devel on mi"ratin"
$!1!0 modules to (:* Zupdated and added to b/ a[:
the bi" Gclean 'C0G patch: .ver the 2eekend, Zdries[
bit the bullet and converted ever/ sin"le 'C0 in
DrupalDs code! meanin" 2eDll Zcan[ have clean 'C0s
like http:JJfoo!comJarchiveJ2007J01J0%,
Drupal Handbook: 20 April 2005 702
http:JJfoo!comJuserJ$2, http:JJfoo!comJblo", and so
on!! meanin", for the code:
drupa!_ur!(array(*mod* =& *search*' *op*
=& *!a*)' *modu!e*[' $anchor = **")
became
ur!(*search.!a*),
2ith the first url part bein" the module, the
second 4t/picall/5 bein" the operation 4Wop5R
more ar"uments are handled differentl/ per
module convention!
!(*vie/ node*' array(*op* =& *vie/*'
*id* =& $nid)' *node*[' $anchor = **'
$attriutes = array()")
became
!(*vie/ node*' *node.vie/.$nid*['
$attriutes = array()' $7uery = 9I==")
similar,
!m(), 2hich meant Gmodule linkG and used to
be modu!e+php?mod=!a#op=!u+++, is no2 !
(*tit!e*' *!a.!u.+++*5R and
!a(), 2hich meant Gadmin linkG and used to be
admin+php?mod=!a#op=!u+++, is no2 !
(*tit!e*' *admin.!a.!u.+++*
After fiin" those functions, /ouDll need to edit
/our Npa"e45 function and possibl/ others so
that the/ "et their ar"uments usin" the ar"45
function 4see includesJcommon!inc! These
ar"uments used to be "lobals called GmodG,
GopG, GidG etc! no2 these same ar"uments must
be accessed as ar"415, ar"475, for eample!
$theme3&function() became theme(*function*)!
see Zdrupal+devel[ renamin" 2 functions, Zdrupal+
devel[ theme4GfunctionG5 vs Wtheme+_function45 and
Zdrupal+devel[ Z(:*[ theme45
#!t;modu!e#gt;_conf_options() became
#!t;modu!e#gt;_settings() + see Zdrupal+devel[
renamin" 2 functions! note that doesnDt "et an etra
menu entr/, but
is accessed via Gsite confi"uration _ modules _
modules settin"sG
the administration pa"es "ot chan"ed Iuite a lot to
use a Gdatabase driven link s/stemG and become
more lo"icalJintuitive + see Zdrupal+devel[ 8+mas
Drupal Handbook: 20 April 2005 707
commit: administration pa"es! this first tr/ resulted
in poor performance and a not+so+"ood api, so it "ot
refactored + see Z)AT(H[ menus! this, as of time a
is 2ritin" this, isnDt reall/ satisf/in", neither 4/ou
cannot build arbitrar/ menu+trees, some forms donDt
2ork 4taonom/ _ add term5, !!!5, so it probabl/ 2ill
chan"e a"ain! and i 2onDt 2rite more about this
here!
2ell, this: /ou use menu() to add entries to the admin
menu! menu(*admin.node.nodes.?*' *ne/ or
updated posts*' *node_admin*' *he!p*' ?);
adds a menu entr/ Gne2 or updated postsG 1 level
belo2 Gpost overvie2G 4adminJnodeJnodes5 and 2
level belo2 Gnode mana"ementG 4adminJnode5 4ie! at
the 7! level5, 2ith a 2ei"ht of 0 in the 7! level, 2ith a
line GhelpG belo2 the main headin"! for the callback
4GnodeNadminG5 !!! ask dries or =b/nek
one more note, thou"h: /ou do not add
#!t;modu!e#gt;_settings() to the menu 4the/
automaticall/ "o to Gsite confi"uration _ modules _
module settin"sG + /ou onl/ add
#!t;modu!e#gt;_admin+++() !!! thin"s!
Zfrom commentNisNne2 function lost[
3 comment_is_ne/($comment)
W node_is_ne/($comment3&nid' $comment3&timestamp)
please add J update J correctL
Con/erting 4.? modules to 4.H
Database table prefi0
.n 2007 1ul 10, Dries committed *lavicaDs table prefi
patch 2hich allo2s for a confi"urable Gprefi to each
drupal m/sIl table to easil/ share one database for
multipl/ applications on server 2ith onl/ one
database allo2ed!G This patch reIuires all table
names in *M0+Iueries to be enclosed in Pcurl/
bracketsQ, e"!
3 d_7uery(*HA=A;A DGC1 oo( OEAGA nid = \d*' $node3
&nid);
W d_7uery(*HA=A;A DGC1 {oo() OEAGA nid = \d*' $node3
&nid);
Drupal Handbook: 20 April 2005 70$
so that the table prefi can be d/namicall/ prepended
to the table name! *ee the ori"inal feature reIuest
and the correspondin" discussion at the mailin" list
for details!
/ew help system
6rom <ichael 6ranko2ski messa"e:
;here is a !oc( of te$t p!aced at the top of each
admin page y
the admin_page function+ <fter 5+@+? is out the door
the function
menu_get_active_he!p() shou!d proa!y e rename.moved
into the he!p
modu!e and e attached 33 someho/ 33 to every _page
hoo( (proa!y in
the node modu!e) so that /e can use this system through
out Hrupa! ut
for right no/' there is a !oc( of te$t disp!ayed at
the top of every
admin page+ ;his is the active he!p !oc(+ (conte$t
sensitive he!p?)
8f the IG= of the admin page matches a IG= in a
_he!p hoo( then
the te$t from that _he!p hoo( is disp!ayed on the top
of the admin
page' if there is no match the !oc( it not disp!ayed+
Mecause Hrupa!
matches IG=s in order to stic( *other* stuff in the
_he!p hoo( /e
have ta(en to stic(ing descriptors after a *0* sign+ :o
far the
fo!!o/ing discriptors are recoginised%
admin.system.modu!es0name 3& ;he name of a
modu!e (unused' ut there)
admin.system.modu!es0description 3& ;he description
found on the
admin.system.mo
du!es page+
admin.he!p0 3& ;he modu!es he!p te$t'
disp!ayed on
the admin.he!p
page and through the
modu!es
individua! he!p !in(+
user.he!p0 3& ;he he!p for a distruted
authori4ation
modu!e+
8n the future /e /i!! proa!y recognise 0!oc( for
the te$t needed
in a !oc( disp!ayed y the he!p system+
Drupal Handbook: 20 April 2005 705
FFF Eo/ to ui!d up a _he!p hoo(%
:tart /ith this temp!ate 33
function _he!p($section){
$output = **;
s/itch ($section) {
)
return $output;
)
8n the temp!ate rep!ace /ith the name of your
modu!e+
8D you /ant to add he!p te$t to the overa!!
administrative
section+ (admin.he!p) stic( this inside the s/itch%
case 'admin.he!p0'%
$output = t(';he te$t you /ant disp!ayed');
rea(;
8f you a!so /ant this same te$t disp!ayed for an
individua! he!p !in( in
your menu area+ Pou have this (ind of tree%
W <dministration
]
3& Pour area
] ]
] 3& Pour configuration
] 3& he!p
]
3& Cvera!! admin he!p+
Bhange the function !ine to this%
function _he!p($section = 'admin.he!p0') {
9o/ that you have the temp!ate started p!ace a case
statement in for
any IG= you /ant a *conte$t sesitive* he!p message in
the admin
section+ <n e$amp!e' you have a page that individua!!y
configures
your modu!e' it is at admin.system.modu!es.' you /ant
to
add some te$t to the top he!p area+
case 'admin.system.modu!es.'%
$output = t('Pour ne/ he!p te$t');
rea(;
FFF Eo/ to convert a _system hoo(%
Drupal Handbook: 20 April 2005 70%
;here are three things that can appear in a _system
hoo(%
$fie!d == *name* 3& ;he modu!e name'
$fie!d == *description* 3& ;he description p!aced in
the modu!e !ist'
$fie!d == *admin3he!p* 3& ;he he!p te$t p!aced at
the ;CK of this
modu!es individua!
configuration area+
;a(e the te$t for each one and move it into the _he!p
hoo(+ Gep!ace the
$system[" that is norma!!y at the front of each one
/ith $output'
no/ p!ace a *rea(;* after the !ine and a *case ''%*
efore it /here
name is one of the fo!!o/ing%
8f $system is $system[*name*" then case is case
'admin.system.modu!es0name'%'
8f $system is $system[*description*" then case is
case
'admin.system.modu!es0description'%
8f $system is $system[*admin3he!p*" then case is
case
'admin.system.modu!es.'%
;hen remove the _system function and you are done+
<n e$amp!e% :tarts /ith 33
function e$amp!e_system($fie!d){
$system[*description*" = t(*;his is my e$amp!e
_system hoo( to convert for
the he!p system 8 have spent a !ot of time /ith+*);
$system[*admin3he!p*" = t(*Ban you e!ieve that 8
/ou!d actua!!y /rite an
indivdua! setup page on an AL<1K=A modu!e??*);
return $system[$fie!d";
)
Ands /ith 33
function e$amp!e_he!p($section) {
$output = **;
s/itch ($section) {
case 'admin.system.modu!es0e$amp!e'%
$output = t(*;his is my e$amp!e _system hoo( to
convert for the he!p
system 8 have spent a !ot of time /ith+*);
rea(;
case 'admin.system.modu!es.e$amp!e'%
$output = t(*Ban you e!ieve that 8 /ou!d
actua!!y /rite an indivdua!
setup page on an AL<1K=A modu!e??*);
rea(;
)
Drupal Handbook: 20 April 2005 70?
return $output;
)
FFF Eo/ to convert an _auth_he!p hoo(%
C(ay' you have /ritten your Histriuted <uthori4ation
modu!e' and given us
a great he!p te$t for it and 8 had to go and ruin it
a!! y changing the he!p
system+ Ohat a terri!e thing for me to do+ Eo/ do you
convert it?
8t is not that hard+ ;here are t/o p!aces you have to
dea! /ith%
1) ;he te$t inside the _auth_he!p hoo( needs to e
moved inside
the _he!p hoo( under the section *user.he!p0*
and
,) Pou have to change the _page hoo(' /hich
norma!!y disp!ays that
he!p te$t' to find your te$t in a ne/ !ocation
y changing
the function ca!! _auth_he!p() to
_he!p(*user.he!p0*)+
:ee' it is not ;E<; terri!e+
<n e$amp!e%
function e$amp!eda_page() {
theme(*header*);
theme(*o$*' *A$amp!e H<*' e$amp!eda_auth_he!p());
theme(*footer*);
)
function e$amp!eda_auth_he!p() {
$site = varia!e_get(*site_name*' *this /e site*);
$htm!_output = *
<p&;his is my e$amp!e Histriuted <uth he!p+ Ising
this e$amp!e you
cannot !ogin to <i&\s<.i& ecause it has no _auth
hoo(+<.p&
<p&<u&MI;<.u& you shou!d sti!! use Hrupa! since it is
a
<&QGA<;<.& B1: and is on!y getting etter+<.p&
<p&;o !earn aout aout Hrupa! you can <a
href=U*///+drupa!+orgU*&visit the site<.a&<.p&*;
return sprintf(t($htm!_output)' $site);
)
Ands /ith 33
function e$amp!eda_page() {
theme(*header*);
theme(*o$*' *A$amp!e H<*' e$amp!eda_he!p
Drupal Handbook: 20 April 2005 70&
('user.he!p0e$amp!eda'));
theme(*footer*);
)
function e$amp!eda_he!p($section) {
$output = **;
s/itch ($section) {
case 'user.he!p0e$amp!eda'%
$site = varia!e_get(*site_name*' *this /e
site*);
$output += *<p&;his is my e$amp!e Histriuted
<uth he!p+ Ising this
e$amp!e you cannot !ogin to \site ecause it has no
_auth hoo(+<.p&*;
$output += *<p&<u&MI;<.u& you shou!d sti!! use
Hrupa!
since it is a <&QGA<;<.& B1: and is on!y getting
etter+<.p&*;
$output += *<p&;o !earn aout aout Hrupa! you
can
\drupa!+<.p&*;
$output = t($output' array(*\site* =&
*<i&$site<.i&*'
*\drupa!* =& *<a href=U*///+drupa!+orgU*&visit the
site<a&*));
rea(;
)
return $output
)
FFF :o /hat's a!! this usiness /ith the \3signs and
the array's??
Oe!!' Qaor Eo2tsy (Qoa) raised a very good point'
he!p te$t /as
eing trans!ated t/o or more times and that c!uttered
the
!oca!e.trans!ation ta!es' then Hries Muytaert (Hries)
on!y strengthen
that point y mentioning that *t3/rapping*' t()'
propernames and
tit!es on!y /asted space' and 8 /anted to he!p ease the
trans!ators 2o
uy removing E;1= !in(s from the trans!ations so that
peop!e didn't have
to rememer IG=s+ Oith a!! this in mind anything that
/as a proper name'
a IG= 33 oth an e$terna! one and an interna! one'
interna! ones are !()
ca!!s' or ur!() ca!!s 33 8 rep!aced the te$t /ith \
something and at the
end of the he!p section 8 /ou!d p!ace a !ine !i(e this
one%
$output = t($output' array(*\something* =& ));
Drupal Handbook: 20 April 2005 703
Ohere is an !(t(*e$amp!e te$t*)' *e$amp!e.ur!*)
ca!!' or
an *<a href=U*http%..A$amp!e+ur!U*&e$amp!e te$t<.a&*
!oc(+
Dor an e$amp!e you can !oo( aove+
:o p!ease pu!! out that type of te$t in your !oc( of
he!p te$t+ 8f
you are doing a =C9Q !oc( of he!p te$t' see aove
e$amp!e for a
mu!ti!ine !oc(' trans!ate it on!y at the end of 'case'
!oc(' 2ust
efore the *rea(;*+ ;he nice thing aout this if you
are using the
same IG= again' and again you can use the same \
something again and
again and on!y p!ace a sing!e copy in your array area'
it /i!! tran!ate
a!! of them+
Creating modules0 4.H.I
"ntroduction
This tutorial describes ho2 to create a module for Drupal+
(:*
4i!e! Drupal version _ $!7!15! A module is a collection of
functions that link into Drupal, providin"
additional functionalit/ to /our Drupal installation! After
readin" this tutorial, /ou
2ill be able to create a basic block module and use it as a
template for
more advanced modules and node modules!
This tutorial 2ill not necessaril/ prepare /ou to 2rite
modules for
release into the 2ild! 9t does not cover cachin", nor does it
elaborate
on permissions or securit/ issues! 'se this tutorial as a
startin"
point, and revie2 other modules and the ZDrupal
handbook[ and Z(odin"
standards[ for more information!
This tutorial assumes the follo2in" about /ou:
-asic )H) kno2led"e, includin" s/nta and the
concept of )H) obFects
-asic understandin" of database tables, fields,
Drupal Handbook: 20 April 2005 710
records and *M0 statements
A 2orkin" Drupal installation
Drupal administration access
,ebserver access
This tutorial does not assume /ou have an/ kno2led"e
about the inner
2orkin"s of a Drupal module! This tutorial 2ill not help
/ou 2rite
modules for Drupal $!7!1 or before!
Getting tarted
To focus this tutorial, 2eDll start b/ creatin" a block
module that
lists links to content such as blo" entries or forum
discussions that
2ere created one 2eek a"o! The full tutorial 2ill teach us
ho2 to
create block content, 2rite links, and retrieve information
from Drupal
nodes!
*tart /our module b/ creatin" a )H) file and save it as
Donthisdate!moduleD!
<?php
?&
As per the Z(odin" standards[, use the lon"hand VEphp
ta",
and not VE to enclose /our )H) code!
All functions in /our module are named PmodulenameQN
PhookQ, 2here
GhookG is a 2ell defined function name! Drupal 2ill call
these
functions to "et specific data, so havin" these 2ell defined
names means
Drupal kno2s 2here to look!
Telling Drupal about your module
The first function 2eDll 2rite 2ill tell Drupal information
about /our
Drupal Handbook: 20 April 2005 711
module: its name and description! The hook name for this
function is
DhelpD, so start 2ith the onthisdateNhelp function:
<?php
function onthisdate_he!p($section) {
)
?&
The Wsection variable provides contet for the help: 2here
in Drupal or
the module are 2e lookin" for help! The recommended
2a/ to process this
variable is 2ith a s2itch statement! KouDll see this code
pattern in
other modules!
<?php
.F Bommented out unti! ug fi$ed F.
.F
function onthisdate_he!p($section) {
s/itch($section) {
case *admin.system.modu!es0name*%
$output = *onthisdate*;
rea(;
case *admin.system.modu!es0description*%
$output = *Hisp!ay a !ist of nodes that /ere
created a /ee( ago+*;
rea(;
defau!t%
$output = *onthisdate*;
rea(;
)
return $output;
)
F.
?&
Kou 2ill eventuall/ 2ant to add other cases to this s2itch
statement to
provide real help messa"es to the user! 9n particular,
output for
GadminJhelpkonthisdateG 2ill displa/ on the main help
pa"e accessed b/
the adminJhelp 'C0 for this module 4JadminJhelp or E
I`adminJhelp5!
Drupal Handbook: 20 April 2005 712
/ote:This function is commented out in the above code!
This is
on purpose, as the current version of Drupal (:* 2onDt
displa/ the
module name, and 2onDt enable it properl/ 2hen installed!
'ntil this
bu" is fied, comment out /our help function, or /our
module ma/ not
2ork!
Telling Drupal *ho can use your module
The net function to 2rite is the permissions function!
Here, /ou can
tell Drupal 2ho can access /our module! At this point, "ive
permission
to an/one 2ho can access site content or administrate the
module!
<?php
function onthisdate_perm() {
return array(*administer onthisdate*);
)
?&
9f /ou are "oin" to 2rite a module that needs to have finer
control over
the permissions, and /ouDre "oin" to do permission
control, /ou ma/ 2ant
to define a ne2 permission set! Kou can do this b/ addin"
strin"s to
the arra/ that is returned:
<?php
function onthisdate_perm() {
return array(*access onthisdate*' *administer
onthisdate*);
)
?&
KouDll need to adFust 2ho has permission to vie2 /our
module on the
administer h accounts h permissions pa"e! ,eDll use the
userNaccess
function to check access permissions later!
Drupal Handbook: 20 April 2005 717
-e sure /our permission strin"s must be uniIue to /our
module! 9f the/
are not, the permissions pa"e 2ill list the same permission
multiple
times!
Announce *e:re ha/e block content
There are several t/pes of modules: block modules and
node modules are
t2o! -lock modules create abbreviated content that is
t/picall/ 4but
not al2a/s, and not reIuired to be5 displa/ed alon" the left
or ri"ht
side of a pa"e! ;ode modules "enerate full pa"e content
4such as blo",
forum, or book pa"es5!
,eDll create a block content to start, and later discuss
node content!
A module can "enerate content for blocks and also for a
full pa"e 4the
blo"s module is a "ood eample of this5! The hook for a
block module is
appropriatel/ called GblockG, so letDs start our net
function:
<?php
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
)
?&
The block function takes t2o parameters: the operation
and the offset,
or delta! ,eDll Fust 2orr/ about the operation at this point!
9n
particular, 2e care about the specific case 2here the block
is bein"
listed in the blocks pa"e! 9n all other situations, 2eDll
displa/ the
block content!
<?php
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
.. !isting of !oc(s' such as on the
Drupal Handbook: 20 April 2005 71$
admin.system.!oc( page
if ($op == *!ist*) {
$!oc([?"[*info*" = t(*Cn ;his Hate*);
return $!oc(;
) e!se {
.. our !oc( content
)
)
?&
Generate content for a block
;o2, 2e need to "enerate the DonthisdateD content for the
block! 9n
here, 2eDll demonstrate a basic 2a/ to access the
database!
.ur "oal is to "et a list of content 4stored as GnodesG in the
database5
created a 2eek a"o! *pecificall/, 2e 2ant the content
created bet2een
midni"ht and 11:53pm on the da/ one 2eek a"o! ,hen a
node is first
created, the time of creation is stored in the database!
,eDll use this
database field to find our data!
6irst, 2e need to calculate the time 4in seconds since
epoch start, see
http:JJ222!php!netJmanualJenJfunction!time!php for more
information on
time format5 for midni"ht a 2eek a"o, and 11:53pm a
2eek a"o! This part
of the code is Drupal independent, see the )H) 2ebsite
4http:JJphp!netJ5
for more details!
<?php
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
.. !isting of !oc(s' such as on the
admin.system.!oc( page
if ($op == *!ist*) {
$!oc([?"[*info*" = t(*Cn ;his Hate*);
return $!oc(;
) e!se {
.. our !oc( content
Drupal Handbook: 20 April 2005 715
.. Qet today's date
$today = getdate();
.. ca!cu!ate midnight one /ee( ago
$start_time = m(time(?' ?' ?'
$today['mon'"' ($today
['mday'" 3 X)' $today['year'");
.. /e /ant items that occur on!y on the day in
7uestion' so ca!cu!ate 1 day
$end_time = $start_time W >-5??; .. -? F -? F
,5 = >-5?? seconds in a day
+++
)
)
?&
The net step is the *M0 statement that 2ill retrieve the
content 2eDd
like to displa/ from the database! ,eDre selectin" content
from the
node table, 2hich is the central table for Drupal content!
,eDll "et
all sorts of content t/pe 2ith this Iuer/: blo" entries,
forum posts,
etc! 6or this tutorial, this is oka/! 6or a real module, /ou
2ould
adFust the *M0 statement to select specific t/pes of
content 4b/ addin"
the Dt/peD column and a ,HHCH clause checkin" the Dt/peD
column5!
/ote: the table name is enclosed in curl/ braces: {node)!
This is necessar/ so that /our module 2ill support
database table name
prefies! Kou can find more information on the Drupal
2ebsite b/
readin" the ZTable )refi 4and sharin" tables across
instances5[ pa"e in
the Drupal handbook!
<?php
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time + *'*;
?&
Drupal Handbook: 20 April 2005 71%
Drupal uses database helper functions to perform
database Iueries! This
means that, for the most part, /ou can 2rite /our database
*M0 statement
and not 2orr/ about the backend connections!
,eDll use dbNIuer/45 to "et the records 4i!e! the database
ro2s5 that
match our *M0 Iuer/, and dbNfetchNobFect45 to look at the
individual
records:
<?php
.. get the !in(s
$7ueryGesu!t = d_7uery($7uery);
.. content varia!e that /i!! e returned for
disp!ay
$!oc(_content = '';
/hi!e ($!in(s = d_fetch_o2ect($7ueryGesu!t)) {
$!oc(_content += '<a href=*' + ur!
('node.vie/.' + $!in(s3&nid ) + '*&' +
$!in(s3&tit!e + '<.a&<r .
&';
)
.. chec( to see if there /as any content efore
setting up the !oc(
if ($!oc(_content == '') {
.F 9o content from a /ee( ago+ 8f /e return
nothing' the !oc(
F doesn't sho/' /hich is /hat /e /ant+ F.
return;
)
.. set up the !oc(
$!oc(['su2ect'" = 'Cn ;his Hate';
$!oc(['content'" = $!oc(_content;
return $!oc(;
)
?&
;otice the actual 'C0 is enclosed in the url45 function!
This adFusts
the 'C0 to the installations 'C0 confi"uration of either
clean 'C0*:
http:JJsitenameJnodeJvie2J2 or
http:JJsitenameJEI`nodeJvie2J2
Also, 2e return an arra/ that has DsubFectD and DcontentD
Drupal Handbook: 20 April 2005 71?
elements!
This is 2hat Drupal epects from a block function! 9f /ou
do not
include both of these, the block 2ill not render properl/!
Kou ma/ also notice the bad codin" practice of combinin"
content 2ith
la/out! 9f /ou are 2ritin" a module for others to use, /ou
2ill 2ant to
provide an eas/ 2a/ for others 4in particular, non+
pro"rammers5 to
adFust the contentDs la/out! An eas/ 2a/ to do this is to
include a
class attribute in /our link, and not necessaril/ include the
Vbr
J_ at the end of the link! 0etDs i"nore this for no2, but be
a2are
of this issue 2hen 2ritin" modules that others 2ill use!
)uttin" it all to"ether, our block function looks like this:
<?php
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
.. !isting of !oc(s' such as on the
admin.system.!oc( page
if ($op == *!ist*) {
$!oc([?"[*info*" = t(*Cn ;his Hate*);
return $!oc(;
) e!se {
.. our !oc( content
.. content varia!e that /i!! e returned for
disp!ay
$!oc(_content = '';
.. Qet today's date
$today = getdate();
.. ca!cu!ate midnight one /ee( ago
$start_time = m(time(?' ?' ?'
$today['mon'"' ($today
['mday'" 3 X)' $today['year'");
.. /e /ant items that occur on!y on the day in
7uestion' so ca!cu!ate 1 day
$end_time = $start_time W >-5??; .. -? F -? F
,5 = >-5?? seconds in a day
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time +
Drupal Handbook: 20 April 2005 71&
*'*;
.. get the !in(s
$7ueryGesu!t = d_7uery($7uery);
/hi!e ($!in(s = d_fetch_o2ect($7ueryGesu!t))
{
$!oc(_content += '<a href=*'+ur!
('node.vie/.'+$!in(s3&nid)+'*&'+
$!in(s3&tit!e + '<.a&<r .
&';
)
.. chec( to see if there /as any content
efore setting up the !oc(
if ($!oc(_content == '') {
.. no content from a /ee( ago' return
nothing+
return;
)
.. set up the !oc(
$!oc(['su2ect'" = 'Cn ;his Hate';
$!oc(['content'" = $!oc(_content;
return $!oc(;
)
)
?&
"nstalling+ enabling and testing the
module
At this point, /ou can install /our module and itDll 2ork!
0etDs do
that, and see 2here 2e need to improve the module!
To install the module, /ouDll need to cop/ /our
onthisdate!module file
to the modules director/ of /our Drupal installation! The
file must be
installed in this director/ or a subdirector/ of the modules
director/,
and must have the !module name etension!
0o" in as /our site administrator, and navi"ate to the
modules
administration pa"e to "et an alphabetical list of modules!
9n the
menus: administer h confi"uration h modules, or via 'C0:
Drupal Handbook: 20 April 2005 713
http%..+++.admin.system.modu!es or
http%..+++.?7=admin.system.modu!es
/ote: KouDll see one of three thin"s for the DonthisdateD
module at this point:
KouDll see the DonthisdateD module name and no
description
KouDll see no module name, but the DonthisdateD
description
KouDll see both the module name and the description
,hich of these three choices /ou see is dependent on the
state of the
(:* tree, /our installation and the help function in /our
module! 9f
/ou have a description and no module name, and this
bothers /ou, comment
out the help function for the moment! KouDll then have the
module name,
but no description! 6or this tutorial, either is oka/, as /ou
2ill Fust
enable the module, and 2onDt use the help s/stem!
Hnable the module b/ selectin" the checkbo and save
/our confi"uration!
-ecause the module is a blocks module, 2eDll need to also
enable it in
the blocks administration menu and specif/ a location for
it to displa/!
;avi"ate to the blocks administration pa"e:
adminJs/stemJblock or
administer h confi"uration h blocks in the menus!
Hnable the module b/ selectin" the enabled checkbo for
the D.n This
DateD block and save /our blocks! -e sure to adFust the
location
4leftJri"ht5 if /ou are usin" a theme that limits 2here
blocks are
displa/ed!
;o2, head to another pa"e, sa/ select the module! 9n some
themes, the
blocks are displa/ed after the pa"e has rendered the
content, and /ou
Drupal Handbook: 20 April 2005 720
2onDt see the chan"e until /ou "o to ne2 pa"e!
9f /ou have content that 2as created a 2eek a"o, the block
2ill displa/
2ith links to the content! 9f /ou donDt have content, /ouDll
need to
fake some data! Kou can do this b/ creatin" a blo", forum
topic or book
pa"e, and adFust the GAuthored on:G date to be a 2eek a"o!
Alternatel/, if /our site has been around for a 2hile, /ou
ma/ have a
lot of content created on the da/ one 2eek a"o, and /ouDll
see a lar"e
number of links in the block!
Create a module configuration 1settings2
page
;o2 that 2e have a 2orkin" module, 2eDd like to make it
better! 9f 2e
have a site that has been around for a 2hile, content from
a 2eek a"o
mi"ht not be as interestin" as content from a /ear a"o!
*imilarl/, if
2e have a bus/ site, 2e mi"ht not 2ant to displa/ all the
links to
content created last 2eek! *o, letDs create a confi"uration
pa"e for
the administrator to adFust this information!
The confi"uration pa"e uses the Dsettin"sD hook! ,e 2ould
like onl/
administrators to be able to access this pa"e, so 2eDll do
our first
permissions check of the module here:
<?php
function onthisdate_settings() {
.. on!y administrators can access this modu!e
if (Zuser_access(*admin onthisdate*)) {
return message_access();
)
)
Drupal Handbook: 20 April 2005 721
?&
9f /ou 2ant to tie /our modules permissions to the
permissions of
another module, /ou can use that moduleDs permission
strin"! The
Gaccess contentG permission is a "ood one to check if the
user can vie2
the content on /our site:
<?php
+++
.. chec( the user has content access
if (Zuser_access(*access content*)) {
return message_access();
)
+++
?&
,eDd like to confi"ure ho2 man/ links displa/ in the block,
so 2eDll
create a form for the administrator to set the number of
links:
<?php
function onthisdate_settings() {
.. on!y administrators can access this modu!e
if (Zuser_access(*admin onthisdate*)) {
return message_access();
)
$output += form_te$tfie!d(t(*1a$imum numer of
!in(s*)' *onthisdate_ma$disp*'
varia!e_get(*onthisdate_ma$disp*'
*@*)' ,' ,'
t(*;he ma$imum numer of !in(s to
disp!ay in the !oc(+*));
return $output;
)
?&
This function uses several po2erful Drupal form handlin"
features! ,e
donDt need to 2orr/ about creatin" an HT<0 tet field or
the form, as
Drupal 2ill do so for us! ,e use varia!e_get to retrieve
the value of the s/stem confi"uration variable
Drupal Handbook: 20 April 2005 722
GonthisdateNmadispG,
2hich has a default value of 7! ,e use the formNtetfield
function to
create the form and a tet bo of si=e 2, acceptin" a
maimum len"th of
2 characters! ,e also use the translate function of t45!
There are
other form functions that 2ill automaticall/ create the
HT<0 form
elements for use! 6or no2, 2eDll Fust use the formNtetfield
function!
.f course, 2eDll need to use the confi"uration value in our
*M0 *H0H(T,
so 2eDll need to adFust our Iuer/ statement in the
onthisdateNblock
function:
<?php
$!imitnum = varia!e_get(*onthisdate_ma$disp*'
@);
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time + *'
=818; * + $!imitnum;
?&
Kou can test the settin"s pa"e b/ editin" the number of
links displa/ed
and noticin" the block content adFusts accordin"l/!
;avi"ate to the settin"s pa"e:
adminJs/stemJmodulesJonthisdate or
administer h confi"uration h modules h onthisdate! AdFust
the number
of links and save the confi"uration! ;otice the number of
links in the
block adFusts accordin"l/!
/ote:,e donDt have an/ validation 2ith this input! 9f /ou
enter
GcG in the maimum number of links, /ouDll break the
block!
Drupal Handbook: 20 April 2005 727
Adding menu links and creating page
content
*o far 2e have our 2orkin" block and a settin"s pa"e! The
block
displa/s a maimum number of links! Ho2ever, there ma/
be more links
than the maimum 2e sho2! *o, letDs create a pa"e that
lists all the
content that 2as created a 2eek a"o!
<?php
function onthisdate_a!!() {
)
?&
,eDre "oin" to use much of the code from the block
function! ,eDll
2rite this Htreme)ro"rammin" st/le, and duplicate the
code! 9f 2e need
to use it in a third place, 2eDll refactor it into a separate
function!
6or no2, cop/ the code to the ne2 function onthisdateNall
45! (ontrar/
to all our other functions, DallD, in this case, is not a Drupal
hook!
,eDll discuss belo2!
<?php
function onthisdate_a!!() {
.. content varia!e that /i!! e returned for
disp!ay
$page_content = '';
.. Qet today's date
$today = getdate();
.. ca!cu!ate midnight one /ee( ago
$start_time = m(time(?' ?' ?'
$today['mon'"' ($today
['mday'" 3 X)' $today['year'");
.. /e /ant items that occur on!y on the day in
7uestion' so ca!cu!ate 1 day
$end_time = $start_time W >-5??; .. -? F -? F
,5 = >-5?? seconds in a day
.. 9C;AZ 9o =818; c!ause hereZ Oe /ant to sho/
a!! the code
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
Drupal Handbook: 20 April 2005 72$
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time + *'*;
.. get the !in(s
$7ueryGesu!t = d_7uery($7uery);
/hi!e ($!in(s = d_fetch_o2ect($7ueryGesu!t)) {
$page_content += '<a href=*'+ur!
('node.vie/.'+$!in(s3&nid)+'*&'+
$!in(s3&tit!e + '<.a&<r .
&';
)
+++
)
?&
,e have the pa"e content at this point, but 2e 2ant to do
a little more
2ith it than Fust return it! ,hen creatin" pa"es, 2e need
to send the
pa"e content to the theme for proper renderin"! ,e use
this 2ith the
theme45 function! Themes control the look of a site! As
noted above,
2eDre includin" la/out in the code! This is bad, and should
be
avoided! 9t is, ho2ever, the topic of another tutorial, so for
no2,
2eDll include the formattin" in our content:
<?php
print theme(*page*' $content_string);
?&
The rest of our function checks to see if there is content
and lets the
user kno2! This is preferable to sho2in" an empt/ or
blank pa"e, 2hich
ma/ confuse the user!
;ote that 2e are responsible for outputtin" the pa"e
content 2ith the
Dprint theme45D s/nta! This is a chan"e from previous $!7!
themes!
<?php
function onthisdate_a!!() {
Drupal Handbook: 20 April 2005 725
+++
.. chec( to see if there /as any content efore
setting up the !oc(
if ($page_content == '') {
.. no content from a /ee( ago' !et the user
(no/
print theme(*page*'
*9o events occurred on this site
on this date in history+*);
return;
)
print theme(*page*' $page_content);
)
?&
,etting Drupal kno* about the ne*
function
As mentioned above, the function 2e Fust 2rote isnDt a
DhookD: itDs not
a Drupal reco"ni=ed name! ,e need to tell Drupal ho2 to
access the
function 2hen displa/in" a pa"e! ,e do this 2ith the Nlink
hook and
the menu45 function:
<?php
function onthisdate_!in(($type' $node=?) {
)
?&
There are man/ different t/pes, but 2eDre "oin" to use
onl/ Ds/stemD in
this tutorial!
<?php
function onthisdate_!in(($type' $node=?) {
if (($type == *system*)) {
.. IG=' page tit!e' func ca!!ed for page
content' arg' 1 = don't disp menu
menu(*onthisdate*' t(*Cn ;his Hate*)'
*onthisdate_a!!*' 1' 1);
)
)
?&
Drupal Handbook: 20 April 2005 72%
-asicall/, 2eDre sa/in" if the user "oes to GonthisdateG
4either via
EI`onthisdate or http:JJ!!!Jonthisdate5, the content
"enerated b/
onthisdateNall 2ill be displa/ed! The title of the pa"e 2ill
be G.n
This DateG! The final G1G in the ar"uments tells Drupal to
not displa/
the link in the userDs menu! <ake this G0G if /ou 2ant the
user to see
the link in the side navi"ation block!
;avi"ate to Jonthisdate 4or EI`onthisdate5 and see 2hat
/ou "et!
Adding a more link and sho*ing all
entries
-ecause 2e have our function that creates a pa"e 2ith all
the content
created a 2eek a"o, 2e can link to it from the block 2ith a
GmoreG link!
Add these lines Fust before that WblockZDsubFectD[ line,
addin" this to
the WblockNcontent variable before savin" it to the Wblock
ZDcontentD[
variable:
<?php
.. add a more !in( to our page that disp!ays a!!
the !in(s
$!oc(_content += *<div c!ass=U*more3!in(U*&*+
!(t(*more*)' *onthisdate*' array(*tit!e* =& t
(*1ore events on this day+*))) +*<.div&*;
?&
This 2ill add the more link!
And *e:re doneE
,e no2 have a 2orkin" module! 9t created a block and a
pa"e! Kou
should no2 have enou"h to "et started 2ritin" /our o2n
modules! ,e
Drupal Handbook: 20 April 2005 72?
recommend /ou start 2ith a block module of /our o2n and
move onto a node
module! Alternatel/, /ou can 2rite a filter or theme!
3urther notes
As is, this tutorialDs module isnDt ver/ useful! Ho2ever,
2ith a fe2
enhancements, it can be entertainin"! Tr/ modif/in" the
select Iuer/
statement to select onl/ nodes of t/pe Dblo"D and see 2hat
/ou "et!
Alternatel/, /ou could "et onl/ a particular userDs content
for a
specific 2eek! 9nstead of usin" the block function, consider
epandin"
the menu and pa"e functions, addin" menus to specific
entries or dates,
or usin" the menu callback ar"uments to adFust 2hat /ear
/ou look at the
content from!
9f /ou start 2ritin" modules for others to use, /ouDll 2ant
to provide
more details in /our code! (omments in the code are
incredibl/ valuable
for other developers and users in understandin" 2hatDs
"oin" on in /our
module! KouDll also 2ant to epand the help function,
providin" better
help for the user! 6ollo2 the Drupal Z(odin" standards[,
especiall/ if
/ouDre "oin" to add /our module to the proFect!
T2o topics ver/ important in module development are
2ritin" themeable
pa"es and 2ritin" translatable content! )lease check the
ZDrupal
Handbook[ for more details on these t2o subFect!
Con/erting 4.H modules to 4.4
*ince Drupal $!7, maFor chan"es have been made to the
theme, menu, and node s/stems! <ost themes and
Drupal Handbook: 20 April 2005 72&
modules 2ill reIuire some chan"es!
8enu system
The Drupal menu s/stem has been etended to drive all
pa"es, not Fust administrative pa"es! This is continuin" the
2ork done for Drupal $!7, 2hich inte"rated the
administrative menu 2ith the user menu! ,e no2 have
consistenc/ bet2een administrative and GnormalG pa"esR
2hen /ou learn to create one, /ou kno2 ho2 to create the
other!
The flo2 of pa"e "eneration no2 proceeds as follo2s:
The _!in( hook in all modules is called, so that
modules can use menu() to add items to the menu!
6or eample, a module could define:
<?php
function e$amp!e_!in(($type) {
if ($type == *system*) {
menu(*e$amp!e*' t(*e$amp!e*)'
*e$amp!e_page*);
menu(*e$amp!e.foo*' t(*foo*)'
*e$amp!e_foo*);
)
)
?&
The menu s/stem eamines the current 'C0, and
finds the Gbest fitG for the 'C0 in the menu! 6or
eample, if the current 'C0 is e$amp!e.foo.ar.1,,
the above menu() calls 2ould cause e$amp!e_foo
(*ar*' 1,) to "et invoked!
The callback ma/ set the title or breadcrumb trail if
the defaults are not satisfactor/ 4more on this later5!
The callback is responsible for printin" the
reIuested pa"e! This 2ill usuall/ involve preparin"
the content, and then printin" the return value of
theme(*page*)! 6or eample:
<?php
function e$amp!e_foo($the:tring' $the9umer)
{
$output = $the:tring+ * 3 * +$the9umer;
print theme(*page*' $output);
)
Drupal Handbook: 20 April 2005 723
?&
The follo2in" points should be considered 2hen up"radin"
modules to use the ne2 menu s/stem:
The _page hook is obsolete! )a"es 2ill not be sho2n
unless the/ are declared 2ith a menu() call as
discussed above! To convert former _page hooks to
the ne2 s/stem as simpl/ as possible, Fust declare
that function as a GcatchallG callback:
<?php
menu(*e$amp!e*' t(*e$amp!e*)'
*e$amp!e_page*' ?' 1A9I_E8HA);
?&
The trailin" <H;'NH9DH ar"ument in this call
makes the menu item hidden, so the callback
functions but the module does not clutter the user
menu!
.ld administrative callbacks returned their content!
9n the ne2 s/stem, administrative and normal
callbacks alike are responsible for printin" the entire
pa"e!
The title of the pa"e is printed b/ the theme s/stem,
so pa"e content does not need to be 2rapped in a
theme(*o$*) to "et a title printed! 9f the default
title is not satisfactor/, it can be chan"ed b/ callin"
drupa!_set_tit!e($tit!e) before theme(*page*)
"ets called, or b/ passin" the title to theme(*page*)
as a parameter!
The breadcrumb trail is also printed b/ the theme! 9f
the default one needs to be overridden 4to present
thin"s like forum hierarchies5, this can be done b/
callin" drupa!_set_readcrum($readcrum)
before theme(*page*) "ets called, or b/ passin" the
breadcrumb to theme(*page*) as a parameter!
$readcrum should be a list of links be"innin" 2ith
GHomeG and proceedin" up to, but not includin", the
current pa"e!
Theme system
6or full information on theme s/stem chan"es, see
convertin" $!7 themes to (:*! The follo2in" points are
Drupal Handbook: 20 April 2005 770
directl/ relevant to module development:
All theme functions no2 return their output instead
of printin" them to the user! .ld theme() usa"e:
<?php
theme(*o$*' $tit!e' $output);
?&
;e2 usa"e:
<?php
print theme(*o$*' $tit!e' $output);
?&
<odules that define their o2n theme functions
should also return their output!
The namin" of theme functions defined b/ modules
has been standardi=ed to
theme_#!t;modu!e#gt;_#!t;name#gt;! ,hen usin"
a theme function there is no need to include the
themeN part, as theme() 2ill do this automaticall/!
Hample:
<?php
function theme_e$amp!e_!ist($!ist) {
return imp!ode('<r .&'' $!ist);
)
print theme('e$amp!e_!ist'' array(1','@));
?&
Theme functions must al2a/s be called usin" theme
() to allo2 for the active theme to modif/ the output
if necessar/!
The theme(*header*) and theme(*footer*)
functions are not available an/more! <odule
developers should use the theme(*page*) function
2hich 2raps the content in the site theme! The full
s/nta of this function is
<?php
theme(*page*' $output' $tit!e' $readcrum);
?&
2here $tit!e and $readcrum 2ill override an/
Drupal Handbook: 20 April 2005 771
values set before for these properties!
7ode system
The node s/stem has been up"raded to allo2 a sin"le
module to define more than one t/pe of node! This 2ill
allo2 some of the more convoluted code in, for eample,
proFect!module to be tidied up!
The _node() hook has been deprecated! 9n its place,
modules that define nodes should use _node_name()
and _he!p()!
The _node_name() function should return a
translated strin" containin" the human+readable
name of the node t/pe!
The _he!p() function, 2hen called 2ith parameter
*node.add0modu!ename*, should return a translated
strin" containin" the description of the node t/pe!
<odules 2ishin" to use the ne2 abilit/ to define
multiple node t/pes should see the Do/"en
documentation for hoo(_node_name() and
hoo(_node_types()!
3ilter system
The various filter hooks 4DfilterD, DconfNfiltersD5 have
been mer"ed into one DfilterD hook! A module that
provides filterin" functionalit/ should implement:
<?php
function e$amp!e_fi!ter($op' $te$t = **) {
s/itch ($op) {
case *name*%
return t(*9ame of the fi!ter*);
case *prepare*%
.. Ho preparing on $te$t
return $te$t;
case *process*%
.. Ho processing on $te$t
return $te$t;
case *settings*%
.. Qenerate $output of settings
return $output;
)
)
Drupal Handbook: 20 April 2005 772
?&
GnameG is ne2, and should return a friendl/
name for the filter!
GprepareG is also ne2! This is an etra step that
is performed before the default HT<0
processin", if HT<0 ta"s are allo2ed! 9t is
meant to "ive filters the chance to escape
HT<0+like data before it can "et stripped! This
means, to convert meanin"ful HT<0
characters like V and _ into entities such as
^ltR and ^"tR!
(ommon eamples include filterin" pieces of
)H) code, mathematical formulas, etc! 9t is not
allo2ed to do an/thin" other than escapin" in
the GprepareG step!
9f /our filter currentl/ performs such a step in
the main GprocessG step, it should be moved
into GprepareG instead! 9f /ou donDt need an/
escapin", /our filter should simpl/ return Wtet
2ithout processin" in this case!
GprocessG is the eIuivalent of the old GfilterG
hook! ;ormal filterin" is performed here, and
the chan"ed Wtet is returned!
Gsettin"sG is the eIuivalent of the old
GconfNfiltersG hook! 9f /our filter provides
confi"urable options, /ou should return them
here 4usin" the standard formNO functions5!
The filter handlin" code has been moved to a ne2
reIuired fi!ter+modu!e, and thus most of the filter
function names chan"ed, althou"h none of those
should have been called from modules! The
chec(_output() function is still available 2ith the
same functionalit/!
;ode filterin" is optimi=ed 2ith the node_prepare()
function no2, 2hich onl/ runs the bod/ throu"h the
filters if the node vie2 pa"e is displa/ed! .ther2ise,
onl/ the teaser is filtered!
The _compose_tips hook 4defined b/ the contrib
compose_tips+modu!e5 is not supported an/more,
but more advanced functionalit/ eists in the core!
Kou can emit etensive compose tips related to the
filter /ou define via the _he!p hook 2ith the
Drupal Handbook: 20 April 2005 777
'fi!ter0!ong3tip' section identifier! The
compose_tips 'C0 is thus chan"ed to fi!ter.tips!
The form_a!!o/ed_tags_te$t() function is replaced
2ith fi!ter_tips_short(), 2hich no2 supports
short tips to be placed under tetareas! An/ module
can inFect short tips about the filter defined via the
_he!p hook, 2ith the 'fi!ter0short3tip' section
identifier!
4ook changes
.ther than those mentioned above, the follo2in" hooks
have chan"ed:
The _vie/ hook has been chan"ed to return its
content rather than printin" it! 9t also has an etra
parameter, $page, that indicates 2hether the node is
bein" vie2ed as a standalone pa"e or as part of a
lar"er contet! This is important because nodes ma/
chan"e the breadcrumb trail if the/ are bein" vie2ed
as a pa"e! .ld usa"e:
<?php
function e$amp!e_vie/($node' $main = ?) {
if ($main) {
theme(*node*' $node' $main);
)
e!se {
$readcrum[" = !(t(*Eome*)' **);
$readcrum[" = !(t(*foo*)' *foo*);
$node3&ody = theme(*readcrum*'
$readcrum) +*<r .&*+ $node3&ody;
theme(*node*' $node' $main);
)
)
?&
;e2 usa"e:
<?php
function e$amp!e_vie/($node' $main = ?' $page
= ?) {
if ($main) {
return theme(*node*' $node' $main'
$page);
)
e!se {
Drupal Handbook: 20 April 2005 77$
if ($page) {
$readcrum[" = !(t(*Eome*)' **);
$readcrum[" = !(t(*foo*)' *foo*);
drupa!_set_readcrum($readcrum);
)
return theme(*node*' $node' $main'
$page);
)
)
?&
The _form hook used b/ node modules does no
lon"er take 7 ar"uments! The second ar"ument
$he!p, t/picall/ used to print submission "uidelines,
has been removed! 9nstead, the help should be
emitted usin" the moduleDs _he!p hook! 6or
eamples, check the stor/, forum or blo" module!
The _search hook 2as chan"ed to not onl/ return
the result set arra/, but a t2o element arra/ 2ith the
result "roup title and the result set arra/! This
provides more precise control over result "roup
titles!
The _head hook is eliminated and replaced 2ith the
drupa!_set_htm!_head() and
drupa!_get_htm!_head() functions! Kou can add
1ava*cript code or (** to the HT<0 head part 2ith
the drupa!_set_htm!_head() function instead!
*ee also the description of the _compose_tips hook
chan"es belo2!
Cmitting links
The functions ur!() and !() take a ne2 $fragment
parameter! (alls to ur!() or !() that have DkD in the
$ur! parameter need to be updated! 9f /ou donDt
update such calls, DrupalDs path aliasin" 2onDt 2ork
for 'C0s 2ith k in them!
Drupal no2 emits relative 'C0* instead of absolute
'C0s! (ontributed modules must be updated
2henere an absolute url is reIuired! 6or eample:
An/ module that outputs an C** feed 2ithout
usin" node_feed() should be updated! ;ote:
this is discoura"ed! please use node_feed()
instead! Also modules usin" node_feed()
Drupal Handbook: 20 April 2005 775
should provide an absolute link in the DlinkD
ke/, if an/!
An/ module 2hich send email should be
updated so that links in the email have
absolute urls instead of relative urls! Kou do
this usin" a parameter in /our call to !() or
ur!()
tatus and error messages
<odules that use theme('error'' +++) to print
error messa"es should be updated to use
drupa!_set_message(+++' 'error') unless used to
print an error messa"e belo2 a form item!
<?php
drupa!_set_message(t('fai!ed to update L''
'error')); .. set the second parameter to
'error'
?&
<odules that print status messa"es directl/ to the
screen usin" status() should be updated to use
drupa!_set_message()! The status() function has
been removed!
<?php
drupa!_set_message(t('updated L'));
?&
Con/erting 4.4 modules to 4.K
8enu system
The Drupal menu s/stem "ot a complete re2rite! The ne2
features include:
The administrator ma/ no2 customi=e the menu to
reorder, remove, and add items!
<enu items ma/ be classified as Glocal tasks,G 2hich
2ill b/ default be displa/ed as tabs on the pa"e
content!
The menu A)9 is much more consistent 2ith the rest
of DrupalDs A)9!
The menu45 function is no more! 9n its place, 2e have
Drupal Handbook: 20 April 2005 77%
hookNmenu45! The old hookNlink45 remains, but 2ill no
lon"er be called 2ith the Gs/stemG ar"ument! The hook
reference in the Do/"en documentation details all the
specifics of this ne2 hook! 9n short, rather than makin"
man/ calls to menu45 in /our hookNlink45 implementation,
/ou 2ill implement hookNmenu45 to return an arra/ of the
menu items /ou define!
As an eample, the old pattern:
<?php
function !og_!in(($type' $node = ?' $main) {
g!oa! $user;
if ($type == 'system') {
menu('node.add.!og'' t('!og entry')'
user_access('maintain persona! !og') ?
1A9I_D<==;EGCIQE % 1A9I_HA98AH' ?);
menu('!og'' t('!ogs')' user_access('access
content') ? '!og_page' % 1A9I_HA98AH' ?'
1A9I_E8HA);
menu('!og.'+ $user3&uid' t('my !og')'
1A9I_D<==;EGCIQE' 1' 1A9I_:ECO' 1A9I_=CBTAH);
menu('!og.feed'' t('G:: feed')' user_access
('access content') ? '!og_feed' % 1A9I_HA98AH' ?'
1A9I_E8HA' 1A9I_=CBTAH);
)
)
?&
becomes:
<?php
function !og_menu($may_cache) {
g!oa! $user;
$items = array();
if ($may_cache) {
$items[" = array('path' =& 'node.add.!og''
'tit!e' =& t('!og entry')'
'access' =& user_access('maintain persona!
!og'));
$items[" = array('path' =& '!og'' 'tit!e' =&
t('!ogs')'
'ca!!ac(' =& '!og_page''
'access' =& user_access('access content')'
'type' =& 1A9I_:IQQA:;AH_8;A1);
$items[" = array('path' =& '!og.'+ $user3
&uid' 'tit!e' =& t('my !og')'
'access' =& user_access('maintain persona!
Drupal Handbook: 20 April 2005 77?
!og')'
'type' =& 1A9I_HP9<18B_8;A1);
$items[" = array('path' =& '!og.feed''
'tit!e' =& t('G:: feed')'
'ca!!ac(' =& '!og_feed''
'access' =& user_access('access content')'
'type' =& 1A9I_B<==M<BT);
)
return $items;
)
?&
Drupal no2 distin"uishes bet2een $0$ 4;ot 6ound5 pa"es
and $07 46orbidden5 pa"es! To accommodate this,
modules should abandon the practice of not declarin"
menu items 2hen access is denied to them! 9nstead, the/
should set the GaccessG attribute of their ne2l/+declared
menu item to 6A0*H! This 2ill have the effect of the menu
item bein" hidden, and also preventin" the callback from
bein" invoked b/ t/pin" in the 'C0! <odules ma/ also
2ant to take advanta"e of the drupalNaccessNdenied45
function, 2hich prints a $07 pa"e 4the analo"ue of
drupalNnotNfound45, 2hich prints a $0$5!
Path changes
*ome internal 'C0 paths have chan"edR check the links
printed b/ /our code! <ost si"nificant is that paths of the
form GnodeJvie2J52G are no2 GnodeJ52G instead, 2hile
GnodeJeditJ52G becomes GnodeJ52JeditG!
7ode changes
The database field static has been renamed to
stic(y!
Hrror handlin" of forms 4such as node editin" forms5
is no2 done usin" formNsetNerror45! 9t simplifies the
forms and validation codeR ho2ever, it does chan"e
the node A)9 sli"htl/:
The Nvalidate hook and the Nnodeapi4DvalidateD5
hook of the node A)9 no lon"er take an GerrorG
parameter, and should no lon"er return an
error arra/! To set an error, call formNsetNerror
45!
Drupal Handbook: 20 April 2005 77&
;ode modulesD hookNform45 implementations
no lon"er take an GerrorG parameterG and
should not 2orr/ about displa/in" errors! The
same applies to hookNnodeapi4DformNpostD5 and
hookNnodeapi4DformNpreD5!
All of the formN famil/ of functions can take a
parameter that marks the field as reIuired in a
standard 2a/! 'se this instead of addin" that
information to the field description!
9n order to allo2 modules such as book!module to
inFect HT<0 elements into the vie2 of nodes safel/,
hookNnodeapi45 2as etended to respond to the
Dvie2D operation! This operation needs to be invoked
after the filterin" of the node, so hookNvie245 2as
chan"ed sli"htl/ to no lon"er reIuire a return value!
9nstead of callin" theme4DnodeD, Wnode5 and
returnin" the result as before, the hook can Fust
modif/ Wnode as it sees fit 4includin" runnin" Wnode+
_bod/ and Wnode+_teaser throu"h the filters, as
before5, and the callin" code 2ill take care of
sendin" the result to the theme! <ost modules 2ill
Fust 2ork under the ne2 semantics, as the return
value from the hook is Fust discarded, but the Wnode
parameter is no2 reIuired to be passed b/ reference
4this 2as common but optional before5!
,e have node+level access control no2L This means
that node modules need to make ver/ small chan"es
to their hookNaccess45 implementations! The check
for Wnode+_status should be removedR the node
module takes care of this check! A value should onl/
be returned from this hook if the node module needs
to override 2hatever access is "ranted b/ the
nodeNaccess table! *ee the hook A)9 for details!
;ode listin" Iueries need to be chan"ed as 2ell, so
that the/ properl/ check for 2hether the user has
access to the node before listin" it! Mueries of the
form
<?php
d_7uery(':A=AB; n+nid' n+tit!e DGC1 {node) n
OEAGA n+status = 1 <9H foo');
?&
Drupal Handbook: 20 April 2005 773
become
<?php
d_7uery(':A=AB; n+nid' n+tit!e DGC1 {node) n
'+ node_access_2oin_s7!() +' OEAGA n+status =
1 <9H '+ node_access_/here_s7!() +' <9H
foo');
?&
*ee node access ri"hts in the Do/"en reference!
3iltering changes
This change affects non-filter modules as wellH
1lease read on een if your module does not filter.
The filter s/stem 2as chan"ed to support multiple input
formats! Hach input format houses an entire filter
confi"uration: 2hich filters to use, in 2hat order and 2ith
2hat settin"s! The filter s/stem no2 supports multiple
filters per module as 2ell!
CheckFoutput12 changes
-ecause of the multiple input formats, a module 2hich
implements content has to take care of mana"in" the
format 2ith each item! 9f /our module uses the node
s/stem and passes content throu"h chec(_output(), then
/ou need to do t2o thin"s:
)ass Wnode+_format as the second parameter to
chec(_output() 2henever /ou use it!
Add a filter format selector to hoo(_form usin" a
snippet like:
<?php
$output += fi!ter_form('format'' $node3
&format);
?&
The node s/stem 2ill automaticall/ saveJload the format
value for /ou!
9f /our module provides content outside of the node
s/stem, /ou can decide if /ou 2ant to support multiple
input formats or not! 9f /ou donDt, the default format 2ill
al2a/s be used! Ho2ever, if /our module accepts input
throu"h the bro2ser, it is stron"l/ advised to support
Drupal Handbook: 20 April 2005 7$0
input formatsL
To do this, /ou must:
)rovide a selector for input formats on /our forms,
usin" filterNform45!
:alidate the chosen input format on submission,
usin" filterNaccess45!
*tore the format 9D 2ith each content item 4the
format 9D is a number5!
)ass the format 9D to checkNoutput45!
(heck the A)9 documentation for these functions for more
information on ho2 to use them!
3ilter hook
The Nfilter hook 2as chan"ed si"nificantl/! 9tDs best to
start 2ith the follo2in" frame2ork:
<?php
function hoo(_fi!ter($op' $de!ta = ?' $format =
31' $te$t = '') {
s/itch ($op) {
case '!ist'%
return array(? =& t('Di!ter name'));
case 'description'%
return t(*:hort description of the fi!ter's
actions+*);
.F
case 'no cache'%
return true;
F.
case 'prepare'%
$te$t = +++
return $te$t;
case 'process'%
$te$t = +++
return $te$t;
case 'settings'%
$output = +++;
return $output;
defau!t%
return $te$t;
)
)
?&
Drupal Handbook: 20 April 2005 7$1
,hen convertin" a module to $!5, /ou can normall/ i"nore
the Wdelta paramter: it is used to have multiple filters
inside one module! The DprepareD, DprocessD and Dsettin"sD
operations still 2ork the same as before, 2ith onl/ small
chan"es!
Ho2ever, /ou should no2 include the Wformat parameter
in the variable names for filter settin"s! 9f /our filter has a
settin" Gm/filterNsomethin"G, it should be chan"ed to
Gm/filterNsomethin"NWformatG! This allo2s the settin" to
be set separatel/ for each input format! To check if it
2orks correctl/, add /our filter to t2o different input
formats and "ive each instance different settin"s! :erif/
that each input format retains its o2n settin"s!
'nlike before, the Dsettin"sD operation should onl/ be used
to return actuall/ useful settin"s, because there is no2 a
separate overvie2 of all enabled filters! A filter does not
need its o2n onJoff to""le! 9f a filter has no confi"urable
settin"s, it should return nothin" for the settin"s, rather
than a messa"e like 2e did before!
6inall/, the filter s/stem no2 includes cachin"! 9f /our
filterDs output is d/namic and should not be cached,
uncomment the Dno cacheD snippet! .nl/ do this 2hen
absolutel/ necessar/, because this turns off cachin" for
an/ input format /our filter is used in! -e2are of the filter
cache 2hen developin" /our module: it is advised to
uncomment Dno cacheD 2hile developin", but be sure to
remove it a"ain if itDs not needed!
3ilter tips
6ilter tips are no2 output throu"h the format selector!
<odules no lon"er need to call filterNtipsNshort45 to displa/
them!
A moduleDs filter tips are returned throu"h the filterNtips
hook:
<?php
function hoo(_fi!ter_tips($de!ta' $format' $!ong =
fa!se) {
if ($!ong) {
return t(*=ong tip*);
)
e!se {
return t(*:hort tip*);
Drupal Handbook: 20 April 2005 7$2
)
)
?&
As in the filter hook /ou can i"nore the Wdelta parameter if
/ouDre up"radin" an eistin" module! 9f /our filterDs tips
depend on its settin"s, make sure /ou use Wformat to
retrieve the settin" for the current input format! Wlon"
tells /ou 2hether to return lon" or short tips!
'ther changes
9n addition to the above mentioned chan"es:
hookNuser45 2as chan"ed to allo2 multiple pa"es of
user profile information! The ne2 s/nta of the hook
is "iven in the A)9 reference! )a/ particular
attention to the Gcate"oriesG, GformG, and Gvie2G
operations!
,hen processin" a form submission, /ou should use
drupalN"oto45 to redirect to the result if the
submission 2as accepted! This prevents a double
post 2hen people refresh their bro2ser ri"ht after
submittin"! <essa"es set 2ith drupalNsetNmessa"e45
2ill be saved across the redirect! 9f a submission 2as
reFected, /ou should not use drupalN"oto45, but
simpl/ print out the form alon" 2ith error messa"es!
Creating 8odules for 4.K.L
"ntroduction
This tutorial describes ho2 to create a module for Drupal
$!5!O! 9t is an update to the $!71 tutorial! )lease see
comments there, also!
A module is a collection of functions that link into Drupal,
providin" additional functionalit/ to /our Drupal
installation! After readin" this tutorial, /ou 2ill be able to
create a basic block module and use it as a template for
more advanced modules and node modules!
This tutorial 2ill not necessaril/ prepare /ou to 2rite
modules for release into the 2ild! 9t does not cover
Drupal Handbook: 20 April 2005 7$7
cachin", nor does it elaborate on permissions or securit/
issues! 'se this tutorial as a startin" point, and revie2
other modules and the Drupal handbook and (odin"
standardsfor more information!
This tutorial assumes the follo2in" about /ou:
-asic )H) kno2led"e, includin" s/nta and the
concept of )H) obFects
-asic understandin" of database tables, fields,
records and *M0 statements
A 2orkin" Drupal installation
Drupal administration access
,ebserver access
This tutorial does not assume /ou have an/ kno2led"e
about the inner 2orkin"s of a Drupal module! This tutorial
2ill not help /ou 2rite modules for versions of Drupal
earlier than $!5!
Getting tarted
To focus this tutorial, 2eDll start b/ creatin" a block
module that lists links to content such as blo" entries or
forum discussions that 2ere created one 2eek a"o! The
full tutorial 2ill teach us ho2 to create block content,
2rite links, and retrieve information from Drupal nodes!
*tart /our module b/ creatin" a )H) file and save it as
Donthisdate!moduleD in the modules director/ of /our
Drupal installation!
<?php
?&
As per the (odin" standards, use the lon"hand VEphp ta",
and not VE to enclose /our )H) code!
All functions in /our module are named PmodulenameQN
PhookQ, 2here GhookG is a 2ell defined function name!
Drupal 2ill call these functions to "et specific data, so
havin" these 2ell defined names means Drupal kno2s
2here to look!
Telling Drupal about your module
The first function 2eDll 2rite 2ill tell Drupal information
Drupal Handbook: 20 April 2005 7$$
about /our module: its name and description! The hook
name for this function is DhelpD, so start 2ith the
onthisdateNhelp function:
<?php
function onthisdate_he!p($section='') {
)
?&
The Wsection variable provides contet for the help: 2here
in Drupal or the module are 2e lookin" for help! The
recommended 2a/ to process this variable is 2ith a s2itch
statement! KouDll see this code pattern in other modules!
<?php
.FF
F Hisp!ay he!p and modu!e information
F Sparam section /hich section of the site /e're
disp!aying he!p
F Sreturn he!p te$t for section
F.
function onthisdate_he!p($section='') {
$output = '';
s/itch ($section) {
case *admin.modu!es0description*%
$output = t(*Hisp!ays !in(s to nodes created
on this date*);
rea(;
)
return $output;
) .. function onthisdate_he!p
?&
Kou 2ill eventuall/ 2ant to add other cases to this s2itch
statement to provide real help messa"es to the user! 9n
particular, output for GadminJhelpkonthisdateG 2ill displa/
on the main help pa"e accessed b/ the adminJhelp 'C0 for
this module 4JadminJhelp or EI`adminJhelp5!
Telling Drupal *ho can use your module
The net function to 2rite is the permissions function! The
permissions function doesnDt "rant permission, it Fust
specifies 2hat permissions are available for this module!
Access based on these permissions is defined later in the
PmoduleQNaccess function belo2! At this point, 2eDll "ive
Drupal Handbook: 20 April 2005 7$5
permission to an/one 2ho can access site content or
administrate the module:
<?php
.FF
F Ra!id permissions for this modu!e
F Sreturn array <n array of va!id permissions for
the onthisdate modu!e
F.
function onthisdate_perm() {
return array('access content');
) .. function onthisdate_perm()
?&
(onversel/, if /ou are "oin" to 2rite a module that needs
to have finer control over the permissions, and /ouDre
"oin" to do permission control, /ou should epand this
permission set! Kou can do this b/ addin" strin"s to the
arra/ that is returned! 6or eample:
<?php
function onthisdate_perm() {
return array('access content'' 'access
onthisdate'' 'administer onthisdate');
) .. function onthisdate_perm
?&
6or this tutorial, start 2ith the first one! ,eDll later move
to the second version!
KouDll need to adFust 2ho has permission to vie2 /our
module on the administer h accounts h permissions pa"e!
,eDll use the userNaccess function to check access
permissions later 42hoa, so man/ GlatersLG5!
Kour permission strin"s must be uniIue 2ithin /our
module! 9f the/ are not, the permissions pa"e 2ill list the
same permission multiple times! The/ should also contain
/our module name, to avoid name space conflicts 2ith
other modules!
Announce *e ha/e block content
There are several t/pes of modules: block modules and
node modules are t2o! -lock modules create abbreviated
content that is t/picall/ 4but not al2a/s, and not reIuired
to be5 displa/ed alon" the left or ri"ht side of a pa"e! ;ode
Drupal Handbook: 20 April 2005 7$%
modules "enerate full pa"e content 4such as blo", forum,
or book pa"es5!
,eDll create a block content to start, and later discuss
node content! A module can "enerate content for blocks
and also for a full pa"e 4the blo"s module is a "ood
eample of this5! The hook for a block module is
appropriatel/ called GblockG, so letDs start our net
function:
<?php
.FF
F Qenerate E;1= for the onthisdate !oc(
F Sparam op the operation from the IG=
F Sparam de!ta offset
F Sreturns !oc( E;1=
F.
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
) .. end function onthisdate_!oc(
?&
The block function takes t2o parameters: the operation
and the offset, or delta! ,eDll Fust 2orr/ about the
operation at this point! 9n particular, 2e care about the
specific case 2here the block is bein" listed in the blocks
pa"e! 9n all other situations, 2eDll displa/ the block
content!
,hen the module 2ill be listed on the blocks pa"e, the Wop
parameterDs value 2ill be DlistD:
<?php
.FF
F Qenerate E;1= for the onthisdate !oc(
F Sparam op the operation from the IG=
F Sparam de!ta offset
F Sreturns !oc( E;1=
F.
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
.. !isting of !oc(s' such as on the admin.!oc(
page
if ($op == *!ist*) {
$!oc([?"[*info*" = t('Cn ;his Hate');
return $!oc(;
) e!se {
.. our !oc( content
)
) .. end onthisdate_!oc(
Drupal Handbook: 20 April 2005 7$?
?&
Generate content for a block
;o2, 2e need to "enerate the DonthisdateD content for the
block! Here 2eDll demonstrate a basic 2a/ to access the
database!
.ur "oal is to "et a list of content 4stored as GnodesG in the
database5 created a 2eek a"o! *pecificall/, 2e 2ant the
content created bet2een midni"ht and 11:53pm on the
da/ one 2eek a"o! ,hen a node is first created, the time
of creation is stored in the database! ,eDll use this
database field to find our data!
6irst, 2e need to calculate the time 4in seconds since
epoch start, see
http:JJ222!php!netJmanualJenJfunction!time!php for more
information on time format5 for midni"ht a 2eek a"o, and
11:53pm a 2eek a"o! This part of the code is Drupal
independent, see the )H) 2ebsite 4http:JJphp!netJ5 for
more details!
<?php
.FF
F Qenerate E;1= for the onthisdate !oc(
F Sparam op the operation from the IG=
F Sparam de!ta offset
F Sreturns !oc( E;1=
F.
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
.. !isting of !oc(s' such as on the admin.!oc(
page
if ($op == *!ist*) {
$!oc([?"[*info*" = t('Cn ;his Hate');
return $!oc(;
) e!se {
.. our !oc( content
.. Qet today's date
$today = getdate();
.. ca!cu!ate midnight one /ee( ago
$start_time = m(time(?' ?' ?'
$today['mon'"' ($today
['mday'" 3 X)' $today['year'");
.. /e /ant items that occur on!y on the day in
7uestion' so
Drupal Handbook: 20 April 2005 7$&
.. ca!cu!ate 1 day
$end_time = $start_time W >-5??;
.. -? F -? F ,5 = >-5?? seconds in a day
+++
)
)
?&
The net step is the *M0 statement that 2ill retrieve the
content 2eDd like to displa/ from the database! ,eDre
selectin" content from the node table, 2hich is the central
table for Drupal content! ,eDll "et all sorts of content t/pe
2ith this Iuer/: blo" entries, forum posts, etc! 6or this
tutorial, this is oka/! 6or a real module, /ou 2ould adFust
the *M0 statement to select specific t/pes of content 4b/
addin" the Dt/peD column and a ,HHCH clause checkin"
the Dt/peD column5!
/ote: the table name is enclosed in curl/ braces: {node)!
This is necessar/ so that /our module 2ill support
database table name prefies! Kou can find more
information on the Drupal 2ebsite b/ readin" the Table
)refi 4and sharin" tables across instances5 pa"e in the
Drupal handbook!
<?php
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
*{node) OEAGA created &= '* + $start_time
+
*' <9H created <= '*+ $end_time + *'*;
?&
Drupal uses database helper functions to perform
database Iueries! This means that, for the most part, /ou
can 2rite /our database *M0 statement and not 2orr/
about the backend connections!
,eDll use dbNIuer/45 to "et the records 4i!e! the database
ro2s5 that match our *M0 Iuer/, and dbNfetchNobFect45 to
look at the individual records:
<?php
.. get the !in(s
$7ueryGesu!t = d_7uery($7uery);
.. content varia!e that /i!! e returned for
disp!ay
$!oc(_content = '';
Drupal Handbook: 20 April 2005 7$3
/hi!e ($!in(s = d_fetch_o2ect($7ueryGesu!t)) {
$!oc(_content += '<a href=*' + ur!('node.' +
$!in(s3&nid) + '*&' +
$!in(s3&tit!e + '<.a&<r .
&';
)
.. chec( to see if there /as any content efore
setting up
.. the !oc(
if ($!oc(_content == '') {
.F 9o content from a /ee( ago+ 8f /e return
nothing' the !oc(
F doesn't sho/' /hich is /hat /e /ant+ F.
return;
)
.. set up the !oc(
$!oc(['su2ect'" = 'Cn ;his Hate';
$!oc(['content'" = $!oc(_content;
return $!oc(;
)
?&
;otice the actual 'C0 is enclosed in the l45 function! !
"enerates Va href`GlinkG_ links, adFust the 'C0 to the
installationDs 'C0 confi"uration of either clean 'C0*:
http:JJ4sitename5JnodeJ2 or http:JJ4sitename5JEI`nodeJ2
Also, 2e return an arra/ that has DsubFectD and DcontentD
elements! This is 2hat Drupal epects from a block
function! 9f /ou do not include both of these, the block 2ill
not render properl/!
Kou ma/ also notice the bad codin" practice of combinin"
content 2ith la/out! 9f /ou are 2ritin" a module for others
to use, /ou 2ill 2ant to provide an eas/ 2a/ for others 4in
particular, non+pro"rammers5 to adFust the contentDs
la/out! An eas/ 2a/ to do this is to include a class
attribute in /our link, or surround the HT<0 2ith a Vdiv_
ta" 2ith a module specific (** class and not necessaril/
include the Vbr J_ at the end of the link! 0etDs i"nore this
for no2, but be a2are of this issue 2hen 2ritin" modules
that others 2ill use!
)uttin" it all to"ether, our block function at this point
looks like this:
<?php
Drupal Handbook: 20 April 2005 750
function onthisdate_!oc(($op='!ist'' $de!ta=?) {
.. !isting of !oc(s' such as on the admin.!oc(
page
if ($op == *!ist*) {
$!oc([?"[*info*" = t(*Cn ;his Hate*);
return $!oc(;
) e!se {
.. our !oc( content
.. content varia!e that /i!! e returned for
disp!ay
$!oc(_content = '';
.. Qet today's date
$today = getdate();
.. ca!cu!ate midnight one /ee( ago
$start_time = m(time(?' ?' ?'$today['mon'"'
($today['mday'" 3
X)' $today['year'");
.. /e /ant items that occur on!y on the day in
7uestion' so
..ca!cu!ate 1 day
$end_time = $start_time W >-5??;
.. -? F -? F ,5 = >-5?? seconds in a day
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time +
*'*;
.. get the !in(s
$7ueryGesu!t = d_7uery($7uery);
/hi!e ($!in(s = d_fetch_o2ect($7ueryGesu!t))
{
$!oc(_content += '<a href=*'+ur!
('node.'+$!in(s3&nid)+'*&'+
$!in(s3&tit!e + '<.a&<r .
&';
)
.. chec( to see if there /as any content
efore setting up the !oc(
if ($!oc(_content == '') {
.. no content from a /ee( ago' return
nothing+
return;
)
.. set up the !oc(
$!oc(['su2ect'" = 'Cn ;his Hate';
$!oc(['content'" = $!oc(_content;
return $!oc(;
)
Drupal Handbook: 20 April 2005 751
)
?&
"nstalling+ enabling and testing the
module
At this point, /ou can install /our module and itDll 2ork!
0etDs do that, and see 2here 2e need to improve the
module!
To install the module, /ouDll need to cop/ /our
onthisdate!module file to the modules director/ of /our
Drupal installation! The file must be installed in this
director/ or a subdirector/ of the modules director/, and
must have the !module name etension!
0o" in as /our site administrator, and navi"ate to the
modules administration pa"e to "et an alphabetical list of
modules! 9n the menus: administer h modules, or via 'C0:
http%..+++.admin.modu!es or
http%..+++.?7=admin.modu!es
,hen /ou scroll do2n, /ouDll see the onthisdate module
listed 2ith the description net to it!
Hnable the module b/ selectin" the checkbo and save
/our confi"uration!
-ecause the module is a blocks module, 2eDll need to also
enable it in the blocks administration menu and specif/ a
location for it to displa/! ;ode modules ma/ or ma/ not
need further confi"uration dependin" on the module! An/
module can have settin"s, 2hich affect the
functionalit/Jdispla/ of a module! ,eDll discuss settin"s
later! 6or no2, navi"ate to the blocks administration pa"e:
admin.!oc( or administer h blocks in the menus!
Hnable the module b/ selectin" the enabled checkbo for
the D.n This DateD block and save /our blocks! -e sure to
adFust the location 4leftJri"ht5 if /ou are usin" a theme that
limits 2here blocks are displa/ed!
;o2, head to another pa"e, sa/, select the modules menu!
9n some themes, the blocks are displa/ed after the pa"e
has rendered the content, and /ou 2onDt see the chan"e
until /ou "o to ne2 pa"e!
Drupal Handbook: 20 April 2005 752
9f /ou have content that 2as created a 2eek a"o, the block
2ill displa/ 2ith links to the content! 9f /ou donDt have
content, /ouDll need to fake some data! Kou can do this b/
creatin" a blo", forum topic or book pa"e, and adFust the
GAuthored on:G date to be a 2eek a"o!
Alternatel/, if /our site has been around for a 2hile, /ou
ma/ have a lot of content created on the da/ one 2eek
a"o, and /ouDll see a lar"e number of links in the block!
Create a module configuration 1settings2
page
;o2 that 2e have a 2orkin" module, 2eDd like to make it
better! 9f 2e have a site that has been around for a 2hile,
content from a 2eek a"o mi"ht not be as interestin" as
content from a /ear a"o! *imilarl/, if 2e have a bus/ site,
2e mi"ht not 2ant to displa/ all the links to content
created last 2eek! *o, letDs create a confi"uration pa"e for
the administrator to adFust this information!
A moduleDs confi"uration is set up 2ith the Dsettin"sD hook!
,e 2ould like onl/ administrators to be able to access this
pa"e, so 2eDll do our first permissions check of the module
here:
<?php
.FF
F 1odu!e configuration settings
F Sreturn settings E;1= or deny access
F.
function onthisdate_settings() {
.. on!y administrators can access this modu!e
if (Zuser_access(*admin onthisdate*)) {
return message_access();
)
)
?&
9f /ou 2ant to tie /our modules permissions to the
permissions of another module, /ou can use that moduleDs
permission strin"! The Gaccess contentG permission is a
"ood one to check if the user can vie2 the content on /our
site:
Drupal Handbook: 20 April 2005 757
<?php
+++
.. chec( the user has content access
if (Zuser_access(*access content*)) {
return message_access();
)
+++
?&
,eDd like to confi"ure ho2 man/ links displa/ in the block,
so 2eDll create a form for the administrator to set the
number of links:
<?php
function onthisdate_settings() {
.. on!y administrators can access this modu!e
if (Zuser_access(*admin onthisdate*)) {
return message_access();
)
$output += form_te$tfie!d(t(*1a$imum numer of
!in(s*)' *onthisdate_ma$disp*'
varia!e_get(*onthisdate_ma$disp*'
*@*)' ,' ,'
t(*;he ma$imum numer of !in(s to
disp!ay in the !oc(+*)); return $output;)
?&
This function uses several po2erful Drupal form handlin"
features! ,e donDt need to 2orr/ about creatin" an HT<0
tet field or the form, as Drupal 2ill do so for us! ,e use
varia!e_get to retrieve the value of the s/stem
confi"uration variable GonthisdateNmadispG, 2hich has a
default value of 7! ,e use the formNtetfield function to
create the form and a tet bo of si=e 2, acceptin" a
maimum len"th of 2 characters! ,e also use the translate
function of t45! There are other form functions that 2ill
automaticall/ create the HT<0 form elements for use! 6or
no2, 2eDll Fust use the formNtetfield function!
.f course, 2eDll need to use the confi"uration value in our
*M0 *H0H(T, so 2eDll need to adFust our Iuer/ statement
in the onthisdateNblock function:
<?php
$!imitnum = varia!e_get(*onthisdate_ma$disp*'
@);
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
Drupal Handbook: 20 April 2005 75$
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time + *'
=818; * + $!imitnum;
?&
Kou can test the settin"s pa"e b/ editin" the number of
links displa/ed and noticin" the block content adFusts
accordin"l/!
;avi"ate to the settin"s pa"e: adminJmodulesJonthisdate
or
administer h confi"uration h modules h onthisdate! AdFust
the number of links and save the confi"uration! ;otice the
number of links in the block adFusts accordin"l/!
/ote:,e donDt have an/ validation 2ith this input! 9f /ou
enter GcG in the maimum number of links, /ouDll break the
block!
Adding menu links and creating page
content
*o far 2e have our 2orkin" block and a settin"s pa"e! The
block displa/s a maimum number of links! Ho2ever,
there ma/ be more links than the maimum 2e sho2! *o,
letDs create a pa"e that lists all the content that 2as
created a 2eek a"o!
<?php
function onthisdate_a!!() {)
?&
,eDre "oin" to use much of the code from the block
function! ,eDll 2rite this Htreme)ro"rammin" st/le, and
duplicate the code! 9f 2e need to use it in a third place,
2eDll refactor it into a separate function! 6or no2, cop/ the
code to the ne2 function NonthisdateNall45! (ontrar/ to all
our other functions, DallD, in this case, is not a Drupal hook!
9n our code, 2e can prefi this function 2ith an
underscore to help us remember this isnDt a hook call!
,eDll discuss belo2!
<?php
function _onthisdate_a!!() {
.. content varia!e that /i!! e returned for
Drupal Handbook: 20 April 2005 755
disp!ay
$page_content = '';
.. Qet today's date
$today = getdate();
.. ca!cu!ate midnight one /ee( ago
$start_time = m(time(?' ?' ?'
$today['mon'"' ($today
['mday'" 3 X)' $today['year'");
.. /e /ant items that occur on!y on the day in
7uestion'
.. so ca!cu!ate 1 day
$end_time = $start_time W >-5??;
.. -? F -? F ,5 = >-5?? seconds in a day
.. 9C;AZ 9o =818; c!ause hereZ Oe /ant to sho/
a!! the code
$7uery = *:A=AB; nid' tit!e' created DGC1 * +
*{node) OEAGA created &= '* +
$start_time +
*' <9H created <= '*+ $end_time + *'*;
.. get the !in(s
$7ueryGesu!t = d_7uery($7uery);
/hi!e ($!in(s = d_fetch_o2ect($7ueryGesu!t)) {
$page_content += '<a href=*'+ur!
('node.'+$!in(s3&nid)+'*&'+
$!in(s3&tit!e + '<.a&<r .
&';
)
+++
)
?&
,e have the pa"e content at this point, but 2e 2ant to do
a little more 2ith it than Fust return it! ,hen creatin"
pa"es, 2e need to send the pa"e content to the theme for
proper renderin"! ,e use this 2ith the theme45 function!
Themes control the look of a site! As noted above, 2eDre
includin" la/out in the code! This is bad, and should be
avoided! 9t is, ho2ever, the topic of another tutorial, so for
no2, 2eDll include the formattin" in our content:
<?php
print theme(*page*' $content_string);
?&
The rest of our function checks to see if there is content
and lets the user kno2! This is preferable to sho2in" an
Drupal Handbook: 20 April 2005 75%
empt/ or blank pa"e, 2hich ma/ confuse the user!
;ote that 2e are responsible for outputtin" the pa"e
content 2ith the Dprint theme45D s/nta!
<?php
function _onthisdate_a!!() {
+++
.. chec( to see if there /as any content efore
.. setting up the !oc(
if ($page_content == '') {
.. no content from a /ee( ago' !et the user
(no/
print theme(*page*'
*9o events occurred on this site
on this date in history+*);
return;
)
print theme(*page*' $page_content);
)
?&
,etting Drupal kno* about the ne*
function
As mentioned above, the function 2e Fust 2rote isnDt a
DhookD: itDs not a Drupal reco"ni=ed name! ,e need to tell
Drupal ho2 to access the function 2hen displa/in" a pa"e!
,e do this 2ith the menu45 hook! The menu45 hook defines
the association bet2een a 'C0 and the function that
creates the content for that url! The hook also does
permission checkin", if desired!
<?php
function onthisdate_menu() {)
$items = array();
$items[" = array('path' =& 'onthisdate''
'tit!e' =& t('on
this date')'
'ca!!ac(' =&
'_onthisdate_a!!''
'access' =&
user_access('access content')'
'type' =&
1A9I_B<==M<BT);
return $items;
Drupal Handbook: 20 April 2005 75?
?&
-asicall/, 2eDre sa/in" if the user "oes to GonthisdateG
4either via EI`onthisdate or http:JJ!!!Jonthisdate5, the
content "enerated b/ onthisdateNall 2ill be displa/ed! The
title of the pa"e 2ill be Gon this dateG! The t/pe
<H;'N(A00-A(> Drupal to not displa/ the link in the
userDs menu, Fust use this function 2hen the 'C0 is
accessed! 'se <H;'N0.(A0NTA*> if /ou 2ant the user
to see the link in the side navi"ation block!
;avi"ate to Jonthisdate 4or EI`onthisdate5 and see 2hat
/ou "et!
Adding a more link and sho*ing all
entries
-ecause 2e have our function that creates a pa"e 2ith all
the content created a 2eek a"o, 2e can link to it from the
block 2ith a GmoreG link!
Add these lines Fust before that WblockZDsubFectD[ line,
addin" this to the WblockNcontent variable before savin" it
to the WblockZDcontentD[ variable:
<?php
.. add a more !in( to our page that disp!ays a!!
the !in(s
$!oc(_content +=
*<div c!ass=U*more3!in(U*&*+
!(t(*more*)' *onthisdate*' array(*tit!e*
=& t(*1ore events on this day+*)))
+*<.div&*;
?&
This 2ill add the more link!
And *e:re doneE
,e no2 have a 2orkin" module! 9t created a block and a
pa"e! Kou should no2 have enou"h to "et started 2ritin"
/our o2n modules! ,e recommend /ou start 2ith a block
module of /our o2n and move onto a node module!
Alternatel/, /ou can 2rite a filter or theme!
Drupal Handbook: 20 April 2005 75&
3urther notes
As is, this tutorialDs module isnDt ver/ useful! Ho2ever,
2ith a fe2 enhancements, it can be entertainin"! Tr/
modif/in" the select Iuer/ statement to select onl/ nodes
of t/pe Dblo"D and see 2hat /ou "et! Alternatel/, /ou could
"et onl/ a particular userDs content for a specific 2eek!
9nstead of usin" the block function, consider epandin"
the menu and pa"e functions, addin" menus to specific
entries or dates, or usin" the menu callback ar"uments to
adFust 2hat /ear /ou look at the content from!
9f /ou start 2ritin" modules for others to use, /ouDll 2ant
to provide more details in /our code! (omments in the
code are incredibl/ valuable for other developers and
users in understandin" 2hatDs "oin" on in /our module!
KouDll also 2ant to epand the help function, providin"
better help for the user! 6ollo2 the Drupal Z(odin"
standards[, especiall/ if /ouDre "oin" to add /our module
to the proFect!
T2o topics ver/ important in module development are
2ritin" themeable pa"es and 2ritin" translatable content!
)lease check the ZDrupal Handbook[ for more details on
these t2o subFects!
Con/erting 4.K modules to 4.6
&lock system
Hver/ block no2 has a confi"uration pa"e to control block+
specific options! <odules 2hich have confi"urations for
their blocks should move those into hookNblock45!
The onl/ reIuired chan"es to modules implementin"
hookNblock45 is to be careful about 2hat is returned! Do
not return an/thin" if Wop is not DlistD or Dvie2D! .nce this
chan"e is made, modules 2ill still be compatible 2ith
Drupal $!5!
9f a specific block has confi"uration options, implement
the additional Wop options in /our module! The
implementation of Dconfi"ureD should return a strin"
containin" the confi"uration form for the block 2ith the
appropriate Wdelta! DsaveD 2ill have an additional Wedit
Drupal Handbook: 20 April 2005 753
ar"ument, 2hich 2ill contain the submitted form data for
savin"!
earch system
The search s/stem "ot a si"nificant overhaul!
;ode indein" no2 uses the nodeDs processed and filtered
output, 2hich means that an/ custom node fields 2ill
automaticall/ be included in the inde, as lon" as the/ are
visible to normal users 2ho vie2 the node! <odules that
implement hoo(_search() and hoo(_update_inde$() Fust
to have etra node fields indeed no lon"er need to do
this!
9f /ou 2ish to have additional information indeed that is
not visible in the node displa/ at nodeJid, then /ou can do
so usin" nodeapi4Dupdate indeD5! 9f /ou 2ant to add etra
information to the node results, use nodeapi4Dsearch
resultD5!
Ho2ever, the standard search is still limited to a ke/2ord
search! <odules that implement custom, specific search
forms 4like proFect!module5 can still do so! (ustom search
forms that do not use hookNsearch45 should be
locatedJmoved to a local task under the Jsearch pa"e!
9f /ou are unsure of 2hat /ou need to do, please refer to
the complete search documentation!
8odule paths
The function modu!e_get_path 2as renamed to
drupa!_get_path 2hich no2 returns the path for all
themes, theme en"ines and modules! -ecause of this
abstraction /ou must pass an additional parameter
identif/in" the t/pe of item for 2hich the path is
reIuested! The follo2in" eample compares retrievin" the
path to ima"e module bet2een Drupal $!5 and $!%!
<?php
.. Hrupa! 5+6%
$path = modu!e_get_path('image');
.. Hrupa! 5+-%
$path = drupa!_get_path('modu!e'' 'image');
?&
All instances of modu!e_get_path should be renamed to
Drupal Handbook: 20 April 2005 7%0
drupa!_get_path!
Database backend
The function chec(_7uery 2as renamed to
d_escape_string and no2 has a database specific
implementation! All instances of chec(_7uery should be
renamed to d_escape_string!
Theme system
The function themeNpa"e45 no lon"er takes $tit!e or
$readcrum ar"uments! *et pa"e titles usin" hookNmenu
45 or, if the title must be d/namicall/ determined, use
drupalNsetNtitle45! *et breadcrumb trails first usin"
hookNmenu45, 2hich can be overridden 2ith
menuNsetNlocation45 and drupalNsetNbreadcrumb45!
!atchdog messages
The 2atchdo"45 function no2 takes a severit/ attribute, so
/atchdog($type' $message' $!in(); becomes /atchdog
($type' $message' $severity' $!in();! *pecif/ a
severit/ in case /ou are reportin" a 2arnin" or error!
)ossible severit/ constants are: O<;BEHCQ_9C;8BA,
O<;BEHCQ_O<G989Q and O<;BEHCQ_AGGCG! Also make sure
that /ou provide the t/pe as a literal strin", so translation
etraction can pick it up!
9f /ou are unsure of 2hich severit/ to use, remember these
rules:
9f the problem is caused b/ a definite fault and
should be fied as soon as possible, use an error
messa"e!
9f the problem could point to a fault, but could also
be harmless, use a 2arnin" messa"e! This t/pe
should also be used 2henever the problem could be
caused b/ a remote server 4eample: pin" timeout,
failed to a""re"ate a feed, etc5!
;ormal messa"es should be notices!
7ode markers
9f /ou have a module callin" theme('mar('), note that it is
Drupal Handbook: 20 April 2005 7%1
no2 possible to have different markers for different states
of a node! The supported states are 1<GT_9AO,
1<GT_IKH<;AH and 1<GT_GA<H! Kou can "et the marker
state from node_mar((), 2hich replaces the node_ne/()
function available in previous Drupal versions!
Control o/er destination page after form processing
.ccasionall/ a module mi"ht 2ant to specif/ 2here a user
should "o after he submits a form! This is no2 possible b/
passin" a Iuer/strin" parameter #destination=<path&!
6or eample, editin" of nodes and comments from 2ithin
the Admin pa"es no2 returns the user to those pa"es after
he is done! 6or eample usa"e, search
drupalN"etNdestination45 2hich can be found in
path!module, node!module, comment!module, and
user!module
Confirmation messages
(onfirmations for dan"erous actions should no2 be
presented 2ith the theme('confirm') function for
consistenc/! (heck the functionDs documentation or look at
some of the core modules for eamples!
;ote that this is a themable function 2hich should be
invoked throu"h theme('confirm') and not
theme_confirm()!
"nter module calls
;e2 features are available ++ itDs not necessar/ to use
them! ;o2 /ou can reall/ 4and should5 use moduleNinvoke
to call a function from another module! 6or eample,
ta$onomy_get_tree should be called b/ modu!e_invo(e
('ta$onomy'' 'get_tree') 9f /ou need to loop throu"h
the implementations of a hook, please check the ne2
moduleNimplements function!
7ode (ueries
9f /ou have a module 2hich retrieves a list of nodes b/
issuin" its o2n database Iuer/, then the follo2in" applies!
The functions nodeNaccessNFoinNsIl45 and
Drupal Handbook: 20 April 2005 7%2
nodeNaccessN2hereNsIl45 should not be used an/ more but
the *H0H(T+Iueries should be 2rapped in a
dbNre2riteNsIl45 call!
9f /ou have used D9*T9;(T4nid5 ++ because of
nodeNaccessNFoinNsIl45 ++ /ou no lon"er need it, replace it
simpl/ 2ith n!nid! 9f /ou have *H0H(T O, please replace it
2ith *H0H(T n!nid, n!O ++ and al2a/s make sure that n!nid
field comes first in the *H0H(T statement ++ this 2a/ the
dbNre2riteNsIl45 function can re2rite the Iuer/ to use
D9*T9;(T4nid5 should there be a need for it! 9f the n!nid
field is not first, the Iuer/ 2ill fail 2hen node access
modules are enabled!
Al2a/s use table name before the field names, especiall/
before nid because other tables ma/ be 1.9;ed durin" the
re2rite process!
Hample:
<?php
.. Hrupa! 5+6%
$nodes = d_7uery_range(':A=AB; H8:;89B;(n+nid)
DGC1 {node) n '+ node_access_2oin_s7!() +' OEAGA
'+ node_access_/here_s7!() +' <9H n+promote = 1
<9H n+status = 1 CGHAG MP n+created HA:B'' ?' 16);
.. Hrupa! 5+-%
$nodes = d_7uery_range(d_re/rite_s7!(':A=AB;
n+nid DGC1 {node) n OEAGA n+promote = 1 <9H
n+status = 1 CGHAG MP n+created HA:B')' ?' 16);
?&
9f /ou are not usin" the node table, then /ou shall pass the
table name from 2hich /ou *H0H(Tin" the nodes! 6or
eample
<?php
$resu!t = d_7uery(d_re/rite_s7!(*:A=AB; f+nid'
f+F from {fi!es) f OEAGA fi!epath = '\s'*' 'f')'
$fi!e);
?&
note the DfD parameter of dbNre2riteNsIl45!
Avoid '*9;# because there could be 1.9;s before it,
2hich 2ill break the '*9;# clause!
Drupal Handbook: 20 April 2005 7%7
Te-t output
DrupalDs tet output 2as audited and several escapin"
bu"s 2ere found! 6or more info, see the checkNplain
patch!
Kou need to pa/ attention that all user+submitted plain+tet
in /our module is escaped usin" checkNplain45 2hen /ou
output it into HT<0! ;o escapin" should be done on data
that is "oin" into the database: onl/ escape 2hen
outputtin" to HT<0!
(heckNplain45 replaces drupalNspecialchars45 and
checkNform45, so if /ou are usin" an/ of those t2o, /ou
should use checkNplain45 instead!
Kou should also 2rap user+submitted tet in messa"es 2ith
theme('p!aceho!der'' $te$t)+ 6or eample for Gcreated
term atermG!
)a/ attention in particular to node and comment titles as
their behaviour has been chan"ed! The/ are no2 stored as
plain+tet, like other sin"le+line fields in Drupal and should
be escaped 2hen output! Ho2ever, the function l45 no2
takes plain+tet b/ default instead of HT<0, 2hich means
that 2henever Wnode+_title is used as the caption for a
link, it 2ill automaticall/ be escaped! ,hen outputtin"
titles literall/, /ou still have to escape them /ourself!
'C0s also reIuire attention, as the 'C0 functions 4url,
reIuestNuri, refererNuri, etc5 2ere chan"ed to output DrealD
'C0s rather than HT<0+escaped 'C0s! ,hen puttin" an/
of them inside an HT<0 ta" attribute 4e!"! Va href`G!!!G_5,
/ou need to pass it throu"h checkNurl45 first! ,hen puttin"
an 'C0 into HT<0 outside of a ta" or attribute, /ou can
use checkNurl45 or checkNplain45, it doesnDt matter! DonDt
use checkNurl45 in situations 2here a real 'C0 is epected
4e!"! the HTT) G0ocation: !!!G header5!
The best test is to submit forms 2ith HT<0 ta"s in the
plain+tetJsin"le+line fields 4e!"! GVu_testVJu_G5! 9f the
underline ta" is not interpreted, but displa/ed literall/,
/our module is escapin" the tet correctl/!
;othin" has chan"ed for filteredJrich tet, 2hich still uses
checkNoutput45 like before!
Drupal Handbook: 20 April 2005 7%$
!riting a node module
This information is superseded b/ the Do/"en
documentation! 9n particular, its eample node module is a
"ood tutorial!
!riting efficient database .'"7s
posted b/ (rai" (ourtne/ on %J21J2007 to the drupal+devel
mailin" list!
There are three t/pes of Foin
There are 7 kinds of Foin 9;;HC, 0H6T .'THC, C9#HT
.'THC and each reIuires an .; clause to let the CD-<*
kno2 2hat fields to use Foinin" the tables! 6or each Foin
there are t2o table the left table and the ri"ht table! The
s/nta bein" the follo2in"
Pleft tableQ P9;;HC T 0H6T T C9#HTQ 1.9; Pri"ht tableQ
.; PFoin criteriaQ
An 9;;HC 1.9; returns onl/ those ro2s from left table
2here the/ have a matchin" ro2 in ri"ht table based on
the Foin criteria!
A 0H6T 1.9; returns A00 ro2s from the left table even if
no matchin" ro2s 2here found in the ri"ht table! An/
values selected out of the ri"ht table 2ill be null for those
ro2s 2here no matchin" ro2 is found in the ri"ht table!
A C9#HT 1.9; 2orks eactl/ the same as a left Foin but
reversin" the direction! *o it 2ould return all ro2s in the
ri"ht table re"ardless of matchin" ro2s in the left table! 9t
is recommended that /ou no use ri"ht Foins as /our Iuer/
can al2a/s be re2ritten to use left Foins 2hich tend to be
more portable and easier to read!
,ith all of the Foins if there are multiple ro2s in one table
that match one ro2 in the other table 2ill result in that
ro2 "ettin" returned man/ time!
6or eample:
Table A
tid, name
1, D0inuD
2, DDebianD
Drupal Handbook: 20 April 2005 7%5
Table -
fid, tid, messa"e
1, 1, D:er/ (oolD
2, 1, D,hat an eampleD
Muer/ 1:
*H0H(T a!name, b!messa"e 6C.< a 9;;HC 1.9; b .;
a!tid ` b!tid
Cesult 1:
0inu, :er/ (ool
0inu, ,hat an eample
Muer/ 2:
*H0H(T a!name, b!messa"e 6C.< a 0H6T 1.9; b .;
a!tid ` b!tid
Cesult 2:
0inu, :er/ (ool
0inu, ,hat an eample
Debian, Vnull_
Hope that helps in readin" some of the Iueries!
Connecting to multiple databases *ithin
Drupal
Drupal can connect to different databases 2ith ele"ance
and easeL
6irst define the database connections Drupal 2ill use b/
editin" the $d_ur! strin" in the Drupal confi"uration file
4settin"s!php for $!%, conf!php for $!5 and earlier5! -/
default onl/ a sin"le connection is defined
<?php
$d_ur! =
'mys7!%..drupa!%drupa!S!oca!host.drupa!';
?&
To allo2 multiple database connections, convert $d_ur!
to an arra/!
<?php
$d_ur!['defau!t'" =
'mys7!%..drupa!%drupa!S!oca!host.drupa!';
$d_ur!['myd'" =
'mys7!%..user%p/dS!oca!host.anotherd';
$d_ur!['d@'" =
Drupal Handbook: 20 April 2005 7%%
'mys7!%..user%p/dS!oca!host.yetanotherd';
?&
;ote that the database containin" the Drupal installation
should be ke/ed as the defau!t connection!
To Iuer/ a different database, simpl/ set it as active b/
referencin" the ke/ name!
<?php
d_set_active('myd');
d_7uery(':A=AB; F DGC1 other_d');
..:/itch ac( to the defau!t connection /hen
finished+
d_set_active('defau!t');
?&
<ake sure to al2a/s s2itch back to the default connection
so Drupal can cleanl/ finish the reIuest lifec/cle and 2rite
to its s/stem tables!
Drupal:s menu building mechanism
4;ote: this is an anal/sis of the menu buildin" mechanism
in pre+$!5 (:* as of Au"ust 200$! 9t does not include
menu cachin"!5
Drupal Handbook: 20 April 2005 7%?

This continues our eamination of ho2 Drupal serves
pa"es! ,e are lookin" specificall/ at ho2 the menu s/stem
2orks and is built, from a technical perspective! *ee the
ecellent overvie2 in the menu s/stem documentation!
,e be"in in inde!php, 2here
menuNeecuteNactiveNhandler45 has been called! Divin" in
from menuNeecuteNactiveNhandler45, 2e immediatel/ set
the Wmenu variable b/ callin" menuN"etNmenu45! The
latter function declares the "lobal WNmenu arra/ 4note the
underline, it means a Dsuper "lobalD, 2hich is a predefined
arra/ in )H) lore5 and calls NmenuNbuild45 to fill the arra/,
then returns WNmenu! Althou"h menuN"etNmenu45
Drupal Handbook: 20 April 2005 7%&
initiali=es the WNmenu arra/, the NmenuNbuild45 function
actuall/ reinitiali=es the WNmenu arra/! Then it sets up t2o
main arra/s 2ithin WNmenu: the items arra/ and the path
inde arra/!
The items arra/ is an arra/ ke/ed to inte"ers! Hach entr/
contains the follo2in" fields:
2equired fields
path strin" the partial 'C0 to the pa"e for this menu item
title strin" the title that this menu item 2ill have in the menu
t/pe
inte"e
r
a constant denotin" the menu item t/pe 4see
comments in menu!inc5
Dptional fields
access
boole
an
pid
inte"e
r
2ei"ht
inte"e
r
callback strin"
name of the function to be called if this menu item
is selected
callback
ar"uments
arra/
An arra/ called WmenuNitemNlist is populated b/ sendin" a
DmenuD callback to all modules 2ith DmenuD hooks 4that is,
the/ have a function called fooNmenu45 2here foo is the
name of the module5! *o each module has a chance to
re"ister its o2n menu items! 9t is interestin" that 2hen the
node module receives the menu callback throu"h
nodeNmenu45, and the path is somethin" like DnodeJ1D as it
is in our present case, the complete node is actuall/
loaded via the nodeNload45 function so it can be eamined
for permissions! The Wnode variable into 2hich it 2as
loaded then "oes out of scope, so the node is "one and
needs to be rebuilt completel/ later on! This seems like a
"olden opportunit/ for the node module to cache the node!
The WmenuNitemNlist arra/ is normali=ed b/ makin" sure
each arra/ entr/ has a path, t/pe and 2ei"ht entr/! As
each entr/ is eamined, the path inde arra/ of the
WNmenu arra/ is checked to see if the path of this menu
item eists! 9f an eIuivalent path is alread/ there in the
Drupal Handbook: 20 April 2005 7%3
path inde arra/, it is blasted a2a/! The path inde of this
menu item is then added as a ke/ 2ith the value bein" the
menu id! 9n the items arra/ of the WNmenu arra/, the menu
id is used as the ke/ and the entire arra/ entr/ is the
value!
;ote: the WtempNmid and Wmid variables seem to do the
same thin"! ,h/, s/ntacticall/, cannot onl/ one be usedE
The path inde arra/ contained ?% items 2hen servin" out
a simple node 2ith onl/ the default modules enabled!
;et the menu table from the database is fetched and its
contents are used to move the position of eistin" menu
items from their current menu ids to the menu ids saved in
the database! The comments sa/s Greassi"nin" menu 9Ds
as needed!G This is probabl/ to detect if the user has
customi=ed the menu entries usin" the menu module! The
path inde arra/ entries "enerated from the database can
be reco"ni=ed because their values are strin"s, 2hereas
up til no2 the values in the path inde arra/ have been
inte"ers!
;o2 9 "et sort of lost! 9t looks like the code is lookin" at
paths to determine 2hich menu items are children of other
menu items! Then NmenuNbuildNvisibleNtree is a recursive
function that builds a third subarra/ inside WNmenu, to "o
alon" 2ith items and path inde! 9t is called visible and
takes into account the access attribute and 2hether or not
the item is hidden in order to filter the items arra/! As an
anon/mous user, all items but the ;avi"ation menu item
are filtered out! *ee also the comments in menu!inc for
menuN"etNmenu45! 9n fact, read all the comments in
menu!incL
;o2 the path is parsed out from the I parameter of the
'C0! *ince nodeJ1 is present in the path inde, 2e
successfull/ found a menu item! 9t points to menu item +$$
in our case, to be precise, but there must be a bu" in the
eend 9DH because it sho2s item +$$ as null! An/2a/, the
menu item entr/ is checked for callback ar"uments 4there
are none5 and for additional parameters 4also none5, and
eecution is passed off to nodeNpa"e45 throu"h the
callNuserNfuncNarra/ function!
Drupal Handbook: 20 April 2005 7?0
Drupal:s node building mechanism
4This 2alkthrou"h done on pre+$!5 (:* code in Au"ust
200$!5

The nodeNpa"e controller checks for a WN).*TZDopD[ entr/
and, failin" that, sets Wop to ar"415 2hich in this case is
the D1D in nodeJ1! A numeric Wop is set to ar"425 if ar"425
eists, but in this case it doesnDt 4D1D is the end of the 'C0,
rememberE5 so the Wop is hardcoded to Dvie2D! Thus, 2e
succeed in the Dvie2D case of the s2itch statement, and are
shunted over to nodeNload45! The function nodeNload45
takes t2o ar"uments, Wconditions 4an arra/ 2ith nid set to
Drupal Handbook: 20 April 2005 7?1
desired node id ++ other conditions can be defined to
further restrict the upcomin" database Iuer/5 for 2hich
2e use ar"415, and Wrevision, for 2hich 2e use N#HT
ZDrevisionD[! The DrevisionD ke/ of the N#HT arra/ is unset so
2e need to make brief stop at errorNhandler because of an
undefined inde error! That doesnDt stop us, thou"h, and
2e continue pell+mell into nodeNload usin" the default
Wrevision of +1 4that is, the current revision5! The actual
Iuer/ that ends up bein" run is
*H0H(T n!O, u!uid, u!name, u!picture, u!data 6C.< node n
9;;HC 1.9; users u on u!uid ,HHCH n ` D1D
,e "et back a Foined ro2 from the database as an obFect!
The data field from the users table is seriali=ed, so it must
be unseriali=ed! This data field contains the userDs roles!
Ho2 does this relate to the userNroles tableE ;ote that the
comment GJJ 'nseriali=e the revisions and user data fieldsG
should be moved up before the call to drupalNunpack45!
,e no2 have a complete node that looks like the
follo2in":
Attribu
te
Ialue
bod/ This is a test node bod/
chan"e
d
10&3&53%57
comme
nt
2
created 10&3&5?%?7
data a:1:Ps:5!!! 4seriali=ed data5
modera
te
0
name admin
nid 1
picture DD
promot
e
1
revision
s
DD
roles
arra/ containin" one ke/+value
pair, 0 ` D2D
Drupal Handbook: 20 April 2005 7?2
score 0
status 1
stick/ 0
teaser This is a test node bod/
title Test
t/pe pa"e
uid 1
users DD
votes 0
All of the above are strin"s ecept the roles arra/!
*o no2 2e have a node loaded from the database! 9tDs time
to notif/ the appropriate module that this has happened!
,e do this via the nodeNinvoke4Wnode, DloadD5 call! The
module called via this callback ma/ return an arra/ of ke/+
value pairs, 2hich 2ill be added to the node above!
The nodeNinvoke45 function asks nodeN"etNmoduleNname45
to determine the name of the module that corresponds
2ith the nodeDs t/pe! 9n this case, the node t/pe is a pa"e,
so the pa"e!module is the one 2eDll call, and the specific
name of the function 2eDll call is pa"eNload45! 9f the name
of the node t/pe has a h/phen in it, the left part is used!
H!"!, if the node t/pe is pa"e+foo, the pa"e module is used!
The pa"eNload45 function turns out to be reall/ simple! 9t
Fust retrieves the format, link and description columns
from the pa"e table! The DformatD column specifies 2hether
2eDre dealin" 2ith a HT<0 or )H) pa"e! The DlinkD and
DdescriptionD fields are used to "enerate a link to the ne2l/
created pa"e, ho2ever, those 2ill be deprecated 2ith the
improved menu s/stem! To that etend, the core themes
no lon"er use this information 4unlike some older themes
in the contributions repositor/5! ,e return to nodeNload45,
2here the format, link and description ke/+value pairs are
added to the nodeDs definition!
;o2 itDs time to call the nodeNinvokeNnodeapi45 function to
allo2 other modules to do their thin"! ,e check each
module for a function that be"ins 2ith the moduleDs name
and ends 2ith Nnodeapi45! ,e hit pa/dirt 2ith the
comment module, 2hich has a function called
commentNnodeapi4^Wnode, Wop, ar" ` 05! ;ote that the
node is passed in b/ reference so that an/ chan"es made
Drupal Handbook: 20 April 2005 7?7
b/ the module 2ill be reflected in the actual node obFect
2e built! The Wop ar"ument is DloadD, in this case!
Ho2ever, this doesnDt match an/ of commentNnodeapi45Ds
s/mbols in its controller 4Dsettin"sD, DfieldsD, Dform adminD,
DvalidateD and DdeleteD match5! *o nothin" happens!
.ur second hit is nodeNnodeapi4^Wnode, Wop, War" ` 05 in
the node!module itself! A"ain, no s/mbols are matched in
the controller so 2e Fust return!
,eDll tr/ a"ain 2ith taonom/Nnodeapi4^Wnode, Wop, War"
` 05! A"ain, no s/mbols matchR the taonom/ module is
concerned onl/ 2ith inserts, updates and deletes, not
loads!
;ote that an/ of these modules could have done an/thin"
to the node if the/ had 2ished!
;et, the node is replaced 2ith the appropriate revision of
the node, if present as an attribute of Wnode! 9t is odd that
this occurs here, as all the 2ork that ma/ have been done
b/ modules is summaril/ blo2n a2a/ if a revision other
than the default revision is found!
6inall/, back in nodeNpa"e45, 2eDre read/ to "et do2n to
business and actuall/ produce some output! This is done
2ith the statement
print theme4Dpa"eD, nodeNsho24Wnode, ar"4755, Wnode+
_title5R
And 2hat that statement calls is comple enou"h to a"ain
2arrant another commentar/! 4;ot /et done!5
4o* Drupal handles access
9 believe this pa"e should eplain ho2 userNaccess table
2orks!
1!+ Drupal checks if the user has access to that module, if
he does !!!
2!+ The he checks the user Naccess pa"e 2here "id is the
role, vie2 should be 1 and realm should be GallG! 9f there is
no access "iven in that table, he 2ill not "ive the access to
the user!
9 believe there is not enou"h documentation on ho2 to use
node access, and hopefull/ this pa"e 2ill have more
information as people contribute!
Drupal Handbook: 20 April 2005 7?$
:tatus: field /alues for nodes and
comments
1ust documentin" the status field for the follo2in" tables
;.DH*
0: not published
1: published
(.<<H;T*
0: published
1: not published
2: deleted 4no lon"er eists in Drupal $!5 and above5
!riting themable modules
;ote: this pa"e describes DrupalDs themin" from the code
side of thin"s!
DrupalDs theme s/stem is ver/ po2erful! Kou can
accommodate rather maFor chan"es in overall appearance
and si"nificant structural chan"es! <oreover, /ou control
all aspects of /our drupal site in terms of colors, mark+up,
la/out and even the position of most blocks 4or boes5! Kou
can leave blocks out, move them from ri"ht to left, up and
do2n until it fits /our needs!
At the basis of this are DrupalDs theme functions! Hach
theme function takes a particular piece of data and
outputs it as HT<0! The default theme functions are all
named theme_something() or theme_modu!e_something
(), thus allo2in" an/ module to add themeable parts to
the default set provided b/ Drupal! *ome of the basic
theme functions include: theme_error() and theme_ta!e
() 2hich as their name su""est return HT<0 code for an
error messa"e and a table respectivel/! Theme functions
defined b/ modules include theme_forum_disp!ay() and
theme_node_!ist()!
(ustom themes can implement their o2n version of these
theme functions b/ definin" mytheme_something() 4if the
theme is named mytheme5! 6or eample, functions named:
mytheme_error(), mytheme_ta!e(),
mytheme_forum_disp!ay(), mytheme_node_!ist(), etc!
Drupal Handbook: 20 April 2005 7?5
correspondin" to the default theme functions described
above!
Drupal invokes these functions indirectl/ usin" the theme
() function! 6or eample:
<?php
$node = node_!oad(array('nid' =& $nid));
$output += theme(*node*' $node);
?&
-/ default, this 2ill call theme_node($node)! Ho2ever, if
the currentl/ active theme is Gm/themeG, and this theme
has defined a function mytheme_node(), then
mytheme_node($node) 2ill be invoked instead!
This simple and strai"ht+for2ard approach has proven to
be both fleible and fast!
Ho2ever, because direct )H) themin" is not ideal for
ever/one, 2e have implemented mechanisms on top of
this: so+called template en"ines can act as intermediaries
bet2een Drupal and the templateJtheme! The template
en"ine 2ill override the theme_functions() and stick the
appropriate content into user defined 485HT<0 templates!
This 2a/, no )H) kno2led"e is reIuired and a lot of the
compleit/ is hidden a2a/! <ore information about this
can be found in the Theme developerDs "uide, specificall/
the Themin" overvie2!
Theme de/eloper:s guide
This section of our handbook documents aspects of our
theme s/stem that 2ill be of interest to theme developers!
Theming o/er/ie*
;ote: this pa"e describes the theme s/stem from a
themerDs perspective! 9f /ou are a module coder lookin" to
make /our module themable, /ou should read this pa"e!
As of version $!5, DrupalDs theme s/stem is ver/ fleible!
The ne2 structure makes it eas/ to plu" components
to"ether to form /our theme: templatin" en"ines,
templates, st/lesheets and )H)!
Drupal Handbook: 20 April 2005 7?%
HereDs ho2 some eistin" themes are built:
Theme
,ngine
@1-1A
Template
@O-T$"A
!tyle
@C!!A
1ushbutton 8Template !tmpl !css
Bo0 7rey
Bo0
Cleanslate
Bluebeach
)H)Templa
te
!tpl!php
!css
!css
!tpl!php !css
Chameleon
$arin
(hameleon!theme
!css
!css
A DthemeD is no2 an abstract thin", 2hich can be formed in
several 2a/s:
)H) !theme file containin" overrides for
theme_functions: e!"! (hameleon
Template file 4!tmpl, !tpl!php5 for a templatin"
en"ine 48Template, )H)Template, !!!5: e!"!
)ushbutton, -luebeach
*t/le sheet for an eistin" template or theme: e!"!
<arvin, -o (leanslate
The director/ structure for the eample above looks like
this:
themes.engines.$temp!ate.$temp!ate+engine
themes.engines.phptemp!ate.phptemp!ate+engine
themes.pushutton.$temp!ate+tmp!
themes.pushutton.sty!e+css
themes.o$_grey.page+tp!+php
themes.o$_grey.sty!e+css
themes.o$_grey.o$_c!eans!ate.sty!e+css
themes.!ueeach.page+tp!+php
themes.!ueeach.sty!e+css
themes.chame!eon.chame!eon+theme
themes.chame!eon.sty!e+css
themes.chame!eon.marvin.sty!e+css
Themes and templates are placed in their o2n
subdirector/ in the themes director/! The theme en"ines
2ill scan ever/ subdirector/ for template files 4!tmpl, !
tpl!php, !!!5! 9f a sty!e+css file is present, it 2ill also be
used!
Kou can also make (**+onl/ themes b/ makin" a
subdirector/ in an/ theme director/ and placin" a ne2
Drupal Handbook: 20 April 2005 7??
sty!e+css file in it! Drupal 2ill combine the ne2
st/lesheet 2ith the template it belon"s in, and make it
available as a ne2 theme! This is ho2 the <arvin and -o
(leanslate themes 2ork!
6inall/, if there is a screenshot+png file in the theme
director/, Drupal 2ill sho2 it in the theme administration
screen!
Creating custom themes
9f /ou 2ant to create a custom theme, /ou can either
customi=e an eistin" theme or start from scratch!
To customi=e an eistin" theme, Fust cop/ it to a ne2
director/ in themes, and "ive it a uniIue name! Themes
should not have a name that is the same as an/ of the
default modules in Drupal or an/ custom modules /ou
mi"ht have enabled or confi"ured! Then modif/ the cop/
as much as /ou 2ant! Dependin" on 2hether the theme is
template or !theme+file based, /ou can use )H) or
8HT<0J(** to modif/ it! As eplained above, if /ou onl/
2ant to alter the (** of a theme, then Fust place a ne2
sty!e+css file in a subdirector/ of the theme: it 2ill
appear as a ne2 theme in Drupal!
9f /ou 2ant to start from scratch, there are several 2a/s to
"o! 9f /ouDre not a pro"rammer, then the easiest solution is
to use one of the template en"ines! -/ default, Drupal
comes 2ith the 8Template theme en"ine, 2hich reIuires
/ou to create an 485HT<0 skeleton 2ith special markers!
*ee the 8Template documentation for more info! There are
other template en"ines available in the contributions
repositor/ 4e!"! )H)Template5!
Drupal themes used to be coded directl/ in )H)! This
method is still available, but is harder to use and maintain
than template+based themes!
P4PTemplate theme engine
)H)Template is a theme en"ine 2ritten b/ Adrian
Cossou2 42ho is also behind the theme reforms in Drupal
$!55!
9t uses individual something+tp!+php files to theme
Drupal Handbook: 20 April 2005 7?&
DrupalDs theme_something() functions! DrupalDs
themeable functions are documented on the Development
)lumbin" site! Hver/ file contains an HT<0 skeleton 2ith
some simple )H) statements for the d/namic data! Thus,
)H)Template is an ecellent choice for themin" if /ou
kno2 a bit of )H): 2ith some basic )H) snippets, /ou can
create advanced themes easil/!
9f /ou donDt kno2 )H), then )H)Template can still be a
"ood choice because onl/ small bits of code are involved!
The/ can Fust be cop/Jpasted into /our template!
An etended 6orum discussion provides some of the
reasonin" behind the creation of )H)Template!
"nstalling P4PTemplate
The en"ine that runs )H)Template is not included in the
default installation of Drupal! To use themes that use
)H)Template 4e!"! -oN"re/, >ubrick, )ersian5 /ou must
have the )H)Template en"ine installed! To set this up:
Do2nload the latest release of the )H)Template
Hn"ine
'pload this folder into the
drupalNbaseJthemesJen"ines director/ on /our site!
Kou 2ill no2 be able to use and confi"ure )H)Template
themes!
Creating a ne* P4PTemplate
To create a ne2 )H)Template, create a ne2 director/
under /our themes director/, for eample
themes.mytheme! Then, /ou need to create a file called
page+tp!+php in that director/!
This is the onl/ file 2hich is absolutel/ reIuired! 9t
overrides the theme('page') function, 2hich outputs the
final pa"e contents, alon" 2ith all the etra decorations
like a header, tabs, breadcrumbs, sidebars and a footer!
Kou can create files to override the follo2in" functions:
theme('page') 4pa"e!tpl!php5: theme a pa"e
theme('!oc(') 4block!tpl!php5: theme a block in
sidebar
Drupal Handbook: 20 April 2005 7?3
theme('o$') 4bo!tpl!php5: theme a "eneric
container for the main area
theme('comment') 4comment!tpl!php5: theme a
comment
theme('node') 4node!tpl!php5: theme a node
The )H)Template packa"e contains eample template
files for all of these! *impl/ cop/ them into /our
theme.mytheme director/ and edit them! ;ote that /ou 2ill
need to visit administer _ themes for )H)Template to
refresh its cache and reco"ni=e an/ ne2 +tp!+php files!
9f /ou 2ant to theme a function other than the defaults
listed here, /ou need to provide an override /ourself!
&lock.tpl.php
0a/s out content for blocks 4left andJor ri"ht side of pa"e5!
This template is optional, and can be overridden b/
cop/in" the default template and modif/in" it!
A/ailable /ariables
Wblock 4obFect5
Wblock+_module : The name of the module that
"enerated the block!
Wblock+_delta : The number of the block, in the
module!
Wblock+_subFect : The block title!
Wblock+_content : The html content for the
block!
Wblock+_status : *tatus of block 40, or 15!
Wblock+_path : The path that matches 2hether
or not a block is displa/ed!
Wblock+_re"ion : 0eft 405, or Ci"ht415 column!
Wblock+_throttle: Throttle settin"!
WseIid : The seIuential id of the block displa/ed, ie:
The first block is 1, the second block is 2 etc!
WblockNseIid : The same as WseIid, but is reset for
the left and ri"ht sidebars!
W=ebra : ,ether or not the block is odd , or even!
This is useful for creatin" D=ebra stripesD 2ith /our
css! This value 2ill be either DoddD, or DevenD!
WblockN=ebra : The same as W=ebra, but is reset for
Drupal Handbook: 20 April 2005 7&0
the left and ri"ht sidebars!
Default template
The default !oc(+tp!+php, 2hich can be found at
themesJen"inesJphptemplateJblock!tpl!php!
<div c!ass=*<?php print *!oc( !oc(3$!oc(3
&modu!e* ?&* id=*<?php print *!oc(3$!oc(3
&modu!e3$!oc(3&de!ta*; ?&*&
<h,&<?php print $!oc(3&su2ect ?&<.h,&
<div c!ass=*content*&<?php print $!oc(3&content
?&<.div&
<.div&
&o-.tpl.php
)rints a simple html bo around a pa"e element! 6or
instance: The comment vie2 options are surrounded b/
o$+tp!+php!
A/ailable /ariables
Wtitle: The title of the bo!
Wcontent: The content of the bo!
Wre"ion: Ce"ion! main, left or ri"ht!
Default template
<div c!ass=*o$*&
<h,&<?php print $tit!e ?&<.h,&
<div c!ass=*content*&<?php print $content ?
&<.div&
<.div&
Comment.tpl.php
Define the HT<0 for a comment block! This doesnDt have
an/thin" to do 2ith comment threadin", Fust the actual
comment!
A/ailable /ariables
Wne2 : Translated tet for Dne2D, if the comment is
Drupal Handbook: 20 April 2005 7&1
infact ne2!
Wcomment4obFect5 : (omment obFect as passed to the
themeNcomment function!
Wsubmitted : Translated post information strin"!
Wtitle : 0ink to the comment title!
Wpicture : 'ser picture HT<0 4include Va_ ta"!5 , if
displa/ is enabled and picture is set!
Wlinks : (ontetual links belo2 comment!
Wcontent : (ontent of link!
Wauthor : 0ink to author profile!
Wdate : 6ormatted date for post!
Default template
<div c!ass=*comment <?php print ($comment3&ne/) ?
'comment3ne/' % '' ?&*&
<?php if ($comment3&ne/) % ?&
<a id=*ne/*&<.a&
<span c!ass=*ne/*&<?php print $ne/ ?&<.span&
<?php endif; ?&
<div c!ass=*tit!e*&<?php print $tit!e ?&<.div&
<?php print $picture ?&
<div c!ass=*author*&<?php print $sumitted ?
&<.div&
<div c!ass=*content*&<?php print $content ?
&<.div&
<?php if ($picture) % ?&
<r c!ass=*c!ear* .&
<?php endif; ?&
<div c!ass=*!in(s*&<?php print $!in(s ?&<.div&
<.div&
7ode.tpl.php
This template controls the displa/ of a node, and a node
summar/!
A/ailable /ariables
Wtitle : Title of node!
WnodeNurl : 0ink to node!
Wterms : HT<0 for taonom/ terms!
Wname : 6ormatted name of author!
Wdate : 6ormatted data!
Wstick/ : True if the node is stick/ on the front pa"e!
Drupal Handbook: 20 April 2005 7&2
Wpicture : HT<0 for user picture, if enabled!
Wcontent : ;ode content, teaser if it is a summar/!
Wlinks : ;ode links!
Wtaonom/ 4arra/5 : arra/ of taonom/ terms!
Wnode 4obFect5 : The node obFect!
Wmain : This variable is set to 1 if the node is bein"
displa/ed on the main pa"e, 0 other2ise!
Wpa"e : True if on the node vie2 pa"e, and not a
summar/!
Wsubmitted : Translated tet, if the node info displa/
is enabled for this node t/pe!
Default template
<div c!ass=*node<?php print ($stic(y) ? *
stic(y* % **; ?&*&
<?php if ($page == ?)% ?&
<h,&<a href=*<?php print $node_ur! ?&*
tit!e=*<?php print $tit!e ?&*&<?php print $tit!e ?
&<.a&<.h,&
<?php endif; ?&
<?php print $picture ?&
<div c!ass=*info*&<?php print $sumitted ?&<span
c!ass=*terms*&<?php print $terms ?&<.span&<.div&
<div c!ass=*content*&
<?php print $content ?&
<.div&
<?php if ($!in(s)% ?&
<?php if ($picture)% ?&
<r c!ass='c!ear' .&
<?php endif; ?&
<div c!ass=*!in(s*&<?php print $!in(s ?&<.div&
<?php endif; ?&
<.div&
Page.tpl.php
This template defines the main skeleton for the pa"e!
A/ailable /ariables
headNtitle: The tet to be displa/ed in the pa"e title!
lan"ua"e: The lan"ua"e the site is bein" displa/ed
in!
site: The name of the site, al2a/s filled in!
Drupal Handbook: 20 April 2005 7&7
head: HT<0 as "enerated b/ drupalN"etNhtmlNhead45
4needed to d/namicall/ add scripts to pa"es5
onloadNattributes: .nload ta"s to be added to the
head ta", to allo2 for autoeecution of attached
scripts!
director/: The director/ the theme is located in , ie:
themesJboN"re/ or themesJboN"re/JboNcleanslate
lo"o: The path to the lo"o ima"e, as defined in theme
confi"uration!
siteNname: The site name of the site, to be used in
the header, empt/ 2hen displa/ has been disabled!
siteNslo"an: The slo"an of the site, empt/ 2hen
displa/ has been disabled!
searchNbo: True415 if the search bo has been
enabled!
searchNurl: 'C0 the search form is submitted to!
searchNbuttonNtet: Translated tet on the search
button!
searchNdescription: Translated description for the
search button!
title: Title, different from headNtitle, as this is Fust
the node title most of the time!
primar/Nlinks 4arra/5: An arra/ containin" the links
as the/ have been defined in the phptemplate
specific confi"uration block!
secondar/Nlinks 4arra/5: An arra/ containin" the
links as the/ have been defined in the phptemplate
specific confi"uration block!
breadcrumb: HT<0 for displa/in" the breadcrumbs
at the top of the pa"e!
tabs: HT<0 for displa/in" tabs at the top of the
pa"e!
messa"es: HT<0 for status and error messa"es, to
be displa/ed at the top of the pa"e!
la/out: This settin" allo2s /ou to st/le different
t/pes of la/out 4DnoneD, DleftD, Dri"htD or DbothD5
differentl/, dependin" on ho2 man/ sidebars are
enabled!
help: D/namic help tet, mostl/ for admin pa"es!
st/les: CeIuired for st/lesheet s2itchin" to 2ork!
This prints out the st/le ta"s reIuired!
mission: The tet of the site mission!
isNfront: True if the front pa"e is currentl/ bein"
Drupal Handbook: 20 April 2005 7&$
displa/ed! 'sed to to""le the mission!
sidebarNleft: The HT<0 for the left sidebar!
content: The HT<0 content "enerated b/ Drupal to
be displa/ed!
sidebarNri"ht: The HT<0 for the ri"ht sidebar!
footerNmessa"e: The footer messa"e as defined in
the admin settin"s!
closure: ;eeds to be displa/ed at the bottom of the
pa"e, for an/ d/namic Favascript that needs to be
called once the pa"e has alread/ been displa/ed!
Default template
Here is the contents of the boN"re/ templateDs
page+tp!+php, to "ive /ou an idea of the la/out of the file!
<ZHCB;PKA htm! KIM=8B *3..O@B..H;H LE;1= 1+?
:trict..A9*
*http%..///+/@+org.;G.$htm!1.H;H.$htm!13
strict+dtd*&
<htm! $m!ns=*http%..///+/@+org.1YYY.$htm!*
$m!%!ang=*en*&
<head&
<tit!e&<?php print $tit!e ?&<.tit!e&
<meta http3e7uiv=*Bontent3:ty!e3;ype*
content=*te$t.css* .&
<?php print $head ?&
<?php print $sty!es ?&
<.head&
<ody <?php print theme(*on!oad_attriute*); ?&&
<div id=*header*&
<?php if ($search_o$)% ?&
<form action=*<?php print ur!(*search*) ?&*
method=*post*&
<div id=*search*&
<input c!ass=*form3te$t* type=*te$t*
si4e=*16* va!ue=** name=*(eys* .&<input
c!ass=*form3sumit* type=*sumit* va!ue=*<?php
print t(*:earch*)?&* .&
<.div&
<.form&
<?php endif; ?&
<?php if ($!ogo) % ?&
<a href=*<?php print ur!() ?&* tit!e=*8nde$
Kage*&<img src=*<?php print($!ogo) ?&*
a!t=*=ogo* .&<.a&
<?php endif; ?&
Drupal Handbook: 20 April 2005 7&5
<?php if ($site_name) % ?&
<h1 id=*site3name*&<a href=*<?php print ur!
() ?&* tit!e=*8nde$ Kage*&<?php print
($site_name) ?&<.a&<.h1&
<?php endif;?&
<?php if ($site_s!ogan) % ?&
<span id=*site3s!ogan*&<?php print
($site_s!ogan) ?&<.span&
<?php endif;?&
<r c!ass=*c!ear* .&
<.div&
<div id=*top3nav*&
<?php if (is_array($secondary_!in(s)) % ?&
<u! id=*secondary*&
<?php foreach ($secondary_!in(s as $!in()% ?&
<!i&<?php print $!in(?&<.!i&
<?php endforeach; ?&
<.u!&
<?php endif; ?&
<?php if (is_array($primary_!in(s)) % ?&
<u! id=*primary*&
<?php foreach ($primary_!in(s as $!in()% ?&
<!i&<?php print $!in(?&<.!i&
<?php endforeach; ?&
<.u!&
<?php endif; ?&
<.div&
<ta!e id=*content*&
<tr&
<?php if ($sidear_!eft Z= **)% ?&
<td c!ass=*sidear* id=*sidear3!eft*&
<?php print $sidear_!eft ?&
<.td&
<?php endif; ?&
<td c!ass=*main3content* id=*content3<?php
print $!ayout ?&*&
<?php if ($tit!e Z= **)% ?&
<h, c!ass=*content3tit!e*&<?php print
$tit!e ?&<.h,&
<?php endif; ?&
<?php if ($tas Z= **)% ?&
<?php print $tas ?&
<?php endif; ?&
<?php if ($mission Z= **)% ?&
<p id=*mission*&<?php print $mission ?
&<.p&
<?php endif; ?&
<?php if ($he!p Z= **)% ?&
Drupal Handbook: 20 April 2005 7&%
<p id=*he!p*&<?php print $he!p ?&<.p&
<?php endif; ?&
<?php if ($messages Z= **)% ?&
<div id=*message*&<?php print
$messages ?&<.div&
<?php endif; ?&
<Z33 start main content 33&
<?php print($content) ?&
<Z33 end main content 33&
<.td&<Z33 mainBontent 33&
<?php if ($sidear_right Z= **)% ?&
<td c!ass=*sidear* id=*sidear3right*&
<?php print $sidear_right ?&
<.td&
<?php endif; ?&
<.tr&
<.ta!e&
<?php if ($readcrum Z= **)% ?&
<?php print $readcrum ?&
<?php endif; ?&
<div id=*footer*&
<?php if ($footer_message) % ?&
<p&<?php print $footer_message;?&<.p&
<?php endif; ?&
Ra!idate <a
href=*http%..va!idator+/@+org.chec(.referer*&LE;1=
<.a& or <a href=*http%..2igsa/+/@+org.css3
va!idator.chec(.referer*&B::<.a&+
<.div&<Z33 footer 33&
<?php print $c!osure;?&
<.ody&
<.htm!&
Alternati/e templates for different node
types.
There are times 2hen /ou ma/ 2ant to create a static
pa"e 2ithin Drupal such as an GaboutG pa"e, help pa"es
and the like! .bviousl/ for these, /ou donDt 2ant the title,
author links, or indeed an/thin" ecept the pa"e content!
To accomplish this, cop/ /our node!tpl!php to node+
Wt/pe!tpl!php! 9n the case of a static pa"e, /ou 2ould cop/
/our node!tpl!php file to node+pa"e!tpl!php!
The path module 2ill then allo2 /ou to t/pe in Gclean
'C0sG like GaboutG, GbioG, etc!
Drupal Handbook: 20 April 2005 7&?
This feature 2as added to the last release of the $!5
release of )H)Template, so make sure that /our
phptemplate is current if this doesnDt 2ork for /ou!
8aking additional /ariables a/ailable to
your templates
Hamples from this forum discussion! The Whook refers to
the area the variable is to be used in 4e!"! for
comment!tpl!php, it 2ould be GcommentG5!
This function needs to be defined in a temp!ate+php file,
2hich is placed inside the template director/ 4for
instance : themes.o$_c!eans!ate.temp!ate+php5
/ote: 3or these changes to ta#e effect. you need to
load the admin%themes page first.
<?php
function _phptemp!ate_varia!es($hoo(' $vars) {
s/itch($hoo() {
case 'comment' %
$vars['ne/var'" = 'ne/ varia!e';
$vars['tit!e'" = 'ne/ tit!e';
rea(;
)
return $vars;
)
?&
The output of this function is mer"ed 2ith the variables
returned from phptemplateNcomment, so /ou can easil/
adFust 2hichever variables /ou feel necessar/!
Kour comment+tp!+php file 2ill no2 have a ne2 variable
available in it
called Wne2var! *imilarl/ the Wtitle variable 2ill be
overridden 2ith the value specified in
the function!
A neat trick is to count ho2 man/ times each of the hooks
is called, so /ou can pass an etra variable! re :
<?php
function _phptemp!ate_varia!es($hoo(' $vars) {
static $count;
$count = is_array($count) ? $count % array();
$count[$hoo(" = is_int($count[$hoo(") ? $count
Drupal Handbook: 20 April 2005 7&&
[$hoo(" % 1;
$vars['4era'" = ($count[$hoo(" \ ,) ?'odd' %
'odd';
$vars['se7id'" = $count[$hoo("WW;
return $vars;
)
?&
That is DevenD if it is an even number, and DoddD if it is odd!
This means /ou do =ebra stripin" 4ie: alternatin" colors5
for each of /our nodes J blocks J comments J 2hatever!
Then /ou can set up a some st/les for class`DW=ebraD ,
2hich handle the alternatin" colors!
Another eample is a fla" to sho2 us if 2e are lookin" at a
node! <i"ht be hand/ for renderin" items different, 2hen
someone is lookin" at an article!
<?php
function _phptemp!ate_varia!es($hoo(' $vars) {
s/itch ($hoo() {
case 'page'%
if (arg(?) == 'node' ## is_numeric(arg(1))
## arg(,) == '') {
$vars['content_is_node'" = ;GIA;
)
rea(;
)
return $vars;
)
?&
;ote that the s2itch is kind of obsolete here, but i leave it
here, because /ou mi"ht 2ant to add more variables! 9n
that case /ou need them!
The ar"s45 checks 2ill see if /ou have an url like J
nodeJ;9DJ and not like JnodeJ;9DJedit or Jnode! 9f that is
found, 2e set the fla" TC'H!
'/erriding other theme functions
9f /ou 2ant to override a theme function not included in
the basic list 4block, bo, comment, node, pa"e5, /ou need
to tell )H)Template about it!
Drupal Handbook: 20 April 2005 7&3
To do this, /ou need to create a temp!ate+php file in /our
themeDs director/! This file should contain the reIuired
VEphp E_ ta"s, alon" 2ith stubs for the theme overrides!
These stubs instruct the en"ine 2hat template file to use
and 2hich variables to pass to it!
6irst, /ou need to locate the appropriate theme function to
override! Kou can find a list of these in the A)9
documentation! ,e 2ill use theme_item_!ist() as an
eample!
The function definition for theme_item_!ist() looks like
this:
<?php
function theme_item_!ist($items = array()' $tit!e
= 9I==) {
?&
;o2 /ou need to place a stub in /our themeDs
temp!ate+php, like this:
<?php
.FF
F Batch the theme_item_!ist function' and redirect
through the temp!ate api
F.
function phptemp!ate_item_!ist($items = array()'
$tit!e = 9I==) {
.. Kass to phptemp!ate' inc!uding trans!ating
the parameters to an associative array+ ;he
e!ement names are the names that the varia!es
.. /i!! e assigned /ithin your temp!ate+
return _phptemp!ate_ca!!ac(('item_!ist'' array
('items' =& $items' 'tit!e' =& $tit!e));
)
?&
,e replaced the 2ord theme in the function name 2ith
phptemp!ate and used a call to _phptemp!ate_ca!!ac(()
to pass the parameters 4$items and $tit!e5 to
)H)Template!
;o2, /ou can create a item_!ist+tp!+php file in /our
themeDs director/, 2hich 2ill be used to theme item lists!
This function should follo2 the same lo"ic as the ori"inal
theme_item_!ist()!
;ote that /ou 2ill need to visit admininster _ themes for
Drupal Handbook: 20 April 2005 730
)H)Template to refresh its cache and reco"ni=e the ne2
file! -e"innin" 2ith version $!%, this is not necessar/
an/more!
A &C3'$C and A3TC$ e-ample of
'/erriding the User Profile Pages using
P4PTemplate
This description 9llustrates ho2 eas/ it is to override
theme functions! 9Dm ver/ ver/ ne2 to php and sIl, but
even 9 mana"ed to 2ork out ho2 to customi=e ho2 user
profile pa"es appear b/ overridin" the theme function!
&efore
This is ho2 the out+of+the+bo user profile looks like, 2ith
etra profile fields, such as (it/, (ountr/, )ostcode,
)osition etc! added in! 4please note that i couldnDt fit teh
2hole pa"e into the one screenshot!!there is an etra
Gback"roundJmore info!G field that doesnDt sho2 in the
-H6.CH screen shot!
click to vie2 the -H6.CH screenshot in a ne2 2indo2
After
This is ho2 the eact same user profile looks after
overridin" the theme and appl/in" a simple
user_profi!e+t!p+php file in m/ theme director/!
click to vie2 the A6THC screenshot in a ne2 2indo2
<ore details ^ discussion on this is in the ori"inal forum
post!
Protecting content from non%logged in
users *hen using phptemplate o/errides
This is a useful tip, especiall/ for desi"ners or ne2bies to
php 2ho 2ant to unleash the po2er of drupal ^ the po2er
of (**, la/outs 2hile protectin" content intended for
0o""ed 9n users onl/!
Drupal Handbook: 20 April 2005 731
Using P4PTemplate '/errides *ith
protected content
)H)template is superb, in m/ opinion! 9 particularl/ like
the abilit/ to override specific la/outs, but, 2hen /ou
override the theme function /ou also overrideJb/pass
permission settin"s ++ it doesnDt pass throu"h an/ user
access la/er in Drupal! Which is important to #now if
your drupal site has content that is intended for
logged in users only.
C-ample
9n the eample belo2, 9 2anted to override the 2a/ a 'ser
)rofile is displa/ed!
Access to vie2 'ser )rofiles 2as set under AD<9;9*THC
+_ '*HC* +_ (.;69#'CH +_ )HC<9**9.;* so that onl/
lo""ed in 'sers could vie2 a user profile!
After the pa"e la/out override 2as implemented, an/one
could see profile pa"es b/ "uessin" a link like ?=user.Y>Y
for eample!
olution
To "et around that problem 4and after a lot of pla/in"
around5 9 came up 2ith the follo2in" solution, i!e! check to
see if the user is lo""ed in -H6.CH invokin" /our
phptemplate override! 9tDs remarkabl/ simple, no2 that 9
have 2orked it out, but, 9 thou"ht it 2ould be 2orth
sharin" on here as there ma/be other drupal site
administrators like me 2ho are as thick as a plank of 2ood
and do not have a lot of eperiece in )H) pro"rammin"!
9 have pasted eample code belo2 that "oes in the
template!php file in the themes folder 2hich invokes an
override and loads a custom userNprofile!tpl!php 2hich
overrides the 2a/ a user profile is displa/ed!
<?php
.FF
F chec( if the user is !ogged in efore invo(ing
the temp!ate override
F.
g!oa! $user;
Drupal Handbook: 20 April 2005 732
if($user3&uid) .. chec( to see if the user is
!ogged in
{
function phptemp!ate_user_profi!e($user' $fie!ds =
array()) {
.. Kass to phptemp!ate' inc!uding trans!ating
the parameters to an associative array+ ;he
e!ement names are the names that the varia!es
.. /i!! e assigned /ithin your temp!ate+
.F potentia! need for other code to e$tract
fie!d info F.
return _phptemp!ate_ca!!ac(('user_profi!e'' array
('user' =& $user' 'fie!ds' =& $fie!ds));
)
)
?&
Theme nippets $epository
Have some cool )H) to include some2here in the
)H)Template en"ine to make it do tricksE (reate a book
pa"e belo2 and include /our code!
Custom ,ogin
This creates a little custom lo"in area! 9f /ou are lo""ed in,
it displa/s /our username and a link to /our profile,
other2ise it includes a Ce"ister and minimal 0o"in area! 9t
2as developed for .ur<edia!
<?php if ($user3&uid) % ?&
=ogged in as% <?php print !($user3
&name''user.'+$user3&uid); ?& ]
<?php print !(*!ogout*'*!ogout*); ?&
<?php e!se % ?&
<?php print !(*Gegister*'*user.register*); ?& ]
=ogin% <form
action=*user.!ogin* method=*post*&<input
type=*hidden*
name=*edit[destination"* va!ue=*user* .&<input
type=*te$t*
ma$!ength=*-5* c!ass=*form3te$t* name=*edit[name"*
id=*edit3name*
si4e=*16* va!ue=** .&<input type=*pass/ord*
c!ass=*form3pass/ord*
Drupal Handbook: 20 April 2005 737
ma$!ength=*-5* name=*edit[pass"* id=*edit3pass*
si4e=*16* va!ue=**
.&<input type=*sumit* name=*op* va!ue=*=og in* .
&<.form&
<?php endif; ?&
Temporaril/ on the dev 2iki until someone can "et it
posted here!
Themeing 3le-inode 1e-ample2
*ince it took me a 2hile to make sense of this 9 thou"ht 9
2ould post an eample to help others alon" the 2a/! 9tDs
actuall/ Iuite simple, Fust not ver/ intuitive!
This eample is for chan"in" the 2a/ that the fleinode
DdateJtimeD field 2ill displa/ on a pa"e! 49 onl/ 2anted
month and /ear to sho25! -ut could ver/ easil/ be adapted
to other thin"s!
</ theme is called DliccD + it is a phptemplate theme!
The 9uick 6ersion
9n the director/ for /our phptemplate theme 4this could be
an eistin" or custom theme5, create the follo2in" 2 files!
6or me the files 2ere put in DthemesJliccD!
Create template.php
*omethin" like this:
<?php
.FF
F Cverride theme_f!e$inode_timestamp() from
modu!es.f!e$inode.fie!d_timestamp+inc
F.
function phptemp!ate_f!e$inode_timestamp
($fie!d_id' $!ae!' $va!ue' $formatted_va!ue) {
.. nothing happens here+
return _phptemp!ate_ca!!ac(
('f!e$inode_timestamp'' array('fie!d_id' =&
$fie!d_id' '!ae!' =& $!ae!' 'va!ue' =& $va!ue'
'formatted_va!ue' =& $formatted_va!ue));
)
?&
Drupal Handbook: 20 April 2005 73$
Create fle-inodeFtimestamp.tpl.php
*omethin" like this:
<?php
$formatted_va!ue = strftime (*\M \P*' $va!ue); ..
format as 1onth and Pear' eg+ 'Nu!y ,??5'
?&
<div c!ass=*f!e$inode3timestamp3<?php print
$fie!d_id; ?&*&
<strong&<?php print $!ae!; ?&% <.strong&<r .&
<?php print $formatted_va!ue; ?&
<.div&
ThatDs itL 1ust modif/ the second file so that the field is
displa/ed the 2a/ /ou 2ould like!
/ote: that /ou 2ill need to visit administer _ themes for
)H)Template to refresh its cache and reco"ni=e an/ ne2 !
tpl!php files!
-elo2 is the lon"+2inded version, read on if /ou are
interested!!!
The ,ong 6ersion
I. find the theme function for the fle-inode field
6ound in modulesJfleinodeJfieldNtimestamp!inc
<?php
function theme_f!e$inode_timestamp($fie!d_id'
$!ae!' $va!ue' $formatted_va!ue) {
$output = theme('form_e!ement'' $!ae!'
$formatted_va!ue);
$output = '<div c!ass=*f!e$inode3timestamp3'+
$fie!d_id +'*&'+ $output +'<.div&';
return $output;
)
?&
This is Fust for reference, /ou could Fust as easil/ look in
the A)9 documentation! (ore documentation is here:
http:JJdrupaldocs!or"JapiJheadJ"roupJthemeable
4onl/ core modules seem to be online at the moment, so
/ou 2ill need to search throu"h the code for an/ add+on
modules like fleinode5
9f /ou 2anted to theme fleinode Dima"eD fields, /ou 2ould
Drupal Handbook: 20 April 2005 735
need to look for the theme function in
modulesJfleinodeJfieldNima"e!inc
?. Create template.php and add o/erride function
6or m/ theme 9 created themesJliccJtemplate!php and then
copied the function declaration from above replacin" the
2ord DthemeD 2ith DphptemplateD!
<?php
function phptemp!ate_f!e$inode_timestamp
($fie!d_id' $!ae!' $va!ue' $formatted_va!ue) {
)
?&
add in the phptemplate callback:
<?php
return _phptemp!ate_ca!!ac(
('f!e$inode_timestamp'' array('fie!d_id' =&
$fie!d_id' '!ae!' =&
$!ae!' 'va!ue' =& $va!ue' 'formatted_va!ue' =&
$formatted_va!ue));
?&
This function doesnDt reall/ NdoN an/thin" ecept "ive
phptemplate control over the displa/ of this field, the net
step looks after the actual formattin"! ;ote ho2 the
variables are passed on to the NphptemplateNcallback45 in
an associative arra/!
/ote: do not use the ke/ DfileD in the callback arra/, as it
causes problems for phptemplate! This is a value used for
the ima"e field in particular! This is 2hat 9 did 4for the
ima"e field5 to "et around this problem 4see Dim"fileD used
instead of DfileD5
<?php
.FF
F Cverride theme_f!e$inode_image() from
modu!es.f!e$inode.fie!d_image+inc
F.
function phptemp!ate_f!e$inode_image($fie!d_id'
$!ae!' $fi!e' $formatted_va!ue) {
.. empty 'stu' function
return _phptemp!ate_ca!!ac(('f!e$inode_image''
array('fie!d_id' =& $fie!d_id' '!ae!' =& $!a
e!' 'imgfi!e' =& $fi!e' 'formatted_va!ue' =&
$formatted_va!ue));
Drupal Handbook: 20 April 2005 73%
)
?&
H. Create fle-inodeFtimestamp.tpl.php to do
formatting
This "oes in /our theme director/ 4for me
themesJliccJfleinodeNtimestamp!tpl!php5! As /ou can see
the name matches the bit after DphptemplateND in the
theme override function, and the first ar"ument of the
NphptemplateNcallback45!
)ut the HT<0J)H) that /ou 2ant in this file for the displa/
of all dateJtime 4timestamp5 fields in all fleinode pa"es!
*omethin" like this:
<div c!ass=*f!e$inode3timestamp3<?php print
$fie!d_id; ?&*&
<strong&<?php print $!ae!; ?&% <.strong&<r .&
<?php print $formatted_va!ue; ?&
<.div&
C-ample 3iles
template.php
<?php
.FFF
F temp!ate+php
F
F ;his fi!e contains functions for over3riding the
defau!t theme functions
F in Hrupa! core and modu!es (!oo( at the <K8
documentation for more info)+
F ;he functions don't actua!!y _do_ anything'
e$cept pass the varia!es
F avai!a!e to phptemp!ate for use in the
F+tp!+php fi!es+
F
F <dd simi!ar 'stu' functions to override other
defau!t theme functions+
F.
.FF
F Cverride theme_f!e$inode_timestamp() from
modu!es.f!e$inode.fie!d_timestamp+inc
F.
Drupal Handbook: 20 April 2005 73?
function phptemp!ate_f!e$inode_timestamp
($fie!d_id' $!ae!' $va!ue' $formatted_va!ue) {
.. !i(e 8 said' nothing happens here+
return _phptemp!ate_ca!!ac(
('f!e$inode_timestamp'' array('fie!d_id' =&
$fie!d_id' '!ae!' =& $!ae!' 'va!ue' =& $va!ue'
'formatted_va!ue' =& $formatted_va!ue));
)
?&
fle-inodeFtimestamp.tpl.php
<?php
.FFF
F Bustomised formatting of f!e$inode timestamp
data in nodes+
F ;hese fie!ds are avai!a!e%
F $fie!d_id' $!ae!' $va!ue' $formatted_va!ue
FF.
.. Bhange the defau!t $formatted_va!ue so that it
suits me (no time or day)
$formatted_va!ue = strftime (*\M \P*' $va!ue); ..
format as 1onth and Pear' eg+ 'Nu!y ,??5'
?&
<div c!ass=*f!e$inode3timestamp3<?php print
$fie!d_id; ?&*&
<strong&<?php print $!ae!; ?&% <.strong&<r .&
<?php print $formatted_va!ue; ?&
<.div&
5Template theme engine
The 8Template theme s/stem uses templates to la/out and
st/le ,eb pa"es! 9t separates logic 4)H)5, structure
48HT<0JHT<05, and style 4(**5, makin" it eas/ for
desi"ners to create or modif/ templates b/ 2orkin" on
8HT<0JHT<0 and (** 2ithout havin" to 2orr/ about an/
)H) codin"!
8Template templates are directories, 2hich contain all the
8HT<0JHT<0, (**, ima"e and 1ava*cript files that a
template uses! Templates are located in the themes
director/ of a Drupal installation:
.themes.
Drupal Handbook: 20 April 2005 73&
.nce a template eists in the themes director/, 8Template
auto+detects it, and makes it available for selection to
administrators:
administer 3& themes
Drupal is distributed 2ith t2o 8Template templates
included + Bluemarine and 1ushbutton!
Althou"h 8Template is still supported as part of the core,
it ma/ not be in the future, for several reasons! This 2ill
not necessaril/ mean the end of 8Template since it ma/ be
maintained as an alternative contributed en"ine like
)H)Template!
Creating a ne* 5Template
To make a ne2 8Template template, create a director/ in
/our Drupal installation at this location:
.themes.
,hatever /ou name the ne2 director/ 2ill be used as the
name of /our ne2 template, for instance:
.themes.remrant
.nce /ou create a template in this director/, it 2ill appear
on the theme selection pa"e as the GrembrantG template!
The easiest 2a/ to create a ne2 template is to make a
cop/ of an eistin" template, such as Default or
)ushbutton, and start makin" chan"es to the files!
The onl/ file reIuired in a template director/ is
0template.0tmpl, 2hich is a re"ular HT<0 or 8HT<0 file
containin" some 8Template ta"s that Drupal substitutes
2ith content 2hen a pa"e is served! The template!tmpl
file can be edited in Dream,eaver, #o0ive, --Hdit or an/
other application /ou use to 2ork on HT<0J8HT<0!
All other files in the template are optional, and are linked
to from the template!tmpl file! These can include (**,
ima"e or 1ava*cript files, and should all be included in the
template director/ to make the template eas/ to maintain
and portable bet2een Drupal installations!
;ote that if /ou name /our st/lesheet sty!e+css, it 2ill
automaticall/ be picked up b/ Drupal, and /ou 2ill not
Drupal Handbook: 20 April 2005 733
need to add an eplicit Simport or <!in( .& for it! 9f /ou
make a subdirector/ 2ithin /our template, containin"
another sty!e+css file, then the subdirector/ becomes a
ne2 theme, usin" the 8HT<0 from the first template, but
2ith a different st/lesheet!
Template &asics
Template creates ,eb pa"es b/ substitutin" place holder
ta"s in a template, the template!tmpl file, 2ith content
from the database!
There are t2o kinds of template place holder ta"s, section
ta"s and item ta"s!
ection Tags
*ection ta"s deal 2ith the structure of a ,eb pa"e,
markin" areas of the pa"e, and are 8HT<0JHT<0
comment ta"s 2hich look like this:
<Z33 MAQ89% tit!e 33&
<Z33 A9H% tit!e 33&
*ome section ta"s mark areas 2ere the content, and itDs
structure, 2ill be repeated! 6or instance the comment
section ma/ be repeated more than once dependin" on
ho2 man/ comments are on a pa"e:
<Z33 MAQ89% comment 33&
<Z33 A9H% comment 33&
*ection ta"s can be nested, so that one set of section ta"s
can be contained b/ annother:
<Z33 MAQ89% node 33&
<Z33 MAQ89% tit!e 33&
<Z33 A9H% tit!e 33&
Drupal Handbook: 20 April 2005 $00
<Z33 A9H% node 33&
"tem Tags
9tem ta"s are place holders for content items, such as the
title of a pa"e, 2ho the pa"e 2as submitted b/, or the
main content of a pa"e! 9tem ta"s look like this:
{tit!e)
{sumitted)
{content)
9tem ta"s are associated 2ith the section ta" that
surrounds them, for instance:
<Z33 MAQ89% node 33&
{tit!e)
<Z33 A9H% node 33&
The PtitleQ ta" above is the main title of a pa"e, 2hile the
PtitleQ ta" belo2 is the title for the comments on a pa"e!
<Z33 MAQ89% comment 33&
{tit!e)
<Z33 A9H% comment 33&
4eader ection
The ection
The Template Header section starts and ends 2ith these
ta"s
<Z33 MAQ89% header 33&
<Z33 A9H% header 33&
DonDt confuse the Header section 2ith the 8HT<0JHT<0
Drupal Handbook: 20 April 2005 $01
Vhead_ element! Althou"h the Vhead_ element is
included in the Header section, it also holds the top part of
the ,eb pa"e + the area desi"ners usual/ refer to as the
GHeaderG, 2hich usuall/ consists of a hori=ontal bar 2ith
the siteDs lo"o and some navi"ation links!
Prolog
The ,(7 recommends that all 8HT<0 documents should
start 2ith an 8<0 prolo" specif/in" the encodin" of the
document, for instance:
<?$m! version=*1+?* encoding=*utf3>*?&
'nfortunatel/ there are man/ bro2sers that handle the
8<0 prolo" badl/, and either crash, fail to displa/ the
pa"e, or displa/ it incorrectl/! 9t is therefore
recommended to leave out the 8<0 prolo", and specif/
encodin" in a (ontent+T/pe element in the Vhead_ of /our
template 42hich Drupal does automaticall/5!
D'CT@PC
The D.(TK)H element tells a bro2ser t2o thin"s, 2hich
8<0 lan"ua"e the document is usin", and 2here the DTD
4Document T/pe Declaration5 of that lan"ua"e is located!
This is an eample of a D.(TK)H element:
<ZHCB;PKA htm! KIM=8B *3..O@B..H;H LE;1= 1+? :trict..A9*
*http%..///+/@+org.;G.$htm!1.H;H.$htm!13strict+dtd*&
There should be absolutel/ nothin" in /our document
before the D.(TK)H or 8<0 prolo"! The Template ta"
VL++ -H#9;: header ++_ is .>, as it 2ill be removed b/
Drupal before sendin" the pa"e to the bro2ser, but make
sure to remoe spaces or line brea#s bet2een this and
the D.(TK)H or 8<0 prolo" elements, or /ou ma/ "et
unepected results in some bro2sers!
To learn more about the D.(TK)H element, and 2hich
version 2ould suit /our needs best, read:
6i Kour *ite ,ith the Ci"ht D.(TK)HL
b/ 1effre/ eeldman
Drupal Handbook: 20 April 2005 $02
MheadFtitleN
(ontent of the Vtitle_ element! 'sed as the 2indo2 title
b/ bro2sers, and as the pa"e title in search en"ine
listin"s!
MheadN
6illed in 2ith the follo2in":
<meta http3e7uiv=*Bontent3;ype* content=*te$t.htm!;
charset=utf3>* .&
<ase href=*http%..yoursite+com.* .&
<sty!e type=*te$t.css* media=*a!!*&
Simport ur!(misc.drupa!+css);
<.sty!e&
MstylesN
Declarations for the current st/le:
<sty!e type=*te$t.css* media=*a!!*&Simport
*themes.!uemarine.sty!e+css*;<.sty!e&
Add this ta" to allo2 /our template to take advanta"e of
the Drupal theme s/stemDs st/le+s2itchin" abilit/! ;ote
that, if /ou have a default st/lesheet, it should be named
sty!e+css and be located in the same director/ as /our
$temp!ate+$tmp! file!
MonloadFattributesN
The pa"e attributes for the Vbod/_ ta"!
MlogoN
The lo"o section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% !ogo 33&
<Z33 A9H% !ogo 33&
The filename for the site lo"o, confi"urable b/ the
Administrator in the tet bo in the Drupal theme
administration section! 4Displa/ of this item is optional!5
Drupal Handbook: 20 April 2005 $07
MsiteFnameN
The site name section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% site_name 33&
<Z33 A9H% site_name 33&
The current site name, confi"ured b/ the Administrator in
the tet bo G;ameG on Drupal pa"e:
administer3&settings
4Displa/ of this item is optional!5
MsiteFsloganN
The site slo"an section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% site_s!ogan 33&
<Z33 A9H% site_s!ogan 33&
The current site slo"an, confi"ured b/ the Administrator in
the tet bo G*lo"anG on Drupal pa"e:
administer3&settings
4Displa/ of this item is optional!5
MsecondaryFlinksN MprimaryFlinksN
These ta"s hold 2hatever the Administrator inputs into the
tet boes G*econdar/ links:G and G)rimar/ linksG in the
Drupal theme administration section! 9f the Administrator
does not specif/ an/ G)rimar/ linksG, Drupal 2ill
automaticall/ "enerate a set of links based on the
currentl/+enabled modules!
The Administrator could use these ta"s to input links to
the main sections of the site, the title of the site, a site
messa"e, an ima"e or an/thin" else the/ reIuire!
Drupal Handbook: 20 April 2005 $0$
earch &o-
The *earch -o section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% search_o$ 33&
<Z33 A9H% search_o$ 33&
MsearchFurlN
The form action: GsearchG
MsearchFdescriptionN
The alt tet description of the search tet bo: GHnter the
terms /ou 2ish to search for!G
MsearchFbuttonFte-tN
The value of the search submit button: G*earchG
8ission
The <ission section be"ins and ends 2ith these ta"s:
VL++ -H#9;: mission ++_
VL++ H;D: mission ++_
MmissionN
The tet of the site mission statement, appears onl/ on the
Home )a"e, and is confi"ured b/ the Administrator in the
tet bo G<issionG on Drupal pa"e:
administer3&settings
Title
The Title section be"ins and ends 2ith these ta"s:
VL++ -H#9;: title ++_
VL++ H;D: title ++_
Drupal Handbook: 20 April 2005 $05
MtitleN
The title of the node
Tabs
The Tabs section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% tas 33&
<Z33 A9H% tas 33&
MtabsN
Dra2s the Drupal Glocal tasksG for the current pa"e!
MbreadcrumbN
The breadcrumb trail of the pa"e, the path from Home
)a"e to the current pa"e!
4elp
The Help section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% he!p 33&
<Z33 A9H% he!p 33&
MhelpN
(ontains an/ help information 2hich eists for a particular
pa"e!
8essage
The <essa"e section be"ins and ends 2ith these ta"s:
<Z33 MAQ89% message 33&
<Z33 A9H% message 33&
Drupal Handbook: 20 April 2005 $0%
<essa"e appears 2hen Drupal confirms the results of an
action b/ the user, for instance after updatin" or deletin"
a pa"e!
MmessageN
The tet of the messa"e!
7ode ection
The 7ode ection
The node section 4template!tmpl5 contains the main
content of the pa"e, and be"ins and ends 2ith these ta"s:
<Z33 MAQ89% node 33&
<Z33 A9H% node 33&
MstickyN
*ets the class to Gnode stick/G if a node is GstickiedG at the
top of lists! 4i!e! if a teaser for the pa"e is al2a/s to be
displa/ed on the home pa"e5 9f the node has not been set
to be stick/, the class is set to Gnode G!
Picture
)icture contains an ima"e representin" the user 2ho
posted the content of a node, the ima"e is linked to the
posterDs profile! This is also sometimes called an GavatarG!
)icture be"ins and ends 2ith these ta"s:
<Z33 MAQ89% picture 33&
<Z33 A9H% picture 33&
MpictureN
.utputs the follo2in":
<a href=*user.1* tit!e=*Rie/ user profi!e+*&
Drupal Handbook: 20 April 2005 $0?
<img src=*http%..///+yoursite.fi!es.pictures.picture31+gif*
a!t=*Isername's picture* .&<.a&
Title
The title of the main content of the pa"e 4node5, ta"s be"in
and end:
<Z33 MAQ89% tit!e 33&
<Z33 A9H% tit!e 33&
.n a node pa"e, the title is output as:
<h1 c!ass=*tit!e*&9ode ;it!e<.h1&
.n the Home )a"e, each node title is output as:
<h, c!ass=*tit!e*&<a href=*node.@1*
&9ode ;it!e<.a&<.h,&
MlinkN
.utputs the link to the node , GnodeJ71G in the eample
above!
MtitleN
.utputs the tet of the node title, G;ode TitleG in the
eample above!
MsubmittedN
The username of the person 2ho submitted the node
content, outputs:
:umitted y <a href=*user.1* tit!e=*Rie/ user profi!e+*
&Isername<.a& on 1- Deruary' ,??5 3 ,@%5-+
Ta-onomy
A list of links to taonomies 2hich the node belon"s to,
ta"s be"in and end:
<Z33 MAQ89% ta$onomy 33&
Drupal Handbook: 20 April 2005 $0&
<Z33 A9H% ta$onomy 33&
Mta-onomyN
.utputs a taonom/ term that the node belonds to:
Va href`Gtaonom/JtermJ70G_Taonom/ TermVJa_
McontentN
The main content of the node!
,inks
The control options for the node: Gprinter+friendl/
versionG, Gadd ne2 commentG,
and the visitor histor/ of the node! Ta"s be"in and end:
<Z33 MAQ89% !in(s 33&
<Z33 A9H% !in(s 33&
MlinksN
.utputs the follo2in" 4dependin" on the vie2erDs
permisions5:
<a href=*oo(.print.>*
tit!e=*:ho/ a printer3friend!y version of this oo( page
and its su3pages+*&printer3friend!y version<.a& ]
<a href=*comment.rep!y.>0comment*
tit!e=*:hare your thoughts and opinions re!ated to this
posting+*
&add ne/ comment<.a& ]
<a href=*admin.statistics.!og.node.>*&--, reads<.a&
Comment
The Comment ection
The comment section 4template!tmpl5 contains all the
comments associated 2ith a node, and be"ins and ends
2ith these ta"s:
Drupal Handbook: 20 April 2005 $03
<Z33 MAQ89% comment 33&
<Z33 A9H% comment 33&
The content of this section creates the code for a sin"le
comment, and is automatical/ repeated for as man/ times
are there are comments!
A/atar
Avatar contains an ima"e representin" the user 2ho
posted the content of a node, the ima"e is linked to the
posterDs profile! Avatar be"ins and ends 2ith these ta"s:
<Z33 MAQ89% avatar 33&
<Z33 A9H% avatar 33&
Ma/atarN
.utputs the follo2in":
<div c!ass=*avatar*&
<a href=*user.1* tit!e=*Rie/ user profi!e+*&
<img src=*http%..///+drupa!+site.fi!es.avatars.avatar31+2pg*
a!t=*username's avatar* .&
<.a&
<.div&
Title
The title of a comment! Ta"s be"in and end:
<Z33 MAQ89% tit!e 33&
<Z33 A9H% tit!e 33&
MlinkN
9f reIuired, chan"es the comment title into a link to the
comment! 'sed 2hen displa/in" comments in certain
vie2s!
Drupal Handbook: 20 April 2005 $10
MtitleN
The tet of the comment title!
ubmitted
MsubmittedN
Displa/s the username of the comment poster, linked to
their profile, and the date and time the comment 2as
posted! This is the output:
*ubmitted b/ Va href`GuserJ10G title`G:ie2 user
profile!G_usernameVJa_ on <on, 0$J13J200& + 11:5%!
7e*
9ndicates if a comment is ne2! Ta"s be"in and end:
<Z33 MAQ89% ne/ 33&
<Z33 A9H% ne/ 33&
Mne*N
Adds the 2ord Gne2G to a comment!
Content
Displa/s the content of a comment!
McontentN
The comment tet!
,inks
Displa/s control links for comment, such as Grepl/G,
GdeleteG, and GeditG! Ta"s be"in and end:
<Z33 MAQ89% !in(s 33&
<Z33 A9H% !in(s 33&
Drupal Handbook: 20 April 2005 $11
MlinksN
Displa/s the control links!
&locks
The ection
The blocks section contains the column of boes 2hich can
be used to displa/ various navi"ation and feature options,
such as 3orum Topics, Blogs, Who8s Dnline, and
!yndicate! -locks sections can be confi"ured to appear
on the left or ri"ht of a pa"e, or on both sides! The section
be"ins and ends 2ith this code:
<Z33 MAQ89% !oc(s 33&
<Z33 A9H% !oc(s 33&
MblocksN
This ta" is replaced b/ 2hatever blocks have been
s2itched on in the Administration pa"e
4adminJs/stemJblock5!
&lock
The block section defines the structure of each block, note
the DsD in blockJblocks!
<Z33 MAQ89% !oc( 33&
<Z33 A9H% !oc( 33&
MmoduleN
The name of the module 2hoDs block is bein" displa/ed,
this is added to a (** class and 9D 2hich can be used
customise the look of the block!
MdeltaN
Adds a number to the 9D of a block, so that each block has
a uniIue 9D even if a module displa/s more than one block!
Drupal Handbook: 20 April 2005 $12
MtitleN
The title of the block!
McontentN
The content of a block!
3ooter
The 3ooter ection
The footer section appears at the ver/ bottom of each
pa"e, itDs content can be specified b/ the Administrator
4adminJsettin"s5! The section be"ins and ends 2ith this
code:
<Z33 MAQ89% footer 33&
<Z33 A9H% footer 33&
8essage
This area holds the mark+up around the messa"e posted b/
the Administrator! The section be"ins and ends 2ith this
code:
<Z33 MAQ89% message 33&
<Z33 A9H% message 33&
MfooterFmessageN
Displa/s the actual content defined throu"h the field
G6ooter messa"eG in the G*ettin"sG Administration pa"e
4adminJsettin"s5!
MfooterN
.utputs footer messa"es "enerated b/ Drupal modules!
4i!e! performance statistics from devel!module5
Drupal Handbook: 20 April 2005 $17
Cditing !ith Goli/e
et Up
To edit Template template files 4template!tmpl5 in
Adobe #o0ive, follo2 these simple steps:
9n the #o0ive menu select G#o0iveG then G,eb
*ettin"sG
The ,eb *ettin"s 2indo2 2ill appear, click on the
G6ile <appin"sG ta"!
9n the 6ile <appin"s 2indo2 open the GtetJG
director/
*croll do2n until /ou see GhtmlG in the *uffi
column!
(lick on GhtmlG to select it, then click on the GXG
button to create a duplicate!
(han"e the suffi of the duplicate html to GGtmplG
ThatDs it /ouDre doneL
Cditing
9f 2hen openin" a template file #o0ive asks /ou 2hich
encodin" to use, select G'T6+&G!
9f all /ou see after openin" a template is Gbod/ onload+
attributesG, "o into source mode and delete
GPonloadNattributesQG from:
<ody{on!oad_attriutes)&
Cemember to add GPonload+attributesQG back once /ou are
finished editin"!
9n template!tmpl, /ou ma/ 2ish to add the follo2in" line
temporaril/:
<!in( type=*te$t.css* re!=*sty!esheet* href=*sty!e+css* .&
Cemember to remove this line 2hen completin" 2ork on
the template, ho2ever! 9f /ou do not, Drupal 2ill not be
able to s2itch bet2een various st/les for /our theme!
Drupal 2ill automaticall/ load /our st/le!css, if one eists,
in the Pst/lesQ ta"!
Drupal Handbook: 20 April 2005 $1$
Plain P4P themes
)H) themes are the most direct 2a/ of themein" Drupal!
A )H) theme consists of overrides for DrupalDs built+in
theme functions! Kou 2ill most likel/ onl/ override the
basic theme hooks 4pa"es, nodes, blocks, !!!5, but /ou can
theme an/thin" from lists to links if /ou desire!
To create a )H) theme, create a director/ in /our themes
director/ 42e 2ill assume themes.mytheme in this
document5, and inside that director/ create a
mytheme+theme file! This file is a re"ular )H) file, so make
sure it contains VEphp E_ ta"s!
The default theme functions in Drupal are all named
theme_something() or theme_modu!e_something(), thus
allo2in" an/ module to add themeable parts to the default
set provided b/ Drupal! *ome of the basic theme functions
include: theme_error() and theme_ta!e() 2hich as their
name su""ests, return HT<0 code for an error messa"e
and a table respectivel/! Theme functions defined b/
modules include theme_forum_disp!ay() and
theme_node_!ist()!
9n /our !theme file, /ou can override an/ of these
functions! To override the function theme_something(),
define the function mytheme_something() in /our !theme
file! This function should have the same definition as the
ori"inal! 9t is easiest to start 2ith DrupalDs function, and
appl/ /our chan"es there: man/ theme functions contain
code lo"ic 2ithin them! To avoid problems 2hen
up"radin" Drupal in the future, it is best to mark the
chan"es bet2een the ori"inal Drupal function and /our
customi=ed version! That 2a/, /ou can reappl/ to /our
customi=ations if the ori"inal 2as chan"ed!
Aside from theme functions, there is one function that /ou
need to include, called mytheme_features()! This function
should return an arra/ of strin"s, markin" the features
/our theme supports 4e!"! search bo, lo"o, mission
statement, !!!5! The theme s/stem 2ill provide to""les and
settin"s for these features in the administration section! 9n
/our code, /ou can retrieve the value of these settin"s
thou"h theme_get_setting()! 9f /ou are plannin" on
releasin" /our theme to the public, it is advised to
Drupal Handbook: 20 April 2005 $15
implement all Drupal features, so others can customi=e
/our theme!
Available features are:
lo"o
A lo"o can be used! The theme should check the
settin"s defau!t_!ogo 4boolean5 and !ogo_path
4strin"5!
to""leNlo"o The lo"o can be turned onJoff
to""leNname The site name can be turned onJoff
to""leNsearch The search bo can be turned onJoff
to""leNslo"an The site slo"an can be turned onJoff
to""leNmission The mission statement can be turned onJoff
to""leNprimar/Nli
nks
The primar/ navi"ation bar can be turned onJoffJ
to""leNsecondar/
Nlinks
The secondar/ navi"ation bar can be turned onJoff
to""leNnodeNuser
Npicture
The theme can optionall/ displa/ user pictures net to
nodes
to""leNcommentN
userNpicture
The theme can optionall/ displa/ user pictures net to
comments
HereDs the _features() function from the standard
chame!eon+theme:
<?php
function chame!eon_features() {
return array(
'!ogo''
'togg!e_name''
'togg!e_s!ogan''
'togg!e_primary_!in(s''
'togg!e_secondary_!in(s');
)
?&
;ote that unlike templates and st/les, themes are tied to
their director/ name! 9f /ou 2ant to clone a )H) theme,
/ou need to rename its director/, its !theme file and its
functions inside the !theme file!
uggestions for theme coding style
Zfrom the cvs lo" messa"e of a developer sick of fiin"
stran"e spacin" and indentation[
Drupal Handbook: 20 April 2005 $1%
it 2ould be nice if theme authors 2ould care a little more
about spacin" and indentation! Fust as 2e have rules for
indentin" code + because this makes it easier to
understand, maintain, and be correct, the same should
appl/ for themes and included html! some hints:
indent 2ith 2 spaces
match the indentation of 4lon"5 openin" and closin"
block html ta"s
distin"uish bet2een php and html indentation! not
function header($tit!e = **) {
<?
<ZHCB;PKA E;1= KIM=8B *3..O@B..H;H E;1=
5+?1..A9*
*http%..///+/@+org.;G.htm!5.strict+dtd*&
<htm! +++&
+++
but
function header($tit!e = **) {
?&
<ZHCB;PKA E;1= KIM=8B *3..O@B..H;H E;1=
5+?1..A9*
*http%..///+/@+org.;G.htm!5.strict+dtd*&
<htm! +++&
+++
this not onl/ saves the superfluous leadin" spaces,
but also makes it much easier to find matchin"
openin" and closin" ta"s defined in functions 2ith
different indentation!
prefer php in html over html in php! not
function node($node' $main = ?) {
print *Un<Z33 node% U$node3&tit!eU 33
&Un*;
print *<div c!ass=U*nodetit!eU*&$node3
&tit!e<.div&*;
print *<div c!ass=U*nodeodyU*&<span
c!ass=UnodedateU&* + $this3&!in(s(
array(format_name($node)' format_date
($node3&created' *sma!!*)' *#amp;nsp;*)
) + *<.span&*;
but
function node($node' $main = ?) {
?&
Drupal Handbook: 20 April 2005 $1?
<Z33 node% *<?php print $node3&tit!e; ?
&* 33&;
<div c!ass=*nodetit!e*&<?php print
$node3&tit!e; ?&<.div&
<div c!ass=*nodeody*&
<span c!ass=*nodedate*&<?php print
$this3&!in(s( array(format_name($node)'
format_date($node3&created' *sma!!*)'
*#amp;nsp;*) ); ?&<.span&
after all, )H) is a HT<0 embedded scriptin"
lan"ua"e + and not the other 2a/ round !!!
Tips for designing themes in Dream*ea/er+
Go,i/e etc.
An 8template+in+#o0ive ho2+to is available at
http:JJdrupal!or"JnodeJ%%7$
Dream*ea/er
Dream2eaver can edit /our )H), template and (** files
Fust find and in some cases 48Template, )H)TA05 2ith
"raphical previe2!
6ind /our Dream2eaver confi"uration files,
11Hocument;ypes+$m! and A$tensions+t$t! 2here the/
are depends on 2hat platform /ou are usin" + the 6ind file
finction is /our friend here!
"n C-tensions.t-t
(han"e the line endin" in
% <!! Hocuments
to include
;<='L;1K='1CHI=A';EA1A'A9Q89A
0ike2ise, add ;<='L;1K= to the line endin" in % E;1=
fi!es
and
1CHI=A';EA1A'A9Q89A to the % KEK fi!es line!
Drupal Handbook: 20 April 2005 $1&
"n 88DocumentTypes.-ml
/ou like2ise 2ant to add tal and tmpl file t/pes to the file
time descriptions, e!"! chan"e the line be"in"in"
documenttype id=*E;1=* to be
<documenttype id=*E;1=* interna!type=*E;1=*
/infi!ee$tension=*htm'htm!'shtm!'shtm'stm'tp!'!ass
o'$htm!'ta!'$tmp!*
macfi!ee$tension=*htm'htm!'shtm!'shtm'tp!'!asso'$h
tm!'ta!'$tmp!* fi!e=*Hefau!t+htm!*
/riteyteordermar(=*fa!se*&
and like2ise add !theme, !module and !en"ine to the
appropriate section
<documenttype id=*KEK_1y:J=* servermode!=*KEK
1y:J=* interna!type=*Hynamic*
/infi!ee$tension=*php'php@'php5'theme'modu!e'engin
e*
macfi!ee$tension=*php'php@'php5'theme'modu!e'engin
e* fi!e=*Hefau!t+php* /riteyteordermar(=*fa!se*&
;o2, #o an edit /our local cop/ of /our site in
Dream2eaver!
Updating your themes
As Drupal develops 2ith each release it becomes
necessar/ to update themes to take advanta"e of ne2
features and sta/ functional 2ith DrupalDs theme s/stem!
Con/erting H.G themes to 4.G
$e(uired changes
Changes in class definition
Theme class definition uses no2 a different s/nta:
9nstead
c!ass ;heme e$tends Mase;heme {
/ou should use
c!ass ;heme_themename e$tends Mase;heme {
2here themename is name of /our theme in lo2ercase!
Drupal Handbook: 20 April 2005 $13
Changes in function header12
6unction header45 takes no2 an optional parameter
Wtitle!
9nstead
function header() {
/ou should use
function header($tit!e = **) {
)reviousl/ all pa"es in Drupal site had the fied pa"e
title: sitename + site slo"an! ;o2 the pa"e title can
be d/namic + for eample 2hen displa/in" sin"le
node, the pa"e title can be note title + sitename! *o,
instead
print varia!e_get(*site_name*' *drupa!*) +* 3 *+
varia!e_get(*site_s!ogan*' **);
/ou should use a more comple s/nta:
if ($tit!e) {
print $tit!e +* 3 *+ varia!e_get(*site_name*'
*drupa!*);
)
e!se {
print varia!e_get(*site_name*' *drupa!*) +* 3 *+
varia!e_get(*site_s!ogan*' **);
)
of if /ou 2ant to use compact version of the same
construction:
print $tit!e ? $tit!e+* 3 *+ varia!e_get
(*site_name*' *drupa!*) %
varia!e_get(*site_name*' *drupa!*) +* *+
varia!e_get(*site_s!ogan*' **);
This piece of code checks if Wtitle is present! 9f /es, it
outputs Wtitle and site name, if not, it outputs site
name and slo"an!
9f /ou used themeNaccount45 function 42hat outputs
lo"inJmembership bo5 in header45, please remove it!
0o"in bo placement is controlled in Administration
_ blocks pa"e from no2 on and themeNaccount45 is
no lon"er used!
Drupal Handbook: 20 April 2005 $20
Changes in function node12
formatNname45 accepts no2 parameter Wnode, not
Wnode+_name! Also Wnode+_timestamp is replaced
2ith Wnode+_created! *o, instead
print strtr(t(*:umitted y \a on \*)' array(*\a*
=& format_name($node->name)' *\* =& format_date
($node->timestamp)));
/ou should use
print strtr(t(*:umitted y \a on \*)' array(*\a*
=& format_name($node)' *\* =& format_date($node-
>created)));
nodeNinde45 is no lon"er used because Drupal $!0
has more sophisticated classification s/stem than
Drupal 7!0 meta ta"s! *o instead plain simple
print node_inde$($node);
/ou have to use
$terms = array();

if (function_e$ists(*ta$onomy_node_get_terms*)) {
foreach (ta$onomy_node_get_terms($node3&nid) as
$term) {
$terms[" = !($term3&name' array(*or* =& $term3
&tid)' *inde$*);
)
)
print $this3&!in(s($terms);
6unction linkNnode45 accepts an optional parameter
Wmain! 9nstead
if ($main) {
print $this3&!in(s(!in(_node($node));
)
/ou should use
if ($!in(s = !in(_node($node' $main)) {
print $this3&!in(s($!in(s);
)
Changes in function comment()
format_name() accepts no/ parameter $comment' not
Drupal Handbook: 20 April 2005 $21
$comment3&name+ 8nstead
print strtr(t(*:umitted y \a on \*)' array(*\a*
=& format_name($comment->name)' *\* =& format_date
($comment3&timestamp)));
you shou!d use
print strtr(t(*:umitted y \a on \*)' array(*\a*
=& format_name($comment)' *\* =& format_date
($comment3&timestamp)));
Changes in function footer()
8f you used theme_account() function (/hat outputs
!ogin.memership o$) in footer() function' p!ease
remove it+ =ogin o$ p!acement is contro!!ed in
Administration > blocks page from no/ on and
theme_account() is no !onger used+
Optional changes
New function: system()
Cptiona!!y theme can have a system() function /hat
provides info aout theme and its author%
function system($fie!d) {
$system[*name*" = *theme name*;
$system[*author*" = *author name*;
$system[*description*" = *description of the
theme*;
return $system[$fie!d";
)
Converting 4.0 themes to 4.1
e!uire" changes
;here is no re7uired changes' a!! Hrupa! 5+? themes shou!d
a!so /or( in Hrupa! 5+1
Optional changes
theme#hea"
Drupal Handbook: 20 April 2005 $22
8nsert a function theme_head() inside your theme' right
after the E;1='s #!t;head#gt; tag%
<htm!&
<head&
<?php print theme_head(); ?>
+++
;his change a!!o/s modu!es to incorporate custom mar(up
inside #!t;head#gt; #!t;.head#gt; tags such as Navascript'
#!t;meta#gt; tags' B:: and more+
Converting 4.1 themes to 4.$
e!uire" changes
%"" a theme#onloa"#attri&ute() to a '&o"y(
tag:
<ody <?php print theme_onload_attribute(); ?> &
Optional changes
)a*e a"vantage of settings() hoo*
;hemes can no/ popu!ate settings to adminstration pages
using the function <em&themename<.em&_settings()+ A$amp!e%
function mytheme_settings() {
$output = form_se!ect(*:idear p!acement*'
*mytheme_sidear*'
varia!e_get(*mytheme_sidear*' *right*)'
array(
*none* =& t(*9o sidears*)'
*!eft* =& t(*:idear on the !eft*)'
*right* =& t(*:idear on the right*));
)
+irect you site logo to in"e,.php
8f you theme has the !ogo and you have made it to !in( #!t;a
href=**#gt; or even #!t;a href=*#!t;?php print path_uri();
#gt;*#gt; then p!ease rep!ace these instances /ith a simp!e
#!t;a href=*inde$+php* a!t=**#gt;
Drupal Handbook: 20 April 2005 $27
Cne additiona! change may e needed+ Ising a custom theme
adapted from a generic one' the origina! node function has
the fo!!o/ing code%
<?php
$terms = array();
if (function_e$ists(*ta$onomy_node_get_terms*)) {
if ($terms = ta$onomy_node_get_terms($node3&nid)) {
$ta$!in(s = array();
foreach ($terms as $term) {
$ta$!in(s[" = !($term3&name' array(*or* =&
$term3&tid)' *inde$*);
)
$ta$o = $this3&!in(s($ta$!in(s);
)
)
?&
Ohich gaves an error on the inde$ page after upgrading from
5+1 to 5+, and contains inva!id IG=s+ Gep!acing the aove
code /ith this fi$es the error+
<?php
$terms = array();
if (modu!e_e$ist(*ta$onomy*)) {
$terms = ta$onomy_!in((*ta$onomy terms*' $node);
)
$ta$o = $this3&!in(s($terms);
?&
Converting 4.$ themes to 4.-
9o changes are re7uired %)
< fe/ more B:: c!asses are avai!a!e to you if you /ish to
use them+ < non3e$haustive !ist is
read-more% affects the formatting of the 'read more'
!in(
cell-highlight: affects the ce!! in the ta!e header
/hich is current!y the sort (ey+ this ce!! a!so has an
image /hich you can override in your theme3&image
directory (most images are overrida!e in this /ay)+
Converting 4.- themes to 4.4
Dor more information on ho/ the interaction et/een themes
and modu!es has changed' see converting 5+@ modu!es to 5+5+
;he theme system is no !onger ui!t on KEK's o2ect
mode!+ ;he Mase;heme c!ass is no more and' as such'
you no !onger have to use a c!ass for your theme+
Drupal Handbook: 20 April 2005 $2$
8nstead' a theme is a co!!ection of functions+ ;his
/i!! ma(e Hrupa! theme deve!opment fee! much the same
as Hrupa! modu!e deve!opment+ Krefi$ your theme
function /ith your theme's name+ A$amp!es%
mytheme_page()' mytheme_comment()' mytheme_node()+
mytheme%%system() (or in the ne/ par!ance'
mytheme_system()) is no !onger used+ ;he theme
description used on the theme administration page
shou!d instead e returned y a ne/ function ca!!ed
mytheme_he!p()+ ;his function fo!!o/s the same
semantics as the regu!ar modu!e _he!p hoo(%
<?php
function mytheme_he!p($section) {
s/itch ($section) {
case 'admin.system.themes0description'%
return t(*< description of mytheme*);
)
)
?&
<!! theme functions no/ return their output instead of
printing them to the user+ ;here shou!d e no print or
echo statements in your theme+
;he mytheme_header() and mytheme_footer() functions
and no !onger used' a mytheme_page() function is
introduced instead+
<?php
function mytheme_page($content' $tit!e = 9I=='
$readcrum = 9I==) {
if (isset($tit!e)) {
drupa!_set_tit!e($tit!e);
)
if (isset($readcrum)) {
drupa!_set_readcrum($readcrum);
)
+++
)
?&
;his function shou!d return the E;1= code for the fu!!
page' inc!uding the header' footer and sidears (if
any)+ 9ote that it is important to set the tit!e and
the readcrums for Hrupa! /ith the setter functions
as suggested aove' instead of 2ust using the va!ues
provided as parameters+ ;his /ay modu!es acting on the
tit!e or readcrum va!ues can use the rea! va!ue /hen
generating !oc(s for e$amp!e+
;hemes no/ have the responsii!ity of p!acing the
tit!e' readcrum trai!' status messages' and he!p
te$t for each page+ ;his gives them the f!e$ii!ity
to' for e$amp!e' p!ace the readcrum trai! aove the
tit!e or in the footer+ 8t is no/ e$pected that
mytheme_page() /i!! return these e!ements+ ;he page
theme function shou!d override the tit!e and
readcrum trai! retrieved from Hrupa!' in case some
e$p!icit va!ue is provided in the function parameters
(see aove)+ < theme can otain the va!ues set efore
Drupal Handbook: 20 April 2005 $25
y ca!!ing the functions drupa!_get_tit!e()'
drupa!_get_messages()' menu_get_active_he!p()' and
drupa!_get_readcrum()+ ;he readcrum trai! is
returned from the !atter function as an array of
!in(s; it can e formatted into a string y using
theme(*readcrum*' drupa!_get_readcrum())+ 1ost
themes use the fo!!o/ing ne/ code3snippet in their
page function%
<?php
if ($tit!e = drupa!_get_tit!e()) {
$output += theme(*readcrum*' drupa!_get_readcrum
());
$output += *<h,&$tit!e<.h,&*;
)
if ($he!p = menu_get_active_he!p()) {
$output += *<div c!ass=U*he!pU*&$he!p<.div&<hr .&*;
)
foreach (drupa!_get_messages() as $message) {
!ist($message' $type) = $message;
$output += *<strong&*+ t(*:tatus*) +*<.strong&%
$message<hr .&*;
)
?&
;he _head() hoo( is e!iminated and rep!aced /ith the
drupa!_set_htm!_head() and drupa!_get_htm!_head()
functions' therefore the E;1= head part shou!d inc!ude
the return va!ue of drupa!_get_htm!_head() instead of
the return va!ue of theme(*head*)+
;he theme_node() function ta(es an e$tra parameter
no/' $page' that indicates to the theme /hether to
disp!ay the node as a standa!one page or not+ 8f $page
is true' then the tit!e of the node shou!d not e
printed' as it /i!! a!ready have een printed y
theme_page+ <!so note that the node ody /i!! on!y e
fi!tered /ith the configured fi!ters if the node page
is disp!ayed+ Cther/ise on!y the teaser /i!! e
fi!tered for performance reasons+ A$amp!e%
<?php
function mytheme_node($node' $main = ?' $page = ?) {
if (Z$page) {
$output = *<h,&* + $node3&tit!e + *<.h,&*;
)
if ($main ## $node3&teaser) {
$output += *<div&*+ $node3&teaser + *<.div&*;
)
e!se {
$output += *<div&*+ $node3&ody + *<.div&*;
)
return $output;
)
?&
;o improve !oc( themeai!ity' theme_!oc(() has een
changed+ ;he o!d
function theme_!oc(($su2ect' $content' $region =
*main*)
Drupal Handbook: 20 April 2005 $2%
has ecome
function theme_!oc(($!oc()
/ith $!oc( eing an o2ect containing $!oc(3
&su2ect' $!oc(3&content' etc+ :ee the do$ygen doc
for detai!s and for ho/ you can sty!e !oc(s /ith B::+
<!so' theme_!oc(s() has een improved to a!!o/ themes
to hoo( into (change) the !oc(s efore outputting
them+ :ee this cvs !og message for detai!s+
fooo ar
Converting 4.4 themes to 4..
Note: the theme sstem changed significantl in !"#" $a%e
sure ou read through this entire guide& as an outdated
theme 'ill pre(ent ou from accessing (ital parts of our
site"
+irectory structure
;emp!ates are no/ seen as themes unto themse!ves' rather
than hiding ehind their temp!ate engine+ ;emp!ate engines
no/ reside in sudirectories of themes.engines' /hi!e
temp!ates simp!y are p!aced in sudirectories of themes+
;emp!ate engines compati!e /ith Hrupa! 5+6 /i!! identify
temp!ates ased on their fi!ename and send the appropriate
!istings to the theme system+
)or *template templates& our template must be named
*template"*tmpl& and our default stlesheet must be named
stle"css (as mentioned belo' in the +,tles+ section)"
Dor e$amp!e' the o!d Ltemp!ate pushutton temp!ate has moved
from themes.$temp!ate.pushutton to themes.pushutton+
)a&s (a.*.a. /ocal )as*s)
Hrupa! no/ separates out menu items that are *!oca! tas(s*;
functions to e performed on the current !ocation+ My
defau!t' these are rendered as a set of tas+ ;hemes are
responsi!e for printing these+ < typica! !ocation is e!o/
the page tit!e' so that
<?php
if ($tit!e = drupa!_get_tit!e()) {
$output += theme(*readcrum*' drupa!_get_readcrum());
$output += *<h,&$tit!e<.h,&*;
)
if ($he!p = menu_get_active_he!p()) {
Drupal Handbook: 20 April 2005 $2?
$output += *<sma!!&$he!p<.sma!!&<hr .&*;
)
?&
ecomes
<?php
if ($tit!e = drupa!_get_tit!e()) {
$output += theme(*readcrum*' drupa!_get_readcrum());
$output += *<h,&$tit!e<.h,&*;
)
if ($tas = theme('menu_!oca!_tas(s')) {
$output += $tas;
)
if ($he!p = menu_get_active_he!p()) {
$output += *<sma!!&$he!p<.sma!!&<hr .&*;
)
?&
Dor $temp!ate temp!ates' Before:
<Z33 MAQ89% tit!e 33&
{readcrum)
<h1 c!ass=*tit!e*&{tit!e)<.h1&
<Z33 A9H% tit!e 33&
After:
<Z33 MAQ89% tit!e 33&
{readcrum)
<h1 c!ass=*tit!e*&{tit!e)<.h1&
<Z33 MAQ89% tas 33&
<div c!ass=*tas*&{tas)<.div&
<Z33 A9H% tas 33&
<Z33 A9H% tit!e 33&
0tatus 1essages
;he theme_page function is no !onger responsi!e for
rendering each status message+ 8nstead' /e no/ use the
theme_status_messages() function+ Before:
<?php
foreach (drupa!_get_messages() as $message) {
!ist($message' $type) = $message;
$output += *<strong&*+ t(*:tatus*) +*<.strong&%
$message<hr .&*;
)
?&
After:
<?php
$output += theme_status_messages();
Drupal Handbook: 20 April 2005 $2&
?&
0tatic vs. 0tic*y
8n Hrupa! 5+6' *static* posts have een renamed as *stic(y*
posts+ 8f your theme uses specia! sty!ing for this type of
post' you'!! /ant to change any references from *static* to
*stic(y*+
%vatar vs. 2ser 3icture
8n Hrupa! 5+6' *avatars* have een renamed to *user
pictures*+ <dditiona!!y' the method y /hich themes disp!ay
avatars has changed+ ;hemes no/ ca!! theme_user_picture'
/hich returns the appropriate image and !in( E;1=+ Before:
<?php
if (modu!e_e$ist(*profi!e*) ## varia!e_get
(*theme_avatar_node*' ?)) {
$avatar = $node3&profi!e_avatar;
if (empty($avatar) ]] Zfi!e_e$ists($avatar)) {
$avatar = varia!e_get(*theme_avatar_defau!t*' **);
)
e!se {
$avatar = fi!e_create_ur!($avatar);
)
if ($avatar) {
$avatar = *<img src=U*$avatarU* a!t=U** + t(*\user's
avatar*' array(*\user* =& $node3&name ? $node3&name % t
(varia!e_get(*anonymous*' *<nonymous*)))) + *U* .&*;
if ($node3&uid) {
$avatar = !($avatar' *user.vie/.$node3&uid*' array
(*tit!e* =& t(*Rie/ user profi!e+*)));
)
$output += $avatar;
)
)
?&
After:
<?php
$output += theme('user_picture'' $node);
?&
Dor $temp!ate temp!ates' simp!y rep!ace%
<Z33 MAQ89% avatar 33&
<div c!ass=*avatar*&{avatar)<.div&
<Z33 A9H% avatar 33&
/ith%
<Z33 MAQ89% picture 33&
Drupal Handbook: 20 April 2005 $23
{picture)
<Z33 A9H% picture 33&
)heme 0creenshots
;he ne/ theme se!ector !oo(s for a screenshot of each theme
/ith the fi!ename screenshot+png in each directory+
:creenshots are optiona! and themes /ithout screenshots /i!!
simp!y disp!ay *no screenshot* on theme se!ection pages+ ;o
create a screenshot /hich matches those in core' fo!!o/
these instructions%
=og in as administrator user+
Ana!e the fo!!o/ing modu!es' for some e$tra menu
items%
aggregator' !og' node' page' story' trac(er
Breate the fo!!o/ing story node%
title: Honec fe!is eros' !andit non+
bod: 1ori id !acus+ Atiam ma!esuada diam ut
!iero+ :ed !andit' 2usto nec euismod !aoreet'
nunc nu!!a iacu!is e!it' vitae+ Honec do!or+
B!ass aptent taciti socios7u ad !itora tor7uent
per conuia nostra' per inceptos hymenaeos+
Rivamus vestiu!um fe!is <a href=*0*&nec !iero+
Huis !oortis<.a&+ Bum sociis nato7ue penatius
et magnis dis parturient montes' nascetur
ridicu!us mus+ 9unc venenatis pretium magna+
Honec dictum u!trices massa+ Honec vestiu!um
porttitor purus+ 1auris nih !igu!a' porta non'
porttitor sed' fermentum id' do!or+ Honec eu
!ectus et e!it porttitor rutrum+ <enean 2usto+
Khase!!us augue tortor' mattis nonummy' a!i7uam
euismod' cursus eget' ipsum+ :ed u!tricies
iendum ante+ 1aecenas rhoncus tincidunt eros+
=oo( at the node' and ma(e sure the tas are visi!e+
;a(e a screenshot+
But out a piece aout 5,?$,65 resi4ed to 16?$Y? (@6\
4oom)+ ;ry to sho/ usefu! page e!ements (menu' tas'
tit!e' !in(s)+
<pp!ied a p!ain 'sharpen' fi!ter to the thumnai!+
:ave as *screenshot+png* in theme (or sty!e)
directory+
Centrali4e" )heme Configuration
;he theme system no/ has the ai!ity to store certain common
configuration items for each theme+ Eo/ever' some themes may
not /ish to uti!i4e a!! of these settings' so a
theme_features hoo( has een introduced+ 8n each theme .
theme engine' this function shou!d return an array of
settings /hich the theme supports+ ;o imp!ement each of
these functions' themes . theme engines shou!d ca!! the
theme_get_setting function' /hich /i!! return data regarding
the administrator's setting for this partic!uar theme+ 8f
Drupal Handbook: 20 April 2005 $70
there are no settings for the current theme' g!oa! va!ues
/i!! e returned+ Me!o/ is a ta!e of va!ues for the
_features hoo(' a description of their function' and a code
snippet of the appropriate theme_get_settings ca!!+
_features
hoo# alue
Description theme_get_settings call
Dlo"oD
theme allo2s
customi=ation of
site lo"o
<?php
if ($!ogo = theme_get_setting
('!ogo')) {
$output += * <a href=U*+.U*
tit!e=U*EomeU*&<img src=U*$!ogoU*
a!t=U*EomeU* .&<.a&*;
)
?&
Dto""leNnam
eD
theme allo2s site
name to be
s2itched onJoff
<?php
if (theme_get_setting
('togg!e_name')) {
$output += * <h1 c!ass=U*site3
name tit!eU*&*+ !(varia!e_get
('site_name'' 'drupa!')' **)+
*<.h1&*;
)
?&
Dto""leNsear
chD
theme allo2s
search bo to be
s2itched onJoff
<?php
if (theme_get_setting
('togg!e_search')) {
$output += search_form();
)
?&
Dto""leNslo"
anD
theme allo2s site
slo"an to be
s2itched onJoff
<?php
if (theme_get_setting
('togg!e_s!ogan')) {
$output += * <div c!ass=U*site3
s!oganU*&*+ varia!e_get
('site_s!ogan'' '') +*<.div&*;
)
?&
Drupal Handbook: 20 April 2005 $71
Dto""leNmiss
ionD
theme allo2s site
mission to be
s2itched onJoff
<?php
if ($mission = theme_get_setting
('mission')) {
$output += $mission;
)
?&
Dto""leNprim
ar/NlinksD
theme allo2s
primar/ links to
be customi=ed
<?php
$output += theme_get_setting
('primary_!in(s');
?&
Dto""leNseco
ndar/NlinksD
theme allo2s
secondar/ links to
be customi=ed
<?php
$output += theme_get_setting
('secondary_!in(s');
?&
Dto""leNnode
NuserNpictur
eD
theme allo2s
node user
pictures to be
s2itched onJoff
<?php
if (theme_get_setting
('togg!e_node_user_picture') ##
$picture = theme('user_picture''
$node)) {
$output += $picture;
)
?&
Dto""leNcom
mentNuserNp
ictureD
theme allo2s
comment user
pictures to be
s2itched onJoff
<?php
if (theme_get_setting
('togg!e_comment_user_picture') ##
$picture = theme('user_picture''
$comment)) {
$output += $picture;
)
?&
;JA 4#lobal
*ettin"5
Allo2 admin to
specif/ 2hich
node t/pes should
displa/
G*ubmitted b/!!!G
messa"e
<?php
$output += theme_get_setting
(*togg!e_node_info_$node3&type*) ?
t(*:umitted y \a on \+*' array
(*\a* =& format_name($node)' *\*
=& format_date($node3&created))) %
'';
?&
9ote that a!! of these settings are optiona!' ut
Drupal Handbook: 20 April 2005 $72
recommended+
;heme3specific settings are sti!! possi!e as /e!!+ ;hey are
sti!! read from the theme_settings' ut are no/ p!aced in a
group on the appropriate theme's ta' rather than on a
separate page+
0tyles
;he theme system no/ a!!o/s for s/itching et/een different
*sty!es* for each theme+ Aach *sty!e* is defined y a
sty!e+css fi!e in a sudirectory of the theme+ 8n order to
accomp!ish this sty!e s/itching' themes shou!d add a ca!! to
theme_get_sty!es() /ithin their <head& !oc(+ Dor e$amp!e%
<?php
$output += drupa!_get_htm!_head();
$output += * #!t;!in( re!=U*sty!esheetU* type=U*te$t.cssU*
href=U*themes.chame!eon.common+cssU* .#gt;Un*;
$output += theme_get_sty!es();
$output += *#!t;.head#gt;*;
?&
9otice ho/ the reference to common+css is !isted efore
theme_get_sty!es()+ ;his a!!o/s individua! sty!es to
override your common B:: ru!es (if you use any)+
;he *defau!t* sty!e for each theme (the sty!esheet in /hich
you define co!or scheme and other genera! presentation
items) shou!d e renamed to sty!e+css and p!aced in your
theme directory+ Pou shou!d a!so remove any references to it
from your theme or temp!ate+ Hrupa! /i!! reference it in
theme_get_sty!es()+ (8f the defau!t sty!e is se!ected)
Dor $temp!ate themes' you need to add the {sty!es) tag add
the end of your <head& section+
#help hoo*
;he theme_he!p hoo( is no !onger used+ 8t can e removed if
desired+
Geferences to comment_referer_!oad() shou!d e s/itched to
comment_node_ur!()
Converting 4.. themes to 4.5
0earch form
8f your theme imp!ements a search form' it needs to e
Drupal Handbook: 20 April 2005 $77
a!tered+ ;he search o$ <input& tag shou!d have the name
attriute set to edit[(eys" rather than (eys+
No"e lin*s
9ode !in(s no !onger use the !in(_node() function' ut
instead are passed as an array in $node3&!in(s+ KEK3ased
themes /i!! need to e updated to pass this array through
theme('!in(s')+ ;emp!ate3ased themes shou!dn't need any
changes+
3ages
;he function theme_page() no !onger ta(es $tit!e or
$readcrum arguments+ Gemove the t/o arguments and any
specia! hand!ing of them+ <!! page tit!es and readcrums
are no/ retieved using drupa!_get_tit!e() and
drupa!_get_readcrum()+
No"e an" comment mar*ers
9ode and comment mar(ers are not restricted anymore to
signa! that something is ne/ or that a form e!ement is
re7uired+ ;he re7uired form e!ement mar(er /as moved to
theme_form_e!ement()' /hi!e theme_mar(() /as (ept to
generate content mar(ers+ 9e/ constants he!p in deciding on
the mar(er to disp!ay% 1<GT_9AO signa!s ne/ content'
1<GT_IKH<;AH is for changed or e$tended content and
1<GT_GA<H is for read or too o!d content+ 9o/ it is possi!e
to output mar(ers for read content too' and distinguish
et/een ne/ and updated content+
3ager an" menu item themeing
Karts of the pager are no/ themea!e themse!fs+ ;he menu
theming /as a!so reorgani4ed' to e easier to add /rappers
and theme menu !in(s+ 8f you override any of the
theme_menu+++() functions in your theme or temp!ate' compare
them to the current versions in theme+inc and menu+inc to
update them+
)e,t vali"ation changes
Hue to some changes in p!ain3te$t processing' some
parameters /hich /ere E;1= are no/ p!ain3te$t and vice3
versa+ 8f you use a theme engine' you shou!dn't need any
changes' e$cept if you override e$tra theme_ functions
yourse!f+
8f you are seeing pro!ems' the est approach is to compare
every theme_ functions that you override /ith the one from
Hrupa! core+ 8n particu!ar' the menu theme functions
Drupal Handbook: 20 April 2005 $7$
(theme_menu_F) re7uire changes in the /ay !() is used+
Pou shou!d a!so try sumitting a node and a comment /ith
E;1= tags in the su2ect+ ;he tags shou!d come out escaped'
and shou!d e sho/n on screen rather than interpreted+ 8f
this is not the case' you need to chec( your theme_node()
and theme_comment() functions+
Dina!!y' page tit!es shou!d e run through strip_tags() /hen
put into the htm! <tit!e& tag in <head&+ ;his shou!d on!y e
a pro!em if you have a +theme theme' as the theme engines
have a!! e updated to accomodate this change+
)heme screenshot gui"elines
Avery theme for 5+6W needs a screenshot in the form of a
screenshot+png p!aced in the theme.temp!ate.sty!e directory+
8t is est that screenshots are consistent+ ;he guide!ines
for core theme screenshots are (starting from a !an( Hrupa!
site)%
=og in as the first user+
Ana!e the fo!!o/ing modu!es' for some e$tra menu
items% aggregator' !og' node' page' story' trac(er+
Breate the fo!!o/ing story node%
-onec felis eros& blandit non
1ori id !acus+ Atiam ma!esuada diam ut
!iero+ :ed !andit' 2usto nec euismod
!aoreet' nunc nu!!a iacu!is e!it' vitae+
Honec do!or+ B!ass aptent taciti socios7u ad
!itora tor7uent per conuia nostra' per
inceptos hymenaeos+ Rivamus vestiu!um fe!is
<a href=*0*&nec !iero+ Huis !oortis<.a&+
Bum sociis nato7ue penatius et magnis dis
parturient montes' nascetur ridicu!us mus+
9unc venenatis pretium magna+ Honec dictum
u!trices massa+ Honec vestiu!um porttitor
purus+ 1auris nih !igu!a' porta non'
porttitor sed' fermentum id' do!or+ Honec eu
!ectus et e!it porttitor rutrum+ <enean
2usto+ Khase!!us augue tortor' mattis
nonummy' a!i7uam euismod' cursus eget'
ipsum+ :ed u!tricies iendum ante+ 1aecenas
rhoncus tincidunt eros+
=oo( at the node' and ma(e sure the tas are visi!e+
;a(e a screenshot+
But out a piece aout [5,?$,65 resi4ed to e$act!y
16?$Y? ([@6\ 4oom out)+ ;ry to sho/ on!y usefu! page
e!ements (menu' tas' tit!e' !in(s)+ Hon't inc!ude
ro/ser chrome+
Drupal Handbook: 20 April 2005 $75
<pp!y a standard 'sharpen' fi!ter to the thumnai! for
c!arity+
:ave as a K9Q' in pa!etted co!orspace to cut do/n on
si4e+
A$amp!e%
%""ing your theme to +rupal.org
;o add your theme to Hrupa!+org' it must e QK=+ Ho not
inc!ude images or other copyrighted /or(s that you do not
/ant to see re3used or other/ise a!tered+
;hemes are trac(ed the same /ay that code is' in the BR:
repository+ Pou /i!! need to app!y for a BR: account+ Cnce
you are approved' you /i!! e a!e to chec( your theme into
the Hrupa! BR: repository+ Breate a pro2ect and the do/n!oad
/i!! e created for it automatica!!y+
8f you do add your theme' users /i!! !i(e!y post
suggestions' fi!e ugs' and genera!!y desire that you (eep
the theme up to date /ith current versions of Hrupa!+
+ocumentation writer6s gui"e
8f you are interested in he!ping maintain documentation'
p!ease 2oin the drupa!3docs mai!ing !ist+
%uthoring gui"elines
;o ma(e the handoo( consistent and easy to read it is
important to fo!!o/ a series of guide!ines in ho/ /e
descrie to use' modification' and programming of Hrupa!+
7ormatting:
Ise short descriptive tit!es to !ae! your handoo(
entry+ <void redundancy; it is not necessary to use
the /ord Hrupa! or Eandoo( in your tit!e since you
are a!ready ovious!y ta!(ing aout Hrupa! and it is
a!ready ovious!y a part of the Eandoo(+
Ohen you are e$p!aining a step3y3step process p!ease
use E;1= ordered !ists% <o!&
Ohen descriing ho/ to get to a specific user
Drupal Handbook: 20 April 2005 $7%
interface option (e+g+ the add vocau!ary option in
the categories section of the administer screen)
demarcate the path needed to access the option using
this format%
destination (<i&path #gt; to #gt; item #gt;
destination<.i&)
Ohich /i!! yie!d te$t that !oo(s !i(e this%
destination (path > to > item > destination)
K!ease do not areviate /ords in the navigation path
(e+g+ use administer instead of admin)
8f you refer to a modu!e' engine' theme' user'
artic!e' forum topic' p!ease !in( to it /ith an
appropriate description at !east once in your
document+ 8t is not necessary or desira!e to !in( to
it each time it is mentioned /ithin a document+
8)1/ mar*up:
Anc!ose code samp!es /ithin <code& tags+
=in(s shou!d e emedded /ithin norma! descriptive
ody te$t%
.ood /in%ing
1y favorite organ in a cat is the <a
href=*http%..///+catstomachsru!e+com*
tit!e=*8nformation aout Bats and their
:tomachs*&stomach<.a&
0ad /in%ing
8 !i(e cat stomachs+ ;o !earn more aout them <a
href=*http%..///+catstomachsru!e+com*&c!ic( here<.a&
Ise re!ative !in(s /here possi!e%
.ood /in%ing
<a href=*node.1,@56-X* tit!e=*information*&
0ad /in%ing
<a href=*http%..///+drupa!+org.node.1,@56-X*
tit!e=*information*&
K!ease use tit!e tags in !in(s to other sections of
Hrupa!+org and other sites to descrie the purpose of
the !in(+
1iscellaneous:
K!ease spe!! chec( handoo( entries efore pu!ishing+
8ow an" when "o 9 up"ate a page:
Ipdate a page /hen you find that a piece of information
isn't /ritten /e!!' and thin( that you can do etter y
re/riting it comp!ete!y or adding.changing some things+
;o do so' c!ic( the edit tab at the top of the oo( page+
Pou'!! see the current page in an E;1= form and you can
start adding.changing+ <s /ith adding any post' you have to
Drupal Handbook: 20 April 2005 $7?
previe/ to see if everything /ent CT' and then :umit+ Pour
post /i!! e 7ueued and revie/ed y an :ite <dministator+
8ow to a"" a page to the 8an"&oo*
8t's very easy to add a page+ Ohen you fee! !i(e /riting a
piece of documentation aout a pro!em that hasn't a!ready
een addressed' 2ust c!ic( on c!ic( *create oo( page* !in(
in your !ogin menu (you have to e !ogged in to see it) and
type a/ay in the Body+
Pou /i!! have to set the correct parent to page' se!ect it
under Parent drop3do/n menu+
Cptiona!!y you can add a log message if you p!ease' in /hich
you e$p!ain /hy you /rote the documentation+
Dina!!y you give your piece of documentation a eight+ ;he
pages /ith a !ess heavy /eight /i!! stay at the top /ithin
the parent section /hi!e pages /ith heavy /eights /i!! sin(
deeper+ ;hen previe/ and fina!!y commit+
Cnce you sumit your documentation it /i!! e p!aced in the
moderation 7ueue /here one of the site maintainers /i!!
revie/ your document and eventua!!y post the page if it
meets /ith the guide!ines+
%""ing screenshots
:creenshots on Hrupa!+org must fo!!o/ these standards%
)ormat: K9Q3>
K9Q is preferred ecause of its !oss!ess compression and
sma!! fi!e si4e+ NKAQ is not suita!e 3 it !eaves artifacts
and its ,53it co!or depth is unneccesary /hen dea!ing /ith
screenshots+ Q8D is not used ecause it is an outdated
format+
,i1e:
8t is preferred that image si4e do not e$ceed X?? $ X??
pi$e! si4e+
0ro'ser 'indo'
<!! screenshots must inc!ude the entire ro/ser /indo/ e+g+
the tit!e ar and scro!!ars+ 8f your operating system or
capturing uti!ity supports this' try to capture on!y the
ro/ser /indo/' not the entire des(top (other/ise you /i!!
have to crop it in an image uti!ity manua!!y)+
Ohen preparing to capture' remove a!! distracting items from
your ro/ser app!ication 3 sidears' tas' too!ars' Qoog!e
ars' custom !in(s' etc+ Teep on!y the IG= address ar and
Drupal Handbook: 20 April 2005 $7&
ma(e sure it is !ong enough that the current IG= /on't e
hidden+
2indo's 34
8f you can' p!ease turn off B!ear;ype font smoothing /hen
ta(ing screenshots under LK+ 1ost peop!e don't have this
feature and it increases the fi!esi4e some/hat+
Dor reference' see :creenshots in the Q9C1A Hocumentation+
)ranslator6s gui"e
;his is the Hrupa! trans!ator's guide+ 8t /i!! cover most
aspects of trans!ating Hrupa!'s user interface+ 8t /i!! not
cover the use of the various programs that can e used to do
a trans!ation+ ;hese programs are usua!!y 7uite /e!!
documented+
<s of version 5+6+?' Hrupa! inc!udes an e$tended
!oca!e+modu!e that ena!es you to share trans!ations through
the use of KC fi!es+ KC fi!es are fi!es containing
trans!ations as used y the Q9I gette$t program+
Iser contriuted KC fi!es for various !anguages can e found
on the do/n!oad page+
8f your !anguage is not present' you might /ant to start a
trans!ation yourse!f+ 8f this is the case' p!ease do/n!oad
the Hrupa! KC; trans!ation temp!ates+ Pou can get a KC fi!e
editor and start trans!ating+
Pou shou!d trans!ate the individua! KC fi!es (per modu!e)
rather than one ig fi!e+ ;he individua! fi!es are
automatica!!y pac(aged into one !arge fi!e per !anguage in
the BR: repository' /hich is /hat others /i!! do/n!oad from
this site+
Cnce you have comp!eted a reasona!e part of the
trans!ation' create an issue on the !ranslation templates
pro2ect and up!oad your KC fi!es+ :ome he!pfu! deve!oper
/i!! then come y and put them in BR: for you+ 8f you have
/rite access to the contri BR: you can commit your fi!es
yourse!f+ 8n any case a pro2ect for your trans!ation /i!! e
created' you /i!! e made the maintainer' and your
trans!ation ecomes avai!a!e on the do/n!oad page
)ranslation templates
;rans!ators shou!d start y do/n!oading the tara!! and
trans!ating the fi!es to their !anguage of choice+
Drupal Handbook: 20 April 2005 $73
;he trans!ated fi!es shou!d e stored in contri3
cvs.trans!ations.id /here id is the 8:C -@Y !anguage code+
8f you don't (no/ your code' as( in drupa!3deve!+
Pou shou!d on!y put the individua! trans!ated fi!es in this
directory+ < script /i!! generate a merged id+po fi!e+ 1a(e
sure to fi!! out the header section of each fi!e and rename
them from +pot to +po+
8f you do not have a BR: account' create an issue for this
pro2ect and attach your fi!es to it+
9ote that the Hrupa! team /i!! not chec( contriuted
trans!ations for accuracy or errors+
3rograms to use for translation
Gecommended KC fi!e editors are (in no particu!ar order)%
LAmacs (/ith po3mode)% runs on Inices /ith L
Q9I Amacs (/ith po3mode)% runs on Inices
TMae! % runs on THA
poAdit % cross3p!atform
poAdit does not yet support mu!tip!e p!ura! forms+
C: L does not have a good po3editor right no/+
Me sure to get a recent version for a!! editors' mu!tip!e
p!ura! forms are a recent addition to the gette$t standard+
9ssues using po;"it
poAdit for /indo/s' version 1+@+1 (!atest at the moment)
doesn't seem to recogni4e p!ura! forms (if you try to edit a
term /hich has p!ura!s' even if you trans!ate it' it doesn't
appear in poedit /hen you move to an other term' as usua!'
and even if you save' it doesn't)+
3lurals 0olution <1
:o' if you find a p!ura! term' c!ose poedit' open the fi!e
you /ere trans!ating /ith a norma! te$t editor (no' not
Oord+++)' and search for *p!ura!* in it' you find something
simi!ar to this%
0% modu!es.comment+modu!e%1>X modu!es.node+modu!e%>Y
msgid *1 comment*
msgid_p!ura! *\count comments*
msgstr[?" *1 commento*
msgstr[1" *\count commenti*
Drupal Handbook: 20 April 2005 $$0
simp!y tran!ate the te$t in msgid (singu!ar form) into
msgstr567' and the te$t in msgid_plural (p!ura! form) into
msgstr587' save the fi!e' c!ose the editor and return to
poedit+ Aven etter' you can do this MADCGA start
trans!ating the rest of the fi!e /ith poedit' trans!ating
every occurrance of p!ura! in the same /ay' in every fi!e'
and ;EA9 start using poedit% this /ay' you /i!! find those
strings a!ready trans!ated in poedit' and they don't other
you+
3lurals 0olution <$
;o use p!ura!s in KC edit you can start /ith the cata!og
setting for eng!ish and then modify to suit+ ;he synta$ is%
np!ura!s=,; p!ura!=(n Z= 1);
/hich gave me /hat 8 needed in :/edish trans!ation of%
0% modu!es.aggregator+modu!e%1??;X11;X,,
msgid *1 item*
msgid_p!ura! *items*
msgstr[?" *1 in!_`gg*
msgstr[1" *\count in!_`gg*
8 tested this in KC Adit 1+@+1 and got the proper QI8
response and saved /ithut error+
3lurals 0olution <-
;he p!ura! forms to use in KC edit under cata!og3settings
/here you see
np!ura!=89;AQAG; p!ura!=ALKGA::8C9
Cn!y one form%
:ome !anguages on!y re7uire one sing!e form+ ;here is no
distinction et/een the singu!ar and p!ura! form+ <n
appropriate
header entry /ou!d !oo( !i(e this%
K!ura!3Dorms% np!ura!s=1; p!ura!=?;
=anguages /ith this property inc!ude%
Dinno3Igric fami!y
Eungarian
<sian fami!y
Napanese' Torean
;ur(ic.<!taic fami!y
Drupal Handbook: 20 April 2005 $$1
;ur(ish
;/o forms' singu!ar used for one on!y
;his is the form used in most e$isting programs since it is
/hat
Ang!ish is using+ < header entry /ou!d !oo( !i(e this%
K!ura!3Dorms% np!ura!s=,; p!ura!=n Z= 1;
(9ote% this uses the feature of B e$pressions that oo!ean
e$pressions have to va!ue 4ero or one+)
=anguages /ith this property inc!ude%
Qermanic fami!y
Hanish' Hutch' Ang!ish' Qerman' 9or/egian' :/edish
Dinno3Igric fami!y
Astonian' Dinnish
=atin.Qree( fami!y
Qree(
:emitic fami!y
Eere/
Gomanic fami!y
8ta!ian' Kortuguese' :panish
<rtificia!
Asperanto
;/o forms' singu!ar used for 4ero and one
A$ceptiona! case in the !anguage fami!y+ ;he header entry
/ou!d
e%
K!ura!3Dorms% np!ura!s=,; p!ura!=n&1;
=anguages /ith this property inc!ude%
Gomanic fami!y
Drench' Mra4i!ian Kortuguese
;hree forms' specia! case for 4ero
;he header entry /ou!d e%
K!ura!3Dorms% np!ura!s=@; p!ura!=n\1?==1 ## n\1??Z=11 ? ? %
n Z= ? ? 1 % ,;
=anguages /ith this property inc!ude%
Drupal Handbook: 20 April 2005 $$2
Ma!tic fami!y
=atvian
;hree forms' specia! cases for one and t/o
;he header entry /ou!d e%
K!ura!3Dorms% np!ura!s=@; p!ura!=n==1 ? ? % n==, ? 1 % ,;
=anguages /ith this property inc!ude%
Be!tic
Qaei!ge (8rish)
;hree forms' specia! case for numers ending in 1[,3Y"
;he header entry /ou!d !oo( !i(e this%
K!ura!3Dorms% np!ura!s=@; U
p!ura!=n\1?==1 ## n\1??Z=11 ? ? % U
n\1?&=, ## (n\1??<1? ]] n\1??&=,?) ? 1
% ,;
=anguages /ith this property inc!ude%
Ma!tic fami!y
=ithuanian
;hree forms' specia! cases for numers ending in 1 and ,' @'
5' e$cept those ending in 1[135"
;he header entry /ou!d !oo( !i(e this%
K!ura!3Dorms% np!ura!s=@; U
p!ura!=n\1?==1 ## n\1??Z=11 ? ? % U
n\1?&=, ## n\1?<=5 ## (n\1??<1? ]] n\
1??&=,?) ? 1 % ,;
=anguages /ith this property inc!ude%
:!avic fami!y
Broatian' B4ech' Gussian' :!ova(' I(rainian
;hree forms' specia! case for one and some numers ending in
,' @' or 5
;he header entry /ou!d !oo( !i(e this%
K!ura!3Dorms% np!ura!s=@; U
p!ura!=n==1 ? ? % U
n\1?&=, ## n\1?<=5 ## (n\1??<1? ]] n\
1??&=,?) ? 1 % ,;
=anguages /ith this property inc!ude%
:!avic fami!y
Ko!ish
Drupal Handbook: 20 April 2005 $$7
Dour forms' specia! case for one and a!! numers ending in
?,' ?@' or ?5
;he header entry /ou!d !oo( !i(e this%
K!ura!3Dorms% np!ura!s=5; U
p!ura!=n\1??==1 ? ? % n\1??==, ? 1 % n\1??==@ ]] n\1??==5 ?
, % @;
=anguages /ith this property inc!ude%
:!avic fami!y
:!ovenian
=ong p!ura! formu!ae% ;hose shou!d not e ro(en into
severa! !ines in the header of the KC fi!e+ Hrupa! e$pects
the formu!a to e on one !ine+ Cne cou!d consider this a
ug+
8 don't thin( that you can use !ine rea(s in KCedit either+
;he te$t is fi$ed to (eep from rea(ing the site !ayout+ Mut
this%
np!ura!s=1; p!ura!=ar;
produces an error+ ;he p!ura! form *ar* is not recogni4ed+
)ranslate" +rupal 9nformation
:ome of the information aout Hrupa!' not 2ust the Hrupa!
interface itse!f has a!so een trans!ated into other
!anguages+ =in(s to other @rd party trans!ations of Hrupa!
information ourside of the interface shou!d !ive here+
0panish
Hrupa!% 1ane2ador de Bontenidos y Bomunidad Rirtua!
Hrupa!% Baracter_ sticas
)ranslation gui"elines
;o achieve trans!ations that are consistent throughout a
/ho!e Hrupa! site' certain guide!ines need to e agreed upon
y the trans!ator community for a particu!ar !anguage+
:uch guide!ines shou!d inc!ude a /ord!ist for /ords that
occur in Hrupa!'s strings+ ;he <n(ur Mang!a Heve!oper's
Quide provides a good e$amp!e of ho/ this is done on a
pro2ect unre!ated to Hrupa!+ 8t /i!! e he!pfu!! to not set
up a ne/ /ord !ists' ut re3use e$isting ones from an
Drupal Handbook: 20 April 2005 $$$
e$isting trans!ation pro2ect+
Cther areas /hich need guide!ines /i!! differ from !anguage
to !anguage+ K!ease add those guide!ines as chi!d pages to
this oo( page+
)ranslation of contri&ute" mo"ules
;rans!ata!e strings from contriuted modu!es are not
inc!uded in the Hrupa! core KC; fi!es+ 1odu!e authors can
use the e"tractor.php script /hich comes /ith the core KC
fi!es to generate a KC; fi!e on their o/n+ 8nstructions for
running the script can e found in the #$A%&$ that comes
/ith the core KC; fi!es+ ;he generated KC; fi!e shou!d e
named as the modu!e' ut /ith a .pot e$tension' e+g+
event.module gets an event.pot fi!e+ ;his fi!e shou!d e
p!aced in a suddirectory po+ ;rans!ations shou!d e added to
the same directory+ A+g+ the po sudirectory of event+modu!e
current!y contains the fo!!o/ing fi!es% de+po' es+po'
event+pot' he+po' hu+po+
;rans!ators shou!d ta(e care to popu!ate their started
trans!ation /ith the strings from the genera!+po fi!e for
their !anguage using msgmerge+ 8n this /ay they can avoid
using different trans!ations for terms that occur in oth
fi!es+
+istri&uting the translation effort
;o faci!itate easier hand!ing of a community trans!ation
effort' the Hrupa! KC; fi!e is sp!it up into sma!! fi!es
that do not contain dou!y occurring strings+
<!! strings that occur more than once in the Hrupa! core
distriution are put into the genera!+pot fi!e+ ;his ensures
that those strings are trans!ated to the same string+ <!so'
fi!es that have ten or !ess trans!ata!e strings /i!! not
get their o/n KC; fi!e' ut those strings /i!! e appended
to the genera!+pot fi!e+
Cf course' some coordination among the pro2ect memers is
sti!! needed to ensure the 7ua!ity of the trans!ation+
8f a !anguage has severa! options on ho/ to trans!ate some
strings' then it is possi!e to create KC fi!es that on!y
change those strings+ <n e$amp!e /ou!d e Qerman /here your
can trans!ate you either as %u or 'ie depending on the
audience of your site+
0tatus of the translations
Drupal Handbook: 20 April 2005 $$5
;he ta!e e!o/ presents an overvie/ of the status of each
trans!ation pro2ect+ ;his page is updated dai!y y the
pac(age script% it /as !ast updated , hours 5> min ago+
0tatus overview
"angua
ge
cs N.P.( N.).(
ar
??a 427%
missin"5
??a 427%
missin"5
b"
&&a 413?
missin"5
ca
%$a 4$03
missin"5
$%a 4%21
missin"5
cs
&0a 470%
missin"5
%7a 45%$
missin"5
da
translation
bro#en
'((*
@completeA
de 33a 4$ missin"5 33a 45 missin"5
eo
$3a 411%
missin"5
es
?5a 42??
missin"5
'((*
@completeA
es+la
0a 425%
missin"5
eu
$$a 4&10
missin"5
1$a 411%7
missin"5
fi 3&a 4$ missin"5
fr
35a 430
missin"5
37a 43?
missin"5
hu
'((*
@completeA
'((*
@completeA
'((*
@completeA
id
3%a 45%
missin"5
3%a 45%
missin"5
it
translation
bro#en
'((*
@completeA
Fa
'((*
@completeA
'((*
@completeA
'((*
@completeA
lt
%?a 45$7
missin"5
Drupal Handbook: 20 April 2005 $$%
nb
22a 43$7
missin"5
nl
&&a 41?2
missin"5
&$a 422&
missin"5
nno
2%a 41015
missin"5
2&a 43?3
missin"5
pl
%a 4170%
missin"5
%a 4170%
missin"5
pt+br
27a 4&%2
missin"5
27a 4&%2
missin"5
pt+pt
'((*
@completeA
'((*
@completeA
ro
3&a 413
missin"5
3&a 413
missin"5
ru
?7a 477&
missin"5
&&a 4155
missin"5
sI
73a 4%&?
missin"5
73a 4%&?
missin"5
sv
translation
bro#en
translation
bro#en
=h+hans
%2a 451$
missin"5
%2a 451$
missin"5
=h+hant
translation
bro#en
translation
bro#en
Chec*ing your translation status
;o see ho/ many of the strings in the KC fi!es you a!ready
trans!ated you can try this%
for i in F+po; do echo $i ; msgfmt 33statistics $i ; done
:ome KC editors a!ready inc!ude this feature+
1a*e a single file from the loose .po
files from C=0
8f you /ant to ma(e a sing!e po fi!e from a BR: fo!der
containing a!! the sma!! po fi!es' the fo!!o/ing commands
/i!! do (Fni$ on!y)+ Pou shou!d e$ecute this' /hi!e eing in
the fo!der /ith the +po fi!es+
Drupal Handbook: 20 April 2005 $$?
$ msgcat 33use3first genera!+po [^g"F+po ] msgattri 33no3
fu44y 3o n!+po
Cff course you shou!d change n! into your o/n !anguage code+
ecycling ol" translations
Hrupa! users /ith e$isting trans!ations might /ant to add
those to the trans!ations do/n!oad page+ ;o do this they
first need to e$port their trans!ation from the !oca!i4ation
manage languages screen (e"port suta)+ =et us assume you
have an 8ta!ian trans!ation+ ;he aove mentioned process
/i!! create an it+po fi!e for you+ ;o use this fi!e as a
asis for a ne/ trans!ation' you treat it as a KC
compendium' i+e+ a !irary of pre3trans!ated strings+
;his guide assumes a Ini$.=inu$ environment+ 8f you use
Oindo/s' chec( if your KC editor doesn't have a function for
this+
Oe /i!! sp!it the sing!e' !arge KC fi!e into the sma!!er
fi!es that the Hrupa! trans!ation Kro2ect re7uires+
Dirst' put the sma!! KC fi!es into a sudirectory drupal(pot
and your it+po fi!e into another one+ ;hen create an empty
directory /here you /ant to (eep your ne/ sma!! KC fi!es+
;hen go to the empty directory and e$ecute the fo!!o/ing
command from the command !ine%
for i in .path.to.drupa!3pot.F+pot ; do msgmerge 33
compendium .path.to.it+po 3o aasename $i +pota+po .dev.nu!!
$i ; done
<fter a /hi!e (yes this /i!! ta(e a fe/ minutes) you shou!d
have a directory of sma!! KC fi!es that have the matching
strings inserted+
)rou&leshooting
Ohen doing trans!ations or importing them' severa! pro!ems
can occur+ 8f you thin( you found a ug in either a
trans!ation or in Hrupa!'s !oca!e modu!e' p!ease fi!e ug
reports against the pro2ect in 7uestion+
8f you have a more genera! 7uestion you can as( it in the
trans!ations forum+
Eere /e co!!ect some of the more common issues found+
Drupal Handbook: 20 April 2005 $$&
Weir" characters or !uestion mar*s
:ymptom% <fter importing a trans!ation you find a!! (ind of
/eird characters or 7uestion mar(s on your site+
:o!ution 1% ;he trans!ator did not use I;D3>+ Hrupa! is
fu!!y I;D3> a/are and e$pects trans!ations to e supp!ied in
that character set as /e!!+ Pou can change the charset of a
KC fi!e using Q9I msgconv+ K!ease fi!e a ug against the
trans!ation in 7uestion+
:o!ution ,% Pou do not have the correct font insta!!ed to
disp!ay the !anguage in 7uestion+
1ar*eting resources
;his section provides resources for peop!e /ho /ant to
mar(et drupa!+
Ohether you /ant to pu!ish a story /ith a !ogo on your
/esite' print a !eaf!et or need some te$ts for a report'
this might e the p!ace to !oo(+
8f you are a designer' mar(eteer or a /riter you can e of
he!p here too+ 8f you thin( you can /rite a nice te$t on /hy
peop!e shou!d choose drupa! for their it3so!utions' or if
you have a nice drupa! !ogo you can create a oo( page here+
K!ease note that if you have 7uestions concerning any
content in this section' you can as( those in the forums+
;he comments under the oo(pages can e used to discuss the
contents of that page+
>anners
8f you /ish to disp!ay the Hrup!icon on your Hrupa! /esite'
you can use the fo!!o/ing uttons' /ith a !in( to
drupa!+org+
0mall


1e"ium
Drupal Handbook: 20 April 2005 $$3




/in*s
;here are severa! other anners hosted on other sites that
you might find appea!ing+
:ma!! /ith Crange Mac(ground
=arge Hrupa! Heve!opers 8con
:ma!! /ith Pe!!o/ Mac(ground
=arge Hrupa! Eead
< :eries of Manners ased off of the Hrupa! Eead
8f you have more' p!ease fee! free to sumit them+
>oo*let
Eere you can previe/ and do/n!oad a drupa! KHD oo(!et' that
can e used for promotion of Hrupa!+ 8f you /ant to a7uire
printed paper versions' you can get in contact /ith drupa!
on infoSdrupa!+org to discuss the use' amount and shipping
costs+
;he oo(!et in KHD format
Drupal Handbook: 20 April 2005 $50
< co!!age of the oo(!et
+ruplicon
8f you /ish to use or edit the Hrup!icon' you can use
fo!!o/ing !ogos (a!! !ogos use GQM co!or)%
>itmap versions
K9Q version
K9Q version @H ce!!shaded
=ector formats
Drupal Handbook: 20 April 2005 $51
AK: version
Other formats
Kaint :hop Kro version (///+2asc+com)+
if you can provide other usefu! formats' p!ease add an issue
/ogo colors
Oe co!or
1ain drop co!or% 0??XXB?
=ight3shade co!or% 0>1BADD
GQM co!or
1ain drop co!or% ??' 11Y' 1Y,
=ight3shade co!or% 1,Y' ,?-' ,66
B1PT co!or
B1PT co!or is used in 53co!or printing and prepress
industry+ ;here's no 1%1 match in GQM and B1PT co!or' so
it's difficu!t to ring out corresponding co!or va!ues+ Cne
comination to try is B1PT Y1',X','? for main drop co!or and
5X'@'@'? for high!ight+
3resentations
Rancouver Hrupa! presentation (Cpen Cffice Kresentation
Di!e)
Kortuguese trans!ation of the Rancouver Hrupa! presentation
(Cpen Cffice Kresentation Di!e)
;rans!ation y% Bar!isson Qa!dino+
Duture Hrupa! Kresentations can e found in the BR:
Kresentations Do!der+
;he Dosdem ,??6 presentations /i!! soon fo!!o/+ Dor no/' /e
invite everyone to co!!ect the various its and pieces of
information and !ist or post it here+
Drupal Handbook: 20 April 2005 $52
eviews
A$terna! revie/s of Hrupa! Musiness M!og Nourna! Gevie/ Rery
informative and genera!!y positive revie/ y Earo!d Narche
and Bameron Ma!es <out+com's Gevie/ of Hrupa! 5 of 6 star
revie/+ < short revie/ ut true and positive+ 8f you read or
/rite a revie/ of Hrupa! e!se/here' p!ease post the IG= and
a short description of the revie/+ Pou might post some
information aout the site it /as posted on (language)
influence) etc) and your opinion aout the revie/+
3osters
Hrupa! has some nice !oo(ing posters that can e used for
promotion of drupa!+ Dee! free to do/n!oad them in KHD
format+ <nd if you are a!e to modify' trans!ate or improve
the poster' fee! free to do so and of course give feedac('
so that /e can add those modifications here+
=inu$ ;ag poster in AK: format (defau!t)
=inu$ ;ag poster in AK: format (sma!!)
=inu$ ;ag poster in K9Q format
Oing poster in Qimp LBD format
Oing poster in AK: format
Oing Koster in K9Q format
%&out the han"&oo*
Drupal Handbook: 20 April 2005 $57
Commenting on the han"&oo* pages
K!ease read the fo!!o/ing points carefu!!y efore sumitting
your comment to the *andbook+ 8f your post fa!!s into one of
the categories mentioned here' it /i!! e re2ected y one of
the editors+ Oe try to (eep the handoo( c!ean and up to
date+ Bomments are hard to maintain' often unva!idated' and
/i!! confuse readers; thus' the fo!!o/ing (inds of comments
are discouraged%
Mug reports ' feature re7uests or !anguage changes%
you're in the /rong p!ace+ Dor support use any of the
support options+
Bommenting on the fact that something is not
documented+ ;his is /here you add to the
documentation' not /here you as( us to add the
documentation+ 8nstead' p!ease ta(e the time to create
ne/ documentation and add it for the enefit of
everyone+
;his is a!so not the correct p!ace to as( 7uestions
(even if you see others have done that efore' /e are
editing the notes s!o/!y ut sure!y)+ 8f you need to
as( a 7uestion' use the forums or the drupa!3support
!ist' or see /hat other support options are avai!a!e+
8f you post a note in any of the categories aove' it /i!!
e edited or removed+
Nust to ma(e the point once more+ ;he notes are eing edited
and support 7uestions.ug reports.feature re7uest.comments
on !ac( of documentation' are eing de!eted from them' so if
you post a 7uestion.ug.feature.comp!aint' it /i!! e
removed+ (Mut once you get an ans/er.ug so!ution.function
documentation' fee! free to come ac( and add it hereZ)
K!ease note that periodica!!y' the deve!opers may go through
the notes and incorporate the information in them into the
documentation+
Copyright an" licensing
<!! Hrupa! handoo( pages are bc copyright ,???3,??6 y the
individua! contriutors and can e used in accordance /ith
the Breative Bommons =icense' <ttriution3:hare<!i(e,+?+
;his copy!eft !icense (very simi!ar to the QK=) a!!o/s
anyone to copy' modify' and redistriute modifications of
a!! or part of the Hrupa! handoo( as !ong as
the !icense is inc!uded /ith a!! copies or
redistriutions+
Drupal Handbook: 20 April 2005 $5$
the Hrupa! handoo( is attriuted as the originating
document+
;hese conditions can e /aived on!y if permission is
otained from the copyright ho!der(s)+ My posting comments
to the pages in the Hrupa! handoo(' Hrupa! site memers
agree that the comments can e revised and.or incorporated
/ho!esa!e into the Hrupa! handoo( pages under the !icensing
terms given aove+
Bontriutors to the Hrupa! handoo( are !isted on the oo(
contriutors page+
>oo* contri&utors
;he fo!!o/ing users contriuted to the Hrupa! handoo(%
a$ (@? pages)
Hries (,- pages)
(i(a (,, pages)
T2artan (,, pages)
M_dr Tesse!s (1Y pages)
moshe /eit4man (1> pages)
:teven (1- pages)
ned2o (16 pages)
(i!!esS///+drop+org (1@ pages)
ryan (ennedy (1, pages)
Moris 1ann (11 pages)
Goert Baste!o (1? pages)
nysus (> pages)
;Hoes (> pages)
2vandy( (6 pages)
ertoer!andS//+++ (6 pages)
chery!chase (6 pages)
ce!5156 (6 pages)
a! (5 pages)
sepec( (@ pages)
NeremyS(erne!tr+++ (@ pages)
drumm (@ pages)
fu44ygroup (@ pages)
t!( (@ pages)
2udah (, pages)
danY?Sdrupa!+org (, pages)
(itt (, pages)
(ahey (, pages)
Nunyor (, pages)
Hu!in Hrupa!!er (, pages)
svemir (, pages)
;EA1i(e (1 page)
mi(era4 (1 page)
gufo1 (1 page)
scottsgravy (1 page)
aarre (1 page)
vi(sit (1 page)
Drupal Handbook: 20 April 2005 $55
tatonca (1 page)
odoy!e (1 page)
rivena (1 page)
p4 (1 page)
te!edyn (1 page)
a@1Y- (1 page)
ch$ (1 page)
paster (1 page)
ir/in (1 page)
r(enda!! (1 page)
taffy (1 page)
osesif (1 page)
2eremy (1 page)
<dagio (1 page)
/a!(ah (1 page)
Nohn Ho/ney (1 page)
$d (1 page)
A!o7uence (1 page)
may (1 page)
mathias (1 page)
adrian (1 page)
n2ivy (1 page)
mrphp (1 page)
fe!ipefonseca (1 page)
mar(y (1 page)
marccanter (1 page)
o!av (1 page)
f!s (1 page)
sandip (1 page)
romca (1 page)
I/e Eermann (1 page)

You might also like