drupal THEME主要文件
2015-06-28 23:00
232 查看
**.info 文件**
.info 文件是一个必需的文件:Drupal 必须包括它,才能看到主题。.info 文件告诉 Drupal 主题的内部名称。例如,如果这个文件的名称是 ibmtheme.info,那么 Drupal 给这个主题的名称将是 ibmtheme。如果您的主题使用 JavaScript、元数据、样式表或块区域等元素,您也必须在 .info 文件中定义它们。一切都是可选的。在 清单 1 中,Bartik 主题的 .info 文件内容解释了这种行为。
清单 1. Bartik 主题的 .info 文件内容
; Id:bartik.info,v1.52010/11/0700:27:20driesExpId: bartik.info,v 1.5 2010/11/07 00:27:20 dries Exp
name = Bartik
description = A flexible, recolorable theme with many regions.
package = Core
version = VERSION
core = 7.x
stylesheets[all][] = css/layout.css
stylesheets[all][] = css/style.css
stylesheets[all][] = css/colors.css
stylesheets[print][] = css/print.css
regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted
regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second
regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last
regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer
settings[shortcut_module_link] = 0
; Information added by drupal.org packaging script on 2011-01-05
version = “7.0”
project = “drupal”
datestamp = “1294208756”
**.tpl.php 模板文件**
主题目录包含若干个模板文件,其文件名如 xxx.tpl.php。这些模板文件包含主题的 Extensible HTML (XHTML) 标记和 PHP 变量。在某些情况下,您可以编写它们,以提供其他类型的数据输出,如 RSS。一般来说,每个 Drupal 主题的 tpl.php 文件都进行编码,以处理特定的数据输出:在模板文件中嵌入复杂的逻辑有可能带来混乱,并事与愿违,因为这样做有可能使它们难以维护。理想的场景是让它们只包含简单的 XHTML 标记和 PHP 变量。
清单 2. Garland 主题 node.tpl.php 文件的内容
.info 文件是一个必需的文件:Drupal 必须包括它,才能看到主题。.info 文件告诉 Drupal 主题的内部名称。例如,如果这个文件的名称是 ibmtheme.info,那么 Drupal 给这个主题的名称将是 ibmtheme。如果您的主题使用 JavaScript、元数据、样式表或块区域等元素,您也必须在 .info 文件中定义它们。一切都是可选的。在 清单 1 中,Bartik 主题的 .info 文件内容解释了这种行为。
清单 1. Bartik 主题的 .info 文件内容
; Id:bartik.info,v1.52010/11/0700:27:20driesExpId: bartik.info,v 1.5 2010/11/07 00:27:20 dries Exp
name = Bartik
description = A flexible, recolorable theme with many regions.
package = Core
version = VERSION
core = 7.x
stylesheets[all][] = css/layout.css
stylesheets[all][] = css/style.css
stylesheets[all][] = css/colors.css
stylesheets[print][] = css/print.css
regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted
regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second
regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last
regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer
settings[shortcut_module_link] = 0
; Information added by drupal.org packaging script on 2011-01-05
version = “7.0”
project = “drupal”
datestamp = “1294208756”
**.tpl.php 模板文件**
主题目录包含若干个模板文件,其文件名如 xxx.tpl.php。这些模板文件包含主题的 Extensible HTML (XHTML) 标记和 PHP 变量。在某些情况下,您可以编写它们,以提供其他类型的数据输出,如 RSS。一般来说,每个 Drupal 主题的 tpl.php 文件都进行编码,以处理特定的数据输出:在模板文件中嵌入复杂的逻辑有可能带来混乱,并事与愿违,因为这样做有可能使它们难以维护。理想的场景是让它们只包含简单的 XHTML 标记和 PHP 变量。
清单 2. Garland 主题 node.tpl.php 文件的内容
相关文章推荐
- ls目录结构
- WEB_容器_tomcat_本地运行源码_审
- 1011--映射一对多关联关系(.单向 n-1)
- java中调整字体
- Spring 配置log4j和简单介绍Log4J的使用
- 编译器错误消息: CS0234: 命名空间“System.Web”中不存在类型或命名空间名称“Optimization”(是否缺少程序集引用?)
- iOS面试题01
- Java 中基本类型和包装类之间的转换
- web系统架构设计中需要知道的点(前端篇)
- Linux下磁盘管理
- Node.js学习-----------搭建一个简单的HTTP服务器
- 第4天-sql通配符与正则式
- ViewPager,OnPageChangeListener及PageTransformer
- Linux的setup命令启动服务名称和功能
- win8 安装程序时出现2502 2503错误解决方法
- jdbc导包的方法:
- Android中Dialog设置外部点击事件
- 6月acm训练小结(排序与检索)
- 对象和类,日历
- LIVE555研究之三:LIVE555基础