Chapter 11. Theme Components

11.1. Configuration File - theme.ini
11.2. Resources
11.3. Layouts
11.4. View Scripts
11.5. View Helpers

11.1. Configuration File - theme.ini

The configuration file, theme.ini, identifies the theme to Perforce Chronicle and specifies its initial configuration. The following example shows the contents of a typical configuration file:

; Chronicle Theme

title                   = Theme Name
version                 = 1.0
description             = A description of the theme.
icon                    = icon.png
tags                    = free-form, tags, describing, theme

[maintainer]
name                    = Maintainer Name
email                   = maintainer@email.address
url                     = http://www.maintainer.site

[stylesheets]
all.href[]              = reset.css
all.href[]              = text.css
screen.media            = screen
screen.href             = layout.css
print.media             = print
print.href              = print.css

[scripts]
javascript[]            = common.js

[regions]
sidebar.1.title         = Menu Widget
sidebar.1.type          = menu/widget
sidebar.1.options.menu  = sidebar

The following section provides details about the elements of the configuration file. All elements are optional unless they are specifically marked as required.

Table 11.1. Theme Configuration Elements

Element Description
title The title of the theme.
version The revision of the theme.
description Describes the general characteristics of the theme. For example, its appearance, special features, or intended use.
tags Descriptive terms for ad-hoc categorization of themes. Can be space or comma separated.
icon A graphic for the theme, specified using an absolute URL or a URL that is relative to the theme folder. The suggested size is 256 x 256 pixels.
maintainer The name, email, and web site of the theme maintainer.
stylesheets Defines the CSS stylesheets that need to be included during HTML presentation. Specify each stylesheet using an absolute URL or a URL that is relative to the theme folder. Stylesheets can target specific media types as follows:
[stylesheets]
all.href[]              = reset.css     ; All media types.
all.href[]              = text.css
screen.media            = screen        ; Only used when viewed on screen.
screen.href             = layout.css
print.media             = print         ; Only used when printing the page.
print.href              = print.css
Chronicle also support media queries. Please see the W3C's Media Queries Recommendation for more information. Here is an example:
[stylesheets]
mobile1.media[] = "screen and (max-width: 320px)"
mobile2.media[] = "screen and (max-width: 480px)"
You may also specify conditional stylesheets, which is used primarily to provide appropriate styling for the various versions of Internet Explorer. For example:
[stylesheets]
ie7.href        = ie7.css
ie7.condition   = lte IE 7
ie8.href        = ie8.css
ie8.condition   = IE 8
ie9.href        = ie9.css
ie9.condition   = gte IE 9
[Note] Stylesheet Aggregation

Stylesheets are automatically aggregated and compressed when the Application Environment is configured for production use.

regions Defines widgets to be installed in named regions when the theme is applied. The format of the section is as follows:
<region-name>.<widget-id>.<property> = <value>
Valid properties for widgets in the regions section are as follows:
[regions]
sidebar.1.title         = Menu Widget   ; Label displayed with the widget.
sidebar.1.type          = menu/widget   ; (Required) Widget type identifier.
                                        ; Widget types are defined by modules
                                        ; and declared in module.ini files.
sidebar.1.options.menu  = sidebar       ; Provides default widget configuration.
sidebar.1.options.foo   = bar
scripts A list of client-side script files to include on every page. You must group scripts by type (e.g. javascript, vbscript). Specify each script using an absolute URL or a URL that is relative to the theme folder.
doctype Specifies the version of markup that this theme is written in. The default is XHTML1_STRICT. Valid values are as follows:
  • XHTML11
  • XHTML1_STRICT
  • XHTML1_TRANSITIONAL
  • XHTML1_FRAMESET
  • XHTML_BASIC1
  • HTML4_STRICT
  • HTML4_LOOSE
  • HTML4_FRAMESET
  • HTML5
menus Defines menus and menu items to be installed when the theme is applied. For example:
[menus]
some-menu.test.label            = A Test Link
some-menu.test.uri              = "http://example.com"
some-menu.test.pages.sub.label  = A Link under Test
some-menu.test.pages.sub.uri    = "http://example.com/sub"
meta Defines document metadata to include on every page. Support is provided for named meta tags (such as description and keywords) as well as http-equiv tags (such as content-type). For example:
[meta]
name['description']         = 'A description to appear on all pages'
name['keywords']            = 'keywords, to, appear, on, all, pages'
httpEquiv['Content-Type']   = 'text/html; charset=UTF-8'
types Defines content types to be installed when the theme is applied. Content types control the structure of content entries. For example:
[types]
some-type.label                             = Custom Page
some-type.group                             = Pages
some-type.iconFile                          = images/icon-page.png
some-type.elements.title.type               = text
some-type.elements.title.options.label      = Title
some-type.elements.title.options.required   = true
some-type.elements.title.display.tagName    = h1
some-type.elements.title.display.filters[]  = HtmlSpecialChars
some-type.elements.body.type                = editor
some-type.elements.body.options.label       = Body
some-type.elements.body.display.filters[]   = DefaultStripTags
Valid values for settings in this section are as follows:
label
The name of the content type.
group
The category that the content type belongs to.
iconFile
An icon representing the content type, specified as a URL relative to the theme folder.
elements
A list of elements that compose the content type. Each element can have multiple properties. For details, please see Section 4.6, “Specifying Content Type Elements”.

Perforce Chronicle - Release: 2012.2/486814