We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4574
    • 2 Posts
    Edit: It looks like execution is halting at this line of modx/core/connectors/index.php:

    if (defined('MODX_REQP') && MODX_REQP === false) {
    } else if (!$modx->context->checkPolicy('load')) {
        @session_write_close();
        die(); // die('foo'); returns 'foo' from connector.php
    }
    


    Any ideas?

    --

    I’ve been following the excellent tutorial Developing an Extra in MODX Revolution. I’ve got as far as adding a grid for my model on my Custom Manager Page. Unfortunately, I seem to have gone wrong somewhere as I can’t get any data to display in my grid.



    Poking around in Firebug, I don’t seem to be getting any response (or rather, an empty response) from my Extra’s connector.php. In the tutorial, splittingred mentions that accessing that file directly should give this response:

    {"success":false,"message":"Access denied.","total":0,"data":[],"object":[]}


    The fact that I’m not getting that must indicate something, but I’ve got no idea what. My current code is over on github. Here’s the connector:

    <?php
    require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php';
    require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
    require_once MODX_CONNECTORS_PATH.'index.php';
    
    $corePath = $modx->getOption('shepherd.core_path',null,$modx->getOption('core_path').'components/shepherd/');
    
    require_once $corePath.'model/shepherd/shepherd.class.php';
    $modx->shepherd = new Shepherd($modx);
    
    $modx->lexicon->load('shepherd:default');
    
    /* handle request */
    $path = $modx->getOption('processorsPath',$modx->shepherd->config,$corePath.'processors/');
    $modx->request->handleRequest(array(
        'processors_path' => $path,
        'location' => '',
    ));


    And the processor:

    <?php
    
    $isLimit = !empty($scriptProperties['limit']);
    $start = $modx->getOption('start',$scriptProperties,0);
    $limit = $modx->getOption('limit',$scriptProperties,10);
    $sort = $modx->getOption('sort',$scriptProperties,'title');
    $dir = $modx->getOption('dir',$scriptProperties,'ASC');
     
    /* build query */
    $c = $modx->newQuery('Article');
    $count = $modx->getCount('Article',$c);
    $c->sortby($sort,$dir);
    if ($isLimit) $c->limit($limit,$start);
    $articles = $modx->getIterator('Article', $c);
    
    /* iterate */
    $list = array();
    foreach ($articles as $article) {
      $articleArray = $article->toArray();
      $list[]= $articleArray;
    }
    
    return $this->outputArray($list,$count);


    Apart from renaming instances of "Doodles" to "Shepherd" (don’t ask), it is almost word for word from the tutorial. Can anyone suggest where I might be going wrong, or what steps I could take to debug the issue (for example, how would I verify that the getlist.php processor is returning results?)?

    XAMP/OSX 10.6, PHP: 5.3.1, MySQL: 5.1.44
      • 28215
      • 4,149 Posts
      I assume you did this in your MODX install?

      You may have to add a System Setting in your MODX install called session_cookie_path and give it a value of "/" (no quotations). This will tell MODX to use the same session when you’re running stuff at http://localhost/doodles/. Also, giving it a unique name via session_cookie_name (like "modxlocaldevsession") is a good idea too. That’ll prevent conflicts with other MODX installs on your local machine. If you do this, empty the core/cache/ directory and relogin after doing so.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 4574
        • 2 Posts
        Nope! Cheers, eyes must have slipped by that one. Working nicely now, thanks again.