We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17016
    • 138 Posts
    We want to fire a php-snippet on saving a certain resource (saving all other resources should not be affected). Is it ok to use for this purpose a plugin beginning like this and hooked to the event "OnDocFormSave" or is there a better way to realize this:
    <?php
    if($id!=2113)  // id of the resource which should fire the the code on saving this resource
    {return;}
    else
    {our php-code;
    return;}

    We were not sure if system events need much time and if it is therefore better to install as little system events as possible. Does anybody know this?

    Letti
      • 3749
      • 24,544 Posts
      I doubt if you’d notice any speed degradation at all with that. The $id is already set so no there’d be no DB query and the test would be very fast.
        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