We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4971
    • 964 Posts
    If I create a new TV and assign input type (say checkbox)...
    and then assign it to a template.

    How do I update all the pages with that TV?
    Do I have to go and open each of the pages and select a value?

    It does not update automatically if I set a default either...

    Any pointers?
    TIA
      Website: www.mercologia.com
      MODX Revo Tutorials:  www.modxperience.com

      MODX Professional Partner
      • 3749
      • 24,544 Posts
      I don’t know if Batcher or Janitor would do that for you, but it’s worth checking.

      Otherwise, you can write a fairly simple snippet, something like this:

      $id = 12; // ID of the Template Variable itselfl
      
      $tv = $modx->getObject('modTemplateVar',$id);
      
      $resourceIds = array(1,3,4,5,6,7);
      
      foreach($resourceIds as $resourceId)
      $tv->setValue($resourceId,'value');
      $tv->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
        • 4971
        • 964 Posts
        Yes, that is the way to go Bob...
        Janitor only has DB kind of stuff now...
        and I also thought that Batcher could do it, but
        it only plays with publish/unpublish, container/no container, etc...
        document settings...

        I am thinking on putting it as a Batcher feature in Redmine...


        thanks for the snippet Bob, I will play with it...
          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 28215
          • 4,149 Posts
          FYI, Redmine does *not* handle Extras issues. Please file Extras issues in their own issue management tools. Batcher’s is here:

          http://github.com/splittingred/Batcher/issues/
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com