Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dzhuryn/2ef410548d75bb4192f0898170ade9f9 to your computer and use it in GitHub Desktop.
Save dzhuryn/2ef410548d75bb4192f0898170ade9f9 to your computer and use it in GitHub Desktop.
modResource example
require_once MODX_BASE_PATH.'assets/lib/MODxAPI/modResource.php';
$R = $modx->getFullTableName('site_content');
$sql = "select id from $R where `template` in (5,21)";
$docs = $modx->db->makeArray($modx->db->query($sql));
foreach ($docs as $doc) {
$obj = new modResource($modx);
$obj->edit($doc['id']);
$obj->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment