We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24865
    • 289 Posts
    Oh yea, the ’ctx’ part, that’s to circumvent this lovely line:
    $ctx = isset($_REQUEST['ctx']) && !empty($_REQUEST['ctx']) ? $_REQUEST['ctx'] : 'mgr';


    For the fun of it, I tried it with Quip and it found the file, and even a simple test returned "Error" (a returned format from Quip itself). Why the **** (:P) doesn’t it find mine then? Do I need to set some more access params in the manager? :S
      @MarkGHErnst

      Developer at Adwise Internetmarketing, the Netherlands.
      • 26903
      • 1,336 Posts
      Yes but it wants to be ’mgr’ here, so you should just be able to leave it I think.

      OK, the line is here, modconnectorresponse.class.php, line 62, I’ve often stepped through this function(outputContent) line by line to find obscure errors like the one your having, debugging this under say netbeans should quickly tell you whats going on.

        Use MODx, or the cat gets it!
        • 24865
        • 289 Posts
        Thanks for all your help man, really appreciated it. I’m gonna get something to eat and then go to the gym. Gonna give it another shot this afternoon.

        When I finally figure this out I’m gonna write some wicked ass tutorial about it, because this does not need to be so complex and annoyingly difficult.
          @MarkGHErnst

          Developer at Adwise Internetmarketing, the Netherlands.
          • 24865
          • 289 Posts
          Somebody please kick me in the nuts!
          I found it, I bloody well found it! And I have only myself to blame.

          In the connector, I had:

          	$modx->handleRequest(array(
          		'processors_path' => $modx->getOption('core_path').'components/mycmp/processors/',
          		'location' => 'web',
          		'action' => 'fetch'
          	));


          Which needed to be:

          	$modx->request->handleRequest(array(
          		'processors_path' => $modx->getOption('core_path').'components/mycmp/processors/',
          		'location' => 'web',
          		'action' => 'fetch'
          	));


          From my debugber I created:

          Array
          (
              [processors_path] => C:\wamp\www\modx/core/components/mycmp/processors/
              [location] => web
              [action] => fetch
          )
          {"success":0,"message":"Fetch 2","total":1,"data":[],"object":[]}


          Doh.
            @MarkGHErnst

            Developer at Adwise Internetmarketing, the Netherlands.
            • 26903
            • 1,336 Posts
            This is OK but it hardwires your connector to the ’fetch’ processor, this means you’ll need a different connector for each AJAX request, you can do this by passing the action as a post parameter outlined above, this allows you to have one connector url for all your requests.
              Use MODx, or the cat gets it!
              • 24865
              • 289 Posts
              Already fixed that portion. It now only accepts the action request variable and location is predetermined on the frontend of the website. Good eye tho.

              	$modx->request->handleRequest(array(
              		'processors_path' => $modx->getOption('core_path').'components/mycmp/processors/',
              		'location' => 'web'
              	));
                @MarkGHErnst

                Developer at Adwise Internetmarketing, the Netherlands.
                • 26903
                • 1,336 Posts
                Good stuff, having gone through this myself I know how valuable your tutorial will be to others.
                  Use MODx, or the cat gets it!
                  • 24865
                  • 289 Posts
                  Thanks, I’ll keep you uprised. smiley While building my website I am learning LOTS about MODx which I think others may profit from. smiley
                    @MarkGHErnst

                    Developer at Adwise Internetmarketing, the Netherlands.
                    • 3632
                    • 22 Posts
                    Really useful post! In the ajax request in this post the config.auth value for the header is hardcoded - how would we go about getting that dynamically?
                      • 24865
                      • 289 Posts
                      Currently I am outputting a file as a .php.js file, that fetches the $modx->site_id. This is easily done from the assets directory. Just create a config like file that outputs what you need in JSON format.
                        @MarkGHErnst

                        Developer at Adwise Internetmarketing, the Netherlands.