Template types
The template name starts with a prefix, and the prefix decides where it is read from.
| Prefix | Source | Example |
|---|---|---|
@INLINE | template code in the string itself | view('@INLINE Hello, {$name}') |
@FILE / file: | a file under pageblocks_elements_path | view('file:blocks/card.tpl') |
@PATH / path: | a file at an arbitrary path | view('path:assets/chunks/hero') |
template: | a MODX template from the database | view('template:base') |
| no prefix | a MODX chunk (modChunk) by name | view('header') |
There is no fallback
The prefix picks one source, it does not define a search order. view('header') looks for a chunk named header and does not then try files; view('file:header') looks for a file and never looks at chunks. When nothing matches, MODX logs [Fenom]: Template … not found and the call returns an empty string. A blank spot on the page instead of an error is almost always this.
Extension
File templates (file:, path:) may omit the extension — .tpl is appended. An existing .tpl or .html is taken as is; any other extension is not recognised as one and .tpl gets appended on top of it.
view('file:blocks/article'); // → blocks/article.tpl
view('file:blocks/article.tpl'); // → blocks/article.tpl
view('file:mail/invoice.html'); // → mail/invoice.html📁 Where file templates live
file: and @FILE are resolved against pageblocks_elements_path, core/App/elements/ by default:
view('file:blocks/article.tpl');
// => looks for: core/App/elements/blocks/article.tplpath: and @PATH carry the directory themselves and ignore pageblocks_elements_path. The path is site-relative or absolute, understands the {core_path}, {base_path} and {assets_path} placeholders, and may not contain ..:
view('path:assets/chunks/hero'); // → /assets/chunks/hero.tpl
view('path:{core_path}elements/mail/ok'); // → core/elements/mail/ok.tplThis is the same mechanism as the block's Chunk directory field (chunk_path): it lets chunks sit next to the code that uses them instead of piling up in one directory.
Inside a template
The same prefixes work in {include}, {extends} and {insert} — they are engine providers, not view() parsing:
{extends 'file:templates/base.tpl'}
{include 'path:assets/chunks/hero'}
{include 'header'} {* no prefix - a MODX chunk *}Files only
With pageblocks_file_elements_only = true the template: provider is not registered at all, and any unprefixed name is treated as file:. Database chunks stop being reachable — both from view() and from {include}.