Blog Sections Open

Why MODX API Mode Can Still Leave You with an Empty Config Array

A practical bootstrap note for standalone PHP scripts that include Evolution CMS through API mode.

Turning on MODX_API_MODE is only the first step in bootstrapping Evolution CMS from an external script. If the config array still appears empty, the problem is usually not the constant itself but when and how the environment is being initialized.

Typical bootstrap

define('MODX_API_MODE', true);
require_once('index.php');
$conf = (array) $modx->config;

Why values may still look empty

  • The script reads values before the CMS is fully initialized.
  • The included file path is correct, but the expected context is not loaded yet.
  • The build behaves differently than examples from another distribution.

For Evo API scripts, always verify the actual bootstrap sequence and test with one known config value first. Once that works, expand the script gradually instead of assuming the whole runtime is ready immediately.

Newer post

Getting a Resource Title and TV Value by Document ID

How to fetch another document’s title or TV value in Evolution CMS when you only have the resource ID available in the current template logic.

Older post

Changing Link Text Based on the Current Parent Section

How to vary link text or UI labels depending on the current parent section by using UltimateParent-style logic in Evolution CMS.