欢迎各位兄弟 发布技术文章
这里的技术是共享的
作者:老葛,博客:zhupou.cn, drupal.org账号:http://drupal.org/user/174740
Drupal专业开发指南译者。
第一章 Drupal的工作原理... 11
1,什么是Drupal 11
2, drupal的技术堆栈... 11
2.1 PHP. 12
2.2 web服务器... 12
2.3 数据库... 12
2.4操作系统... 12
2.5 HTML,CSS,JavaScript 13
3 Drupal文件夹结构... 13
3.1 includes. 13
3.2 misc. 14
3.3 modules. 14
3.4 profiles. 14
3.5 scripts. 14
3.6 sites. 14
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_set. 45
贡献我们的代码... 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和%index. 77
使用to_arg()函数为通配符构建路径... 77
Hook_menu的键值属性... 78
菜单项的类型... 80
相关的钩子函数... 80
总结... 80
第四章 数据库API 81
一般概念... 81
驱动... 81
连接... 82
查询... 82
语句... 82
数据库配置... 83
连接键... 83
目标... 83
$databases语法... 83
依赖于PDO.. 85
静态查询... 85
前缀化... 86
占位符... 86
占位符数组... 87
查询选项... 88
结果集... 88
存到类中... 90
动态查询... 91
内容结构... 92
概貌... 92
关联... 93
字段... 93
Distinct 94
表达式... 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
API 114
数组运算符... 114
嵌套的条件语句... 115
Null值... 115
子查询... 116
示例... 116
编写数据库驱动... 117
PDO.. 117
错误处理... 117
事务... 117
链式... 118
函数和运算符... 120
逻辑运算符... 120
比较运算符... 120
类型操作运算符... 121
字符串函数和运算符... 121
数学函数和运算符... 121
日期/时间函数... 121
聚合函数... 121
总结... 121
第5章 Schema(模式) API. 122
模块的install文件... 122
创建数据库表... 122
使用Schema(模式)模块... 124
Schema与数据库字段类型之间的映射关系... 125
文本型... 126
Varchar. 126
Char. 126
Text. 127
数字型... 127
Integer. 127
Serial. 127
Float. 128
Numeric. 128
二进位:Blob. 128
相关API函数... 130
维护我们的数据库表... 131
第6章 Form API. 133
两步表单... 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
呈现API. 176
第7章 Drupal用户... 177
对象$user. 177
测试用户是否登录了... 179
用户系统的钩子函数... 179
班主任模块... 181
钩子hook_user_view. 185
钩子hook_user_login. 186
钩子hook_username_alter. 187
统一用户登录... 188
与Drupal6站点整合用户... 188
常用解决方案介绍... 191
内置单点登录... 192
总结... 195
第8章 Drupal区块... 196
什么是区块?... 196
区块配置选项... 197
区块位置... 198
理解区块的呈现... 199
区块的数据库表结构... 200
区块钩子介绍... 202
创建一个区块... 203
钩子hook_block_info. 204
钩子hook_block_configure. 205
钩子hook_block_save. 206
钩子hook_block_view. 207
PHP代码的形式... 208
扩展阅读... 210
Bean. 211
Boxes. 211
Node Blocks. 211
MultiBlock. 211
CCK Blocks. 211
总结... 211
第9章 Field API. 212
自定义一个字段类型... 212
准备工作... 212
钩子hook_field_info. 213
钩子hook_field_widget_info. 214
钩子hook_field_schema. 215
钩子hook_field_widget_settings_form.. 217
钩子hook_field_widget_form.. 218
钩子hook_element_info. 219
对应表单元素的主题函数... 220
钩子hook_content_is_empty. 221
钩子hook_field_validate. 221
钩子hook_field_presave. 222
钩子hook_field_formatter_info. 224
验证已有的字段... 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
Zhupou.cn
来自 http://item.taobao.com/item.htm?spm=a1z10.1.w4-17713562116.1.usoDYL&id=18408380421
作者:老葛,
drupal.org账号:http://drupal.org/user/174740
Drupal专业开发指南译者。
Think in Drupal系列中文资料的作者。
目录
实体(Entity)API ..........................5
实体... ......................................6
Bundle(包)... ..........................7
不是所有的东西都是实体................. 7
Drupal7核心实体API介绍............... 8
Entity API模块... .........................9
定义自己的实体类型... .....................15
EntityFieldQuery........................ 46
总结... .......................................53
Views 集成... 54
Field Validation集成... ...................54
Views的集成................................. 58
Field Collection Views代码分析........ 75
总结............................................ 81
Rules的集成...................................... 82
Rules中的基本术语.......................... 82
Entity API提供了默认的Rules集成....... 83
定义自己的动作... ............................86
将rules规则导出到代码里面... .............101
为Rules自定义条件... .......................107
实现hook_rules_file_info. ................110
总结... ..........................................111
集成上下文链接... .................................112
接管theme_breadcrumb函数... ..........112
添加上下文链接................................. 115
实现预处理函数... ...............................121
通过hook_contextual_links_view_alter修改上下文链接... 122
Breadcrumb2已有问题的修正.................. 126
总结... ................................................131
Drupal主题系统探索................................... 132
无法在当前主题下面覆写breadcrumb.tpl.php. ....132
添加模板建议... .....................................138
template_preprocess_breadcrumb?... ....139
为模板新增变量$classes. ..........................140
drupal_static. .......................................143
不修改Drupal核心代码... ...........................146
Drupal核心模板文件..................................... 159
html.tpl.php........................................... 159
page.tpl.php........................................... 161
region.tpl.php. ........................................165
node.tpl.php........................................... 166
block.tpl.php........................................... 168
field.tpl.php............................................. 170
Batch API(批处理)........................................ 172
使用Batch API批量修改各种会员价格... .............172
VBO.. .....................................................185
最佳开发实践... ................................................189
编码规范... .................................................189
编写安全的代码............................................ 200
维护一个Drupal模块... ....................................211
Field Validation的历程....................................... 218
最初的解决办法... ...........................................218
Field validation的Alpha1版............................... 221
Field Validation Beta1版的改进.......................... 243
从Beta2到Beta6. .............................................245
Ctools插件开发... .................................................250
Ctools导入导出API............................................ 250
Ctools 插件开发................................................ 261
心得体会... .......................................................276
后记... .............................................................282
来自 http://item.taobao.com/item.htm?spm=a1z10.1.w4-17713562116.3.fHKX2r&id=18531971719
drupal.org账号:http://drupal.org/user/174740
Drupal专业开发指南译者。Think in Drupal系列中文资料的作者。Drupal实战作者。
第一章Drupal7主题制作 | 6 |
静态HTML分析 | 6 |
静态页面效果预览 | 7 |
静态页面源码分析 | 12 |
创建自己的主题 | 23 |
创建主题的info文件 | 24 |
默认的模板文件 | 26 |
创建自己的page.tpl.php | 33 |
启用主题 | 36 |
创建静态区块 | 37 |
控制区块的HTML输出 | 39 |
控制菜单区块的输出 | 41 |
区块的可见性设置 | 49 |
第二章 Views的覆写 | 51 |
创建内容类型“新闻” | 51 |
使用Views创建新闻列表区块 | 52 |
Views自带的样式设置 | 56 |
格式设置 | 57 |
Views模板文件覆写 | 61 |
views-view.tpl.php | 62 |
views-view-list.tpl.php | 67 |
Attachement | 70 |
第3章 表单覆写 | 76 |
区域的调整 | 76 |
表单覆写 | 79 |
Remember me模块 | 79 |
在hook_theme中注册表单 | 80 |
表单预处理函数 | 81 |
为表单创建模板文件 | 81 |
使用form_alter控制表单元素的theme_wrappers | 83 |
为表单元素添加Class | 83 |
去掉页面的标题/标签 | 85 |
表单数组结构分析 | 85 |
表单覆写示例2 | 88 |
首页的制作 | 92 |
创建page--front.tpl.php文件 | 93 |
在页面模板中直接输出区块 | 95 |
使用views_embed_view | 95 |
覆写html--front.tpl.php | 97 |
节点占位符 | 99 |
第4章 Drupal源码分析 | 101 |
路径分析 | 101 |
index.php文件 | 102 |
引导指令分析 | 104 |
drupal_bootstrap | 104 |
配置阶段 | 108 |
页面缓存阶段 | 109 |
数据库阶段 | 111 |
变量阶段 | 113 |
会话阶段 | 115 |
页面头部阶段 | 117 |
语言阶段 | 118 |
完成阶段 | 119 |
页面内容的生成与组装 | 121 |
菜单回调机制 | 121 |
主内容的生成 | 124 |
页面内容组装 | 132 |
使用drupal_render呈现页面数组 | 139 |
drupal_page_footer负责收尾工作 | 142 |
第5章 Drupal企业站 | 144 |
企业站需求分析 | 144 |
首页 | 144 |
产品列表页面 | 146 |
产品详细页面 | 147 |
联系我们页面 | 148 |
主题的选型 | 149 |
从头搭建企业站 | 150 |
创建内容类型“关于我们” | 150 |
使用webform创建“联系我们” | 152 |
添加百度地图 | 162 |
创建内容类型 | 165 |
添加测试内容 | 168 |
使用Views创建新闻列表 168 | |
Views附件显示 | 172 |
创建产品列表视图 | 177 |
完善主菜单 | 178 |
Superfish | 178 |
CKEditor + IMCE | 182 |
设置默认的文本格式 | 186 |
创建一个新的文本格式 | 187 |
第6章 企业站常用模块 | 189 |
主题制作 | 189 |
主菜单样式的调整 | 189 |
Menu Block | 192 |
Menu Position模块 | 196 |
使用Nodequeue控制产品列表 | 201 |
样式调整 | 205 |
Menu block样式调整 | 205 |
对面包屑和标题样式调整 | 206 |
调整页脚区域 | 207 |
Site map模块 | 209 |
创建“联系我们”区块 | 211 |
首页 | 212 |
首页幻灯 | 212 |
Features模块 | 214 |
使用Panels创建首页 | 217 |
Mini Panel的使用 | 220 |
主导航样式调整 | 222 |
第7章 Drupal多语言网站 | 224 |
界面的多语言化 | 224 |
添加语言 | 224 |
导入简体中文语言包 225 | |
Localization update模块 | 228 |
Localization client模块 | 232 |
内容的多语言化 | 234 |
Content translation VS Entity translation | 234 |
使用Entity translation模块翻译节点 | 235 |
使用Entity translation模块翻译分类术语 | 243 |
语言切换器区块 | 246 |
i18n模块 | 247 |
变量的翻译 | 249 |
菜单的翻译 | 253 |
区块的翻译 | 256 |
使用Menu block输出菜单 | 260 |
Views的翻译 | 261 |
使用jQuery解决无法翻译的字符串 | 263 |
首页的多语言化 | 263 |
Webform的翻译 | 269 |
字段标签的翻译 | 271 |
面包屑的翻译 | 271 |
Translation Management Tool 来自 http://item.taobao.com/item.htm?spm=a1z10.1.w4-17713562116.11.fHKX2r&id=19522641514 | 272
gi |