Hi,
In evolution, when we wanted to change the default template there was an option to reset all the documents to the new template set as default, but I cannot find it in revo. Any idea how can I do it?
Batcher could be a great solution but I must do it page by page and there is no option to change template to all the documents.
Quote from: mIDO at Sep 06, 2010, 10:47 AM
Hi,
In evolution, when we wanted to change the default template there was an option to reset all the documents to the new template set as default, but I cannot find it in revo. Any idea how can I do it?
Batcher could be a great solution but I must do it page by page and there is no option to change template to all the documents.
It’s been requested as a feature, but I don’t think it exists yet. Batcher might accept a comma-delimited list, or 1-99, I haven’t tried it.
You could write a snippet using getCollection() that would change them all. You could also use PhpMyAdmin and edit the site_content table to change the ID in the template column. It would be faster than doing them one at a time.
The snippet would look like this:
<?php
$template = 2; // set this to the ID of the desired template
$resources = $modx->getCollection('modResource', array('class_key'=>'modDocument');
foreach ($resources as $resource) {
$resource->set('template',$template);
$resource->save();
}
?>