Home > Drupal Themes making > Code for Building a .info File in drupal

Code for Building a .info File in drupal


As of Drupal 6, a .info file is required as part of a valid theme distribution. The
.info file contains a number of pieces of information intended to inform the system about the theme and to set configuration options. The syntax throughout this file is consistent, use key = value. Semicolons can be used to add comments or commentout options. In the event that optional values are not stated, the system will assume default values.
To get started, open up the .info file you created a short while ago and add
the following:First, a name key is required by the system. Note this is a human-readable value. Forour theme, this entry will appear as follows:
name = kajal
Next, let’s add a description. This data will appear in Drupal’s theme manager
alongside the theme name and screenshot. This key is optional but as it is very helpful, we’re going to include some information here:
description = A simple theme for Drupal.
The core key is required to keep the system from disabling our theme due to
incompatibility.
core = 6.x
Add the engine key as follows (in the absence of this key, the system will assume this is a pure PHP theme):
engine = phptemplate
The regions key sets the regions available for block assignment. Note that this key is not necessary unless you wish to vary from the default set of regions. We’ve included the regions keys information in this example simply to show the variation in syntax that is required by this key. To set regions, use the following notation:
region[machine_readable_name] = human readable name, for example:
region[head] = Head
region[left] = Left Sidebar
region[right] = Right Sidebar
region[content] = Content
region[footer] = Footer

The .info file can be also used to enable the various theme configuration features, like the site mission, site name, logo, etc. To specify features use the syntax features[] = name of feature. In the absence of a contrary definition, the system will assume the presence of all the following:
features[] = logo
features[] = name
features[] = slogan
features[] = mission
features[] = node_user_picture
features[] = comment_user_picture
features[] = search
features[] = favicon
features[] = primary_links
features[] = secondary_links

Should you not want any of these features, simply delineate the ones you wish to see in the .info file and omit the ones you do not wish to see. As we want to enable all the default features, we need to add nothing to our .info file. In this fashion, the system will enable all the default features, above, giving our site administrator the widest number of configurations for Kajal.

With all the options above (and more), .info files can be quite lengthy. The
garland.info file (themes/garland/garland.info) for example, shows a relatively complex .info file. However, given our new theme’s heavy reliance on default values, our .info file will be short and sweet:
name = Kajal
description = A simpletheme for Drupal.
core = 6.x
engine = phptemplate

Categories: Drupal Themes making
  1. February 6, 2010 at 5:47 am

    Hi. Very interesting site. I found it on Bing. I will definately recommend it to my friends. Please keep up the great work.

    • February 6, 2010 at 11:04 am

      Thanks Ramon..

      Regards,
      Kajal Mondol
      kajal4ever.wordpress.com

  2. February 8, 2010 at 10:43 am

    Keep it up,great job!

    • February 8, 2010 at 12:07 pm

      Thanks.

  1. No trackbacks yet.

Leave a comment