We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2734
    • 165 Posts
    Hello everybody.

    I’m currently developing a plugin for MODx 0.9.6 to create resized Images when a Document is saved.
    So far i used the "OnDocFormSave" Event and everything works just fine, but i’m not able to alter the contents of a TV, if say, the path to the Image has changed. Maybe i should use the "OnBeforeDocFormSave" Event, but first i need to know how to change the contents of my Template Variables.

    Does anybody have some knowledge to share? Do i have to inject my content directly into the DB using SQL? Or is there a better way?
    Any help is appreciated.
    Cheers
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: banal at Nov 05, 2007, 09:40 AM

      Hello everybody.

      I’m currently developing a plugin for MODx 0.9.6 to create resized Images when a Document is saved.
      So far i used the "OnDocFormSave" Event and everything works just fine, but i’m not able to alter the contents of a TV, if say, the path to the Image has changed. Maybe i should use the "OnBeforeDocFormSave" Event, but first i need to know how to change the contents of my Template Variables.

      Does anybody have some knowledge to share? Do i have to inject my content directly into the DB using SQL? Or is there a better way?
      Any help is appreciated.
      Cheers

      @banal:

      For now, you will need to use SQL, based on the logic in the save_content.processor.inc.php. There will be object-oriented API’s for manipulating these values in the 0.9.7 and later releases of MODx, so if you wanted to isolate this custom logic in a class or function for now, you can likely easily convert the implementation to use the new API’s when they are available.
        • 2734
        • 165 Posts
        Okey. I’ll create a Function for the SQL then.
        Thanks for the Hint. Looking forward to 0.9.7 smiley

          • 36592
          • 970 Posts
          Quote from: banal at Nov 05, 2007, 09:40 AM

          but first i need to know how to change the contents of my Template Variables.
          I personally have not tested it, but would it help what you want to do ?
          http://modxcms.com/bugs/task/129
            • 2734
            • 165 Posts
            Quote from: tkfm at Nov 06, 2007, 02:56 AM

            I personally have not tested it, but would it help what you want to do ?
            http://modxcms.com/bugs/task/129

            Works like a charm. Thanks for this.. saves me some work!
            Not the best practice to directly hack the class, but better than nothing smiley