语法与 INI 文件类似。.info文件本质上就是一个配置主题的文本文档。该文本文档的每一行都是一个键-值对,左边是键名,右边是值。 中间再加个等号。(例如: key = value ) 分号用以在行外面添加注释。某些键需要特殊的语法。添加方括号组合一系列关联的值,相当于一个“数组”。如果你并不熟悉数组,使用这种键值对时就应该保持足够的简单易懂。你可以参考Drupal中默认的.info文档,仔细阅读其中的注释信息
The version string will automatically be added by drupal.org when a release is created and a tarball packaged. So you may omit this value for contributed themes. However, if your theme is not being hosted on the drupal.org infrastructure, you can give your theme whatever version string makes sense. 设置你开发的主题的版本。
The drupal.org packaging script automatically sets this value based on the Drupal core compatibility setting on each release node. So people downloading packaged themes from drupal.org will always get the right thing. However, for sites that deploy Drupal directly from CVS, it helps if you commit this change to the .info file for your theme. This is also a good way to indicate to users of each theme what version of core the HEAD of CVS is compatibile with at any given time.
engine (建议)
一般情况下直接设置为phptemplate就可以了。The theme engine, which is used by the theme. If none is provided, the theme is assumed to be stand alone, i.e., implemented with a “.theme” file. Most themes should use “phptemplate” as the default engine.
PHPTemplate’s job is to discover theme functions and templates for the behavior of the theme. Omit this entry only if you know what you are doing.
engine = phptemplate
base theme
当你的主题需要作为子主题来使用时,给他指定一个基础主题。Sub-themes can declare a base theme. This allows for theme inheritance, meaning the resources from the “base theme” will cascade and be reused inside the sub-theme. Sub-themes can declare other sub-themes as their base, allowing multiple levels of inheritance. Use the internal “machine” readable name of the base theme. The following is used in Minnelli, the sub-theme of Garland.
features[] = logo features[] = name features[] = slogan features[] = mission features[] = node_user_picture features[] = comment_user_picture features[] = search features[] = favicon ; These last two disabled by redefining the ; above defaults with only the needed features. ; features[] = primary_links ; features[] = secondary_links
Traditionally, themes could add javascripts by calling
drupal_add_js() in their template.php file. Starting in 6.x, themes can also add javascripts by adding lines to their .info file:
scripts[] = script.js More details are available in the JavaScript & jQuery section.
php
定义主题可以支持的最低
PHP版本 。The default value is derived from the
DRUPAL_MINIMUM_PHP constant, which is the minimum required version for the rest of core. This can be redefined for a newer version if needed. For most themes, this should not be added.
; $Id: minnelli.info,v 1.7 2007/12/04 20:58:44 goba Exp $ name = Minnelli description = Tableless, recolorable, multi-column, fixed width theme. version = VERSION core = 6.x base theme = garland stylesheets[all][] = minnelli.cssNote that everything from the line “; Information added by drupal.org packaging script on 2008-02-13″ and down is added by the drupal.org packaging script. You should never manually add the project and datestamp keys. The version key added manually (in the first section) allows sites to use your theme when taken directly from CVS.
; Information added by drupal.org packaging script on 2008-02-13 version = “6.0″ project = “drupal” datestamp = “1202913006″
; Information added by drupal.org packaging script on 2008-02-13 version = “6.0″ project = “drupal” datestamp = “1202913006″