We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39742
    • 29 Posts
    Hello.
    I'm trying to understand how to optimize processor usage by not duplicating processors used in the manager for the frontend.
    Also the new OO processors make it a little harder to understand how to reuse them for the frontend (called from snippet)
    Tried $modx->runProcessor but it seams to search only on local modx processors folder and I'm following the doodles tutorial and my extra is external to modx root.

    Can someone give my some tips how to use processors for both back and front end.

    Thanks
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      According to this, you can specify the path to the processor http://rtfm.modx.com/display/revolution20/modX.runProcessor

      According to the API:

      $action - string -The processor to run, eg: context/update

      $scriptProperties - array - Optional. An array of parameters to pass to the processor.

      $options - array - Optional. An array of options for running the processor, such as:
      - processors_path - If specified, will override the default MODX processors path.
      - location - A prefix to load processor files from, will prepend to the action parameter (Note: location will be deprecated in future Revolution versions.)



        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 39742
        • 29 Posts
        Sorry, missed that last option and got the idea that runProcessor would not go outside its own components folder.

        I guess having these processors that could be used either by CMP or by snippets in the component "processors" folder instead of the typical "mgr" and "web" sub-folders is an option to have a more coherent organization or is there any problem?

        Should I keep them in the processors/mgr?

        Thanks.



        Quote from: sottwell at Jan 03, 2013, 05:15 AM
        According to this, you can specify the path to the processor http://rtfm.modx.com/display/revolution20/modX.runProcessor

        According to the API:

        $action - string -The processor to run, eg: context/update

        $scriptProperties - array - Optional. An array of parameters to pass to the processor.

        $options - array - Optional. An array of options for running the processor, such as:
        - processors_path - If specified, will override the default MODX processors path.
        - location - A prefix to load processor files from, will prepend to the action parameter (Note: location will be deprecated in future Revolution versions.)