View rules
How to tell page views which theme file to draw them from.
“Appearance → Theme editor → View rules” (site owner only, the theme editor must be on). A rule says: this kind of page, when the page is like this, draw it from this file of your theme. It works for any view that your own theme may replace: a news record and news feed, forum, shop, “Page”, search, feedback, messages.
How to write a rule
| Field | What to enter |
|---|---|
| View | from the list: only views that have a ready starter (the same one used by “Create from the view” in the theme editor) |
| Condition | Category — the key (slug) or number of the page’s category; Address — the page path, for example /shop/* (the asterisk stands for any tail) |
| Theme file | a file in the views folder of your theme without the extension: news/show.photos means views/news/show.photos.tpl.html |
For a module view (news::show, forum::section, shop::index) the file name is inside the module’s folder of your theme: rule-x means views/news/rule-x.tpl.html (not news/rule-x).
One file can serve several rules: three categories with one gallery are three rules for one file.
Order and priority
- The record template from the news “Templates” section (text in the database) — if set, it takes priority over everything.
- The first matching rule from top to bottom (change the order with the arrows; a rule can be turned off).
- A file named
<view>.<category-key>.tpl.html— the earlier way, which works as it always did. - The regular view of the theme.
If the rule’s file is missing (deleted or mistyped), the page does not break: it is drawn with the regular view.
Security
Only the owner changes rules; saving needs the password (a 5-minute window), and every change is logged. The file name and values are checked against a whitelist of characters; the file is rendered with the same tag language as the others (no PHP and no function calls). After any change the page cache is cleared.
Updated 16.10.2026
No one has commented yet. Be the first.