Jump to main content Jump to doc navigation

Server-side, Controllers fetch data, register assets, and load the Smarty templates that hold the bare markup; ExtJS renders the interface in the browser. AJAX calls go to a Connector (usually /connectors/index.php), which routes the request's action to a Processor that loads or changes data.

A controller is identified by namespace + action from the URL: the a parameter carries the action (read server-side from $_REQUEST), and namespace defaults to core. Core controllers and templates live in /manager/; extras keep theirs in their namespace directory under core/components/.

How an action resolves to a controller

Given ?a=some/action&namespace=mycomponent, the manager looks for the controller in this order (modManagerResponse::getControllerClassName()):

  1. PSR-4 class \MODX\Revolution\Controllers\Some\Action — if it exists, no file is loaded; preferred way in 3.x and available to extras.
  2. Legacy global class <Namespace><Action>ManagerController, e.g. MycomponentSomeActionManagerController (namespace and action split on /, each part ucfirst'd).
  3. File controllers/some/action.class.php.
  4. File controllers/some/action/index.class.php.

If no class matches, the file is looked up under controllers/ in this order: the active theme folder, default/, then the namespace root. Nothing found — the manager throws a not-found exception. Menu permissions (modMenu.permissions) are checked before the controller runs — see Menus.

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • Alex
  • A. Moreno
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more