We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19909
    • 49 Posts
    Splittingred,

    I have the models output for my new package I am looking to develop but have run into a small hurdle at the next step in your tutorial from here:

    http://svn.modxcms.com/docs/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components#UsingCustomDatabaseTablesinyour3rdPartyComponents-UsingourNewModel

    Could you explain further how the snippet in revolution overrides the snippet in the folder - I have setup my dev branch the same as yours ( I think )

    I have /modx/core/mmNewsletter/trunk/core/components/mmNewsletter with chunks/model/docs within that folder and a snippet.mmNewsletter.php file with:

    <?php
    /**
    * @package mmNewsletter
    */
    echo 'helo';
    
    $base_path = !empty($base_path) ? $base_path : $modx->getOption('core_path').'/components/mmNewsletter/';
    
    
    $modx->addPackage('mmNewsletter',$base_path.'model/');
    
    $subscribers = $modx->getCollection('mmsubscribers');
    echo 'Total: '.count($subscribers);
    
    ?>


    In my snippet in revolution I have:

    <?php
    $base_path = dirname(dirname($modx->getOption('core_path'))).'/mmNewsletter/trunk/core/components/mmNewsletter/';
    
    $o = '';
    $f = $base_path.'snippet.mmNewsletter.php';
    if (file_exists($f)) {
       $o = include $f;
    } else {
       $modx->setLogTarget('ECHO');
       $modx->log(modX::LOG_LEVEL_ERROR,'mmNewsletter not found at: '.$f);
    }
    return $o;
    ?>​


    When I run the snippet directly it outputs the ’helo’ so I can see from that the snippet in revolution is not being picked up and from what I can gather I see nowhere in the documentation which explains how this would override the directory in the snippet.mmNewsletter.php?

    Could you possibly explain this or if you can see from the code posted tell me where I have gone wrong trying to setup a development tree like you did...

    regards,

    mm