OnLoadWebPageCache
Last updated Apr 12th, 2019 | Page history | Improve this page | Report an issue
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
Budget
$194 per month—let's make that $500!
Learn moreEvent: OnLoadWebPageCache¶
Fires after a Resource is loaded from the cache. If the Resource is not cached, this event will not fire.
- Service: 4 - Cache Service Events
- Group: System
Event Parameters¶
| Name | Description |
|---|---|
| resource | A reference to the modResource instance restored from the cache. Passed by reference. |
Notes¶
This event is triggered inside the getResource() method in core/src/Revolution/modRequest.php.
_content holds the rendered Resource (its template): cached placeholders are replaced with values, uncached placeholders stay as markup.
Other Resource properties are overridden the same way:
// Override Pagetitle
$modx->event->params['resource']->pagetitle = 'My New Pagetitle';
TVs are cached as arrays. Read or override element 1:
// Reading value of TV named "my_tv"
$my_tv = $modx->event->params['resource']->my_tv[1];
/*
// The cached TV array
array (
0 => 'name_of_tv', // TV name
1 => 'Value of TV Goes here', // TV value
2 => 'default', // TV display option
3 => array (), // TV display_params
4 => 'text', // TV type
)
*/
To see the stored structure, open the generated cache files in core/cache/resource/web/resources/.
See Also¶
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
Budget
$194 per month—let's make that $500!
Learn more










