Design combinations
A siteaccess rarely uses one design on its own. It names a main design, adds fallback designs, and every active extension can bring files for any of them. Exponential combines all of these into one ordered list of directories, the design bases, and looks for every template, image and style sheet along that list. The first file found is used. This is what lets you change one template of a site without copying the rest.
The order of the design bases
Following kernel/common/eztemplatedesignresource.php, the list is built like this:
- The designs, in this order: SiteDesign, then each design in AdditionalSiteDesignList[], then StandardDesign (site.ini [DesignSettings]). A name that appears twice is used once.
- For each design, first the extensions that have a directory of that name, in the reverse order of design.ini [ExtensionSettings] DesignExtensions[] (the extension listed last comes first), then design/<design> of the installation.
With SiteDesign=mysite, AdditionalSiteDesignList[]=base and two design extensions listed as ext_a, then ext_b, the bases are:
extension/ext_b/design/mysite extension/ext_a/design/mysite design/mysite extension/ext_b/design/base extension/ext_a/design/base design/base extension/ext_b/design/standard extension/ext_a/design/standard design/standard
Only directories that exist are in the list.
How a template is found
For a template such as node/view/full.tpl the system first checks the override rules of override.ini that apply to the page (by class, node, section, view mode and so on). For a matching rule it looks for the rule's MatchFile in the override/templates/ directory of each design base, in order. When no rule matches, it looks for templates/node/view/full.tpl in each design base, in order. design/standard has every standard template, so the search always ends there at the latest.
<?php /* #?ini charset="utf-8"? # settings/siteaccess/site/override.ini.append.php [full_article] Source=node/view/full.tpl MatchFile=full/article.tpl Subdir=templates Match[class_identifier]=article */ ?>
Here every article shown in the full view uses override/templates/full/article.tpl of the first design base that has it. Rules are tried in order; rules with a Priority come first, the lowest number first.
Design in extensions
An extension that brings design files lists itself in its settings/design.ini.append.php:
<?php /* #?ini charset="utf-8"? [ExtensionSettings] DesignExtensions[]=myextension */ ?>
Its design/standard/ directory then adds templates to every siteaccess, and its design/<name>/ directories add to the siteaccesses that use that design. After adding a template file or an override rule, clear the template override cache: php bin/php/ezcache.php --clear-id=template-override --allow-root-user.
To see which file answered, switch on template path comments or open the debug bar's Templates tab; see the Templates and design guide. Ordering of overrides from several extensions: Template override ordering.
Contributors
- Balazs Halasy
- Geir Arne Waaler
- Kristof Coomans Commenter
- Graham Brookins Updated Maintainer
Comments (1 historical)
Written by readers of the earlier documentation sites, kept as they were.
Design in extensions
Kristof Coomans ·
Also write something about design extensions and in which order will they be processed?