老葛
北京亚艾元软件有限责任公司
第一章 Drupal的工作原理11
1,什么是Drupal11
2, drupal的技术堆栈11
2.1 PHP12
2.2 web服务器12
2.3 数据库12
2.4操作系统12
2.5 HTML,CSS,JavaScript13
3 Drupal文件夹结构13
3.1 includes13
3.2 misc14
3.3 modules14
3.4 profiles14
3.5 scripts14
3.6 sites14
3.7 themes:15
3.8 authorize.php:15
3.9 cron.php:15
3.10 index.php:15
3.11 install.php:15
3.12 update.php:15
3.13 xmlrpc.php:15
3.14 robots.txt:15
4 Drupal核心概念16
模块16
钩子16
主题18
节点18
区块19
菜单19
用户19
字段与实体19
5 Drupal执行流程20
5.1 引导指令21
5.2 钩子的执行顺序23
总结24
第2章 编写自己的模块25
创建相关文件25
info文件26
module文件27
创建自己的数据库表结构36
创建自己的预处理函数39
改进我们的代码41
继续改进我们的代码43
variable_get与variable_set45
贡献我们的代码46
总结47
第3章 Drupal 菜单系统48
创建一个菜单项48
调整菜单项的位置51
调整菜单项所属的菜单52
不在菜单中显示菜单项53
把页面回调放在inc文件中53
访问控制54
标题的本地化和定制56
定义标题回调56
菜单嵌套58
页面回调参数60
将菜单项显示为标签63
修改其它模块定义的菜单项67
改变其它模块的菜单链接69
菜单项中的通配符70
基本通配符71
通配符和页面回调参数72
使用通配符的值73
通配符、占位符、参数替换75
向加载函数传递额外的参数76
特殊的,预定义的加载参数:%map和%index77
使用to_arg()函数为通配符构建路径77
Hook_menu的键值属性78
菜单项的类型80
相关的钩子函数80
总结80
第四章 数据库API81
一般概念81
驱动81
连接82
查询82
语句82
数据库配置83
连接键83
目标83
$databases语法83
依赖于PDO85
静态查询85
前缀化86
占位符86
占位符数组87
查询选项88
结果集88
存到类中90
动态查询91
内容结构92
概貌92
关联93
字段93
Distinct94
表达式95
排序95
随机排序96
分组96
范围和限制96
表排序97
条件语句97
执行查询97
总计查询98
调试98
扩展器98
修改查询101
插入查询103
紧凑形式104
退化形式105
多值插入形式106
基于选择查询的结果插入107
默认值108
更新查询108
删除查询109
合并查询110
只是设置它110
有条件设置111
有限制的更新112
优先级112
条件语句113
概念113
API114
数组运算符114
嵌套的条件语句115
Null值115
子查询116
示例116
编写数据库驱动117
PDO117
错误处理117
事务117
链式118
函数和运算符120
逻辑运算符120
比较运算符120
类型操作运算符121
字符串函数和运算符121
数学函数和运算符121
日期/时间函数121
聚合函数121
总结121
第5章 Schema(模式) API122
模块的install文件122
创建数据库表122
使用Schema(模式)模块124
Schema与数据库字段类型之间的映射关系125
文本型126
Varchar126
Char126
Text127
数字型127
Integer127
Serial127
Float128
Numeric128
二进位:Blob128
相关API函数130
维护我们的数据库表131
第6章 Form API133
两步表单133
创建相关文件133
“联系我们”页面134
控制表单的外观140
添加验证函数和提交函数142
确认页面144
邮件发送149
“致谢”页面150
AJAX表单151
准备工作151
创建相关文件152
Ajax表单的三个关键要点157
Ajax表单流程分析158
表单元素161
Actions(动作)161
Button(按钮)161
Checkbox(复选框)162
Checkboxes(复选框)162
Container(容器)163
Date(日期)163
fieldset(字段集)164
File(文件)165
hidden(隐藏域)165
image_button(图片按钮)166
item(条目)166
machine_name(机读名字)167
managed_file(受管理的文件)168
markup(标识文本)169
password(密码)169
password_confirm(带确认的密码)170
Radio(单选按钮)170
radios(单选按钮)171
select(下拉选择框)171
submit(提交按钮)171
Tableselect(表选择)172
text_format(文本格式)173
textarea(文本域)173
textfield(文本字段)174
value(值)174
vertical_tabs(垂直标签)175
weight(重量)175
呈现API176
第7章 Drupal用户177
对象$user177
测试用户是否登录了179
用户系统的钩子函数179
班主任模块181
钩子hook_user_view185
钩子hook_user_login186
钩子hook_username_alter187
统一用户登录188
与Drupal6站点整合用户188
常用解决方案介绍191
内置单点登录192
总结195
第8章 Drupal区块196
什么是区块?196
区块配置选项197
区块位置198
理解区块的呈现199
区块的数据库表结构200
区块钩子介绍202
创建一个区块203
钩子hook_block_info204
钩子hook_block_configure205
钩子hook_block_save206
钩子hook_block_view207
PHP代码的形式208
扩展阅读210
Bean211
Boxes211
Node Blocks211
MultiBlock211
CCK Blocks211
总结211
第9章 Field API212
自定义一个字段类型212
准备工作212
钩子hook_field_info213
钩子hook_field_widget_info214
钩子hook_field_schema215
钩子hook_field_widget_settings_form217
钩子hook_field_widget_form218
钩子hook_element_info219
对应表单元素的主题函数220
钩子hook_content_is_empty221
钩子hook_field_validate221
钩子hook_field_presave222
钩子hook_field_formatter_info224
验证已有的字段226
伪字段227
为已有字段定制格式器228
总结234
附录一 数据库表结构235
accesslog (统计模块)235
actions (system(系统)模块)235
aggregator_category (aggregator(聚合器)模块)235
aggregator_category_feed (聚合器模块)235
aggregator_category_item (聚合器模块)236
aggregator_feed (聚合器模块)236
aggregator_item (聚合器模块)236
authmap (用户模块)237
batch (系统模块)237
block (区块模块)237
block_custom (区块模块)238
block_node_type (节点模块)238
block_role (区块模块)239
blocked_ips (系统模块)239
book (手册模块)239
cache (系统模块)239
cache_block (区块模块)240
cache_bootstrap (系统模块)240
cache_field (字段模块)240
cache_filter (过滤器模块)241
cache_form (系统模块)241
cache_image (图片模块)241
cache_menu (系统模块)242
cache_page (系统模块)242
cache_path (系统模块)242
cache_update (更新模块)243
comment (评论模块)243
contact (联系模块)244
date_format_locale (系统模块)244
date_format_type (系统模块)244
date_formats (系统模块)245
field_config (字段模块)245
field_config_instance (字段模块)245
field_data_body (field_sql_storage 模块)246
field_data_comment_body (field_sql_storage 模块)246
field_data_field_image (field_sql_storage 模块)247
field_data_field_tags (field_sql_storage 模块)247
field_data_taxonomy_forums (field_sql_storage 模块)248
field_revision_body (field_sql_storage 模块)248
field_revision_comment_body (field_sql_storage 模块)249
field_revision_field_image (field_sql_storage 模块)249
field_revision_field_tags (field_sql_storage 模块)250
field_revision_taxonomy_forums (field_sql_storage 模块)250
file_managed (系统模块)250
file_usage (系统模块)251
filter (过滤器模块)251
filter_format (过滤器模块)252
flood (系统模块)252
forum (论坛模块)252
forum_index (论坛模块)252
history (系统模块)253
image_effects (图片模块)253
image_styles (图片模块)253
languages (本地化模块)254
locales_source (本地化模块)254
locales_target (本地化模块)254
menu_custom (菜单模块)255
menu_links (系统模块)255
menu_router (系统模块)257
node (节点模块)258
node_access (节点模块)259
node_comment_statistics (评论模块)259
node_counter (统计模块)259
node_revision (节点模块)260
node_type (节点模块)260
poll (投票模块)261
poll_choice (投票模块)261
poll_vote (投票模块)261
queue (系统模块)262
rdf_mapping (rdf 模块)262
registry (系统模块)262
registry_file (系统模块)263
role (用户模块)263
role_permission (用户模块)263
search_dataset (搜索模块)263
search_index (搜索模块)264
search_node_links (搜索模块)264
search_total (搜索模块)264
semaphore (系统模块)264
sequences (系统模块)265
sessions (系统模块)265
shortcut_set (shortcut(快捷方式)模块)265
shortcut_set_users (快捷方式模块)266
simpletest (simpletest(简单测试)模块)266
simpletest_test_id (simpletest(简单测试) 模块)266
system (系统模块)267
taxonomy_index (分类模块)267
taxonomy_term_data (分类模块)268
taxonomy_term_hierarchy (分类模块)268
taxonomy_vocabulary (分类模块)268
tracker_node (tracker(追踪器)模块)269
tracker_user (追踪器模块)269
trigger_assignments (触发器模块)269
url_alias (系统模块)269
users (用户模块)270
users_roles (用户模块)270
variable (系统模块)270
watchdog (dblog(数据库日志)模块)271
致谢272
thinkindrupal.com273