Blog Sections Open

Understanding OnWebPagePrerender and Cached Output

A cache-debugging note for developers who expect OnWebPagePrerender changes to be frozen in the page cache but see output still changing on every request.

OnWebPagePrerender is often described as running just before cached output is written, which makes it sound like any change there should become part of the cached page permanently. In practice, developers sometimes see the opposite.

the underlying example

$out = &$modx->documentOutput;
$out = str_replace('<title>', '<title>' . date('H:i:s'), $out);

If the time in the title changes on every refresh, it means the code path is still affecting output after the cache assumptions you expected.

How to reason about it

  • check whether the page is really being served from full document cache
  • check whether an uncached snippet or plugin changes output afterward
  • confirm whether your test page is excluded from cache for another reason

Why this matters

Cache debugging in Evolution CMS is rarely about one event in isolation. It is about the full rendering chain: cached document output, uncached snippet calls, plugins, and any later output transformations.

Newer post

Why Strict URLs Can Break POST-Based Forms

A form-handling warning for legacy projects where URL normalization redirects interfere with POST data and silently break form processing.

Older post

Why a Simple @SELECT TV Binding Can Trigger a 500 Error

A migration troubleshooting note for cases where a previously normal @SELECT TV suddenly starts failing after a hosting move.