Skip to content

Settings

Three MODX system settings, area parser:

SettingWhat it doesDefault
pageblocks_elements_pathDirectory of file templates for @FILE and file:.{core_path}App/elements/
pageblocks_file_elements_onlyRead templates from files only, never from database chunks.false
pageblocks_fenom_auto_reloadRecompile a template when its file changes.true

The path is absolute, not "relative to core/"

The value goes into a filesystem path verbatim, so it has to be absolute. MODX expands the {core_path}, {base_path} and {assets_path} placeholders itself — that is what the {core_path}App/elements/ default relies on. Writing App/elements/ does not work: it resolves against the current working directory, the directory is not found, and MODX logs [Fenom Init] Template directory does not exist.

pageblocks_file_elements_only

Turning it on does not merely "speed things up" — it changes how a template name is parsed:

  • an unprefixed name is read as file:, not as a MODX chunk;
  • the template: provider is not registered at all.

So {include 'header'} starts looking for header.tpl on disk. This is for projects that keep elements in git rather than in the database.

pageblocks_fenom_auto_reload

Turning it off in production only makes sense where templates do not change between deploys: with it off, editing a .tpl has no effect until the cache is cleared. In pbFenom the freshness check is cheap — realpath() was taken off the hot path, and a page with {extends} plus twenty {include} costs 7.6 µs against 4.5 µs without auto reload — so there is not much to save here.

Fixed in code

The rest comes from View::init() and is not configurable:

OptionValueWhy
compile directorycore/cache/pbfenom/cleared together with the MODX cache
force_includetrue{include} is compiled into the parent's body
force_verifytruean undeclared variable is an empty string, not a warning
force_compile, disable_cachefalsethe artifact is written to disk and reused
disable_native_funcsnot setsee PHP functions

Clearing the cache

Compiled templates live in core/cache/pbfenom/. Clearing the cache from the MODX manager runs:

php
View::clearCache();

Clearing the directory by hand is not needed — with auto_reload on, editing a file already triggers a recompile.

© PageBlocks 2019-present