M
M
medvedgoff2022-02-20 13:40:16
MODX
medvedgoff, 2022-02-20 13:40:16

How to update edition to the current time in modx when opening a resource?

You need to change the date in editon to the current one so that it is relevant in lastmodifed, since the page is dynamic, and constantly manually updating the resource is not relevant. How to update this date when accessing a resource or doing an update via cron.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danny Arty, 2022-02-20
@DanArst

And don't forget to check the OnLoadWebDocument event in the System Events tab when creating the plugin . This is just an example, but this plugin will change the editedon field of all resources when they are opened in the browser. Accordingly, you still need to add your own condition so that it changes only the resources you need.

<?php
switch ($modx->event->name) {
    case 'OnLoadWebDocument':
        $modx->resource->set('editedon', date());       
    break;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question