Chapter 10. Anatomy of a Theme

10.1. Overview
10.2. Folder Structure
10.3. Components

10.1. Overview

Themes are files containing HTML, CSS, javascript, plus images or other multimedia resources that work together to provide the design and functionality of your Perforce Chronicle site(s). Multiple themes may be available so that you may quickly change the look of a site. Themes may adjust the presentation in small and large ways, from adjusting font sizes to providing custom markup for all Chronicle operations.

The primary benefit of using themes is that it separates the presentation of your content from the code that manages content. This separation allows modules to be added/removed, or Chronicle to be upgraded without losing your customization work or requiring significant updates to maintain the visual design of your site.

The secondary benefit of themes, particularly when a large number of themes are available, is that you do not need to know or learn HTML, CSS, JavaScript, or even PHP in order to have a good-looking site, nor to change the visual design or layout.

This guide helps theme designers, or those wishing to customize a theme, to understand how themes work with Chronicle, where a theme's files and resources must be placed, and describe a theme's components to create a unique look for your site. This guide helps theme designers (or those wishing to customize a theme) to understand how themes work with Chronicle, where a theme's files and resources must be placed, and also describe how a theme's components can be changed in order to create a unique look for your site.

Chronicle does not use a one-file-per-web-page approach. Generally, there is no single file that can be edited to adjust the presentation for a single page. Instead, Chronicle generates web pages by combining several components such as content entry values, a view script and a layout. Default view scripts and layouts are provided but the theme has the option of providing customized versions. This approach makes web content management more powerful and sophisticated, but it requires you to understand how the various theme components work together.

[Note] Multiple Sites

Chronicle can host multiple sites and each site can share a theme with other sites or use its own theme. For a specific site, only one theme can be active at a time.

10.1.1. Specifying Page Layout

Configure common aspects of a theme, relative to the theme's folder (represented as THEMEDIR below) as follows:

  • Page header and footer: Put markup into THEMEDIR/layouts/default-layout.phtml
  • Home page body: For the content that is displayed between the header and footer on the web site home page, put the markup in THEMEDIR/views/content/index/index.phtml
  • Content on other pages: Define a content type that contains layout elements (title, body text, sidebar text, etc.), and create a view script for this content type that contains the markup. The view script name must correspond to the content type: THEMEDIR/views/content/index/view-type-<content-type-id>.phtml.
Perforce Chronicle - Release: 2012.2/486814