The theme layer
Everything that gives a site its form lives in theme/. The engine renders; the theme decides what the rendering looks like.
Where it sits
public/ the web root — what the server serves
index.php a three-line bootstrap: the only door
data/ content as Schema.org JSON (public, served as files)
assets/ css, js, images, fonts (public, served as files)
guide/ the site's own notes for the AI (never served)
theme/ form — yours (never served as files)
config.php what the site is: name, languages, opt-ins
functions.php your presentation helpers
index.php redirects, form handlers, explicit routes
templates/ page shells — shared in templates/, per language in templates/<lang>/
sections/ page blocks
snippets/ head/body fragments
strings/ interface words, per language
Two rules follow. The theme is never served as files: /theme/anything is a 404; a template is reached only through the router. Every theme PHP file starts with defined('LOAM') || exit; — the constant is defined inside the engine, so a stray or directly requested file exits.
The three files the engine knows by name
| File | Holds |
|---|---|
config.php |
Site knowledge only: the organisation entity, the default language, opt-in constants. No paths, no requires — the engine is loaded before it is read. Server values do not belong here. |
functions.php |
Your presentation helpers: date and price formatting, typed-entity wrappers, breadcrumb trails, card field mappings. Must exist; may be nearly empty. |
index.php |
Three tables as plain data: redirects (old → new, 301), post_routes (form handlers), routes (path → shell). The exception layer, empty on most sites — a page needs no route line, and the router carries no addresses of its own. |
Templates, sections, snippets
Templates are the page shells: in templates/ itself for every language, in templates/<lang>/ where a language needs its own (a one-language site keeps no language folder). Which shell renders which page is the ladder’s decision. Sections are the blocks a page is composed of — header, hero, footer — pulled with section('header'). Snippets are head or body fragments — meta tags, a decorative graphic — pulled with snippet('meta').
Those two calls plus svg('name') (inline icons from assets/icons/) are the only include forms. They take a name under their own folder — a subfolder is allowed, .. and a leading slash are not — and resolve the same from anywhere. A missing target renders as an HTML comment, never a fatal error. They are draft-aware: in a preview a staged section wins over the live one, even one that exists only as a draft.
section() passes no variables. A section that needs page input is included from the shell, so the variables are in scope: a block either stands alone or is visibly bound to its page.
What is yours and what is not
theme/, data/, assets/ and guide/ are the project’s. The engine is generic and replaced whole on an update; it contains nothing of the site. To change how a page looks, edit the theme. To change the engine, talk to CTXR.