您的位置:首页 > 其它

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 文件的内容
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: