N1 Nex1on

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

FieldWhat to enter
Viewfrom the list: only views that have a ready starter (the same one used by “Create from the view” in the theme editor)
ConditionCategory — the key (slug) or number of the page’s category; Address — the page path, for example /shop/* (the asterisk stands for any tail)
Theme filea 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

  1. The record template from the news “Templates” section (text in the database) — if set, it takes priority over everything.
  2. The first matching rule from top to bottom (change the order with the arrows; a rule can be turned off).
  3. A file named <view>.<category-key>.tpl.html — the earlier way, which works as it always did.
  4. 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

On this page
Share: Telegram WhatsApp
You can save things without signing in: they stay in this browser and you can move them to your account after signing in. Sign in
Discussion

Comments

No discussion yet

No one has commented yet. Be the first.

Report this post