Override ordering
This page is for designers whose override does not win. Several rules can match the same page; only the first in order is used.
Contents
The order
eZTemplateDesignResource::overrideArray() (kernel/common/eztemplatedesignresource.php) sorts the rules by their
Priority: lower values are evaluated first, and a rule without Priority sorts last. For each template, the first rule
whose conditions all match wins; the rest are not looked at.
Specific before general
# one node
[mytheme_full_frontpage]
Source=node/view/full.tpl
MatchFile=full/frontpage.tpl
Subdir=templates
Match[node_remote_id]=mytheme-front
Priority=0
# a class in a place
[mytheme_full_article_in_blog]
Source=node/view/full.tpl
MatchFile=full/blog_article.tpl
Subdir=templates
Match[class_identifier]=article
Match[parent_class_identifier]=blog
Priority=10
# a class
[mytheme_full_article]
Source=node/view/full.tpl
MatchFile=full/article.tpl
Subdir=templates
Match[class_identifier]=article
Priority=20Leave gaps (0, 10, 20) so a rule can be inserted later without renumbering.
Rules from several files
Rules from the siteaccess, from extensions and from extension siteaccess files are merged into one list before
sorting. Without Priority, their relative order depends on the order in which the files are read, which is hard to
predict: give every rule of a theme a Priority.
Reordering in the administration
Design > Template Editor shows the overrides of a template in their evaluation order and lets you reorder them by
drag and drop; it writes Priority values (10, 20, 30 ...) for that template's rules, and new rules get Priority=0
(Template editor overrides).
Debugging
- Turn on template path comments: the page source names the template that won (Template path comments).
- List all rules for the
Sourcein the Template Editor, in order, and read their conditions top to bottom. - Remember the INI and template override caches after every change.
Related pages
- Override basics
- Override match keys
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.