We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6371
    • 11 Posts
    Hi guys,

    I have to modify the template of a huge number of pages in my Revo website. I’ve found Batcher that should do the job, but I really can’t get it work. I install it with package manager, find the ’Batcher’ menu under components and I start it. But no pages are shown and if I hit ’Refresh’ it keeps saying "Loading..." with no results.

    Are there any alternatives to bulk-change the template of the pages?

    Thank you.
      • 3749
      • 24,544 Posts
      Is there a way to identify which ones need changing (e.g., change all pages with a given template to another template)? If so, a really simple snippet would do it for you.

      I’m not sure why Batcher didn’t work for you. I’ve used it to change templates. You might try removing it completely and re-downloading it.
        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
        • 6371
        • 11 Posts
        Hi BobRay, thank you for your answer.

        I really can’t get Batcher working and I can’t figure out what’s the problem.

        Could you give me some advices about this snippet? I definitely can identify which pages I need to change, and they are exactly belonging to the same template. So I need to change all the pages with template n. 34 to template n. 57, for example.

        How can I do it?

        Thank you.
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          1. Get all the objects with a template of ID 34, using:
           $objects = $modx->getCollection('modResource',array('template' => 34));

          2. Loop through them with a foreach and change the value and save.
           foreach ($objects as $object) {
            $object->set('template', 57);
            $object->save();
          }

            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 6371
            • 11 Posts
            Ok, great. Thank you!