drupal THEME主要文件

**.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:20driesExp 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 文件的内容

原文地址:https://www.cnblogs.com/mfrbuaa/p/5128240.html