We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19388
    • 297 Posts
    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.
      • 3749
      • 24,544 Posts
      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();
      }
      ?>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 19388
        • 297 Posts
        Batcher might accept a comma-delimited list, or 1-99, I haven’t tried it.
        Where it is? I can see only the filter but it does not accept 1-99, nor 1,2 for example. Anyways, I think it will show results paginated. I was looking for a native solution, but as you said, sometimes could be faster to write our own snippet or do it in DB directly.
        Thanks for your help