We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9069
    • 18 Posts
    I been using modx for quite a while. Finally decided that is time to stop using stuff like CodeIgniter and put the time and effort to get Modx to work at is full potential. Been reading xPod makes modx the Joomla killa. Now that been said. I went ahead and read the following:

    http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components

    Trying to start with a simple step as adding an external data to a current modx revo 2.1.1 site. I encounter a problem where it tells me to run build.schema.php. Firefox 5 gives the file to download, Safari, Chorme, IE, FF(windows) give an error connection closed, server sent no data. So I decided to go to the roots and learn then it by the basic. In this case I read this one:

    http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution

    To my surprise when it tell me to run build.schema.php I get the same problem. I try with global off’s/on with zlib on and off. I check there is no error in server logs.

    I am currently using modx 2.1.1 on my root (public_html) and the package I am working on on a sub-folder (public_html/doodles). I try moving it out to a folder outside the root but it needs to run on web-accessible mode.

    To add more, I went out to git and grabbed the latest build.schema.php for doodle. sad
      • 34193
      • 330 Posts
      Could you post your schema and your code.
        • 9069
        • 18 Posts
        Build Schema (build.schema.php)
        /**
         * Build Schema script
         *
         * @package seorankings
         * @subpackage build
         */
        $mtime = microtime();
        $mtime = explode(" ", $mtime);
        $mtime = $mtime[1] + $mtime[0];
        $tstart = $mtime;
        set_time_limit(0);
        
        require_once dirname(__FILE__).'/build.config.php';
        include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
        $modx= new modX();
        $modx->initialize('mgr');
        $modx->loadClass('transport.modPackageBuilder','',false, true);
        echo '<pre>'; /* used for nice formatting of log messages */
        $modx->setLogLevel(modX::LOG_LEVEL_INFO);
        $modx->setLogTarget('ECHO');
        
        $root = dirname(dirname(__FILE__)).'/';
        $sources = array(
            'root' => $root,
            'core' => $root.'core/components/seorankings/',
            'model' => $root.'core/components/seorankings/model/',
            'schema' => $root.'core/components/seorankings/model/schema/',
            'schema_file' => $root.'core/components/seorankings/model/schema/seorankings.mysql.schema.xml',
            'assets' => $root.'assets/components/seorankings/',
        );
        $manager= $modx->getManager();
        $generator= $manager->getGenerator();
        
        if (!is_dir($sources['model'])) {
            $modx->log(modX::LOG_LEVEL_ERROR,'Model directory not found!');
            die();
        }
        if (!file_exists($sources['schema_file'])) {
            $modx->log(modX::LOG_LEVEL_ERROR,'Schema file not found!');
            die();
        }
        $generator->parseSchema($sources['schema_file'],$sources['model']);
        
        
        $mtime= microtime();
        $mtime= explode(" ", $mtime);
        $mtime= $mtime[1] + $mtime[0];
        $tend= $mtime;
        $totalTime= ($tend - $tstart);
        $totalTime= sprintf("%2.4f s", $totalTime);
        
        echo "\nExecution time: {$totalTime}\n";
        
        exit ();


          • 9069
          • 18 Posts
          I actually got this working using Bob’s Guide and the CreateXpdo Snippet (http://bobsguides.com/custom-db-tables.html).

          But would like to use the approach from the guides in the wiki.

            • 34193
            • 330 Posts
            OK the only difference other than directory sturcture I can see from a working copy I have is this
            Quote from: erunix at Jun 27, 2011, 07:26 PM

            Build Schema (build.schema.php)
            require_once dirname(__FILE__).'/build.config.php';
            include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
            $modx= new modX();
            $modx->initialize('mgr');
            


            Which I have as
            include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
            $modx= new modX();
            $modx->initialize('mgr');
            
            require_once dirname(__FILE__).'/build.config.php';
            


            Not 100% sure if this is the issue but might be worth a try. If this is the case then it may be an error in the tutorials that is need of correcting.
              • 34193
              • 330 Posts
              Also what changes did you make based on the bobs guides stuff to get it working.
                • 9069
                • 18 Posts
                On Bob’s guide there is a CreateXpdo Snippet. I haven’t sit down and work on this. So far the Bob’s guide one is working fine.