Quote from: mrhaw at Aug 02, 2010, 03:20 PM
Did you check out the Doodles screencast: http://vimeo.com/1968472
in all of this?
MrHaw <-> Didn’t know it existed, again if you know its great but if you don’t - it means nada to anyone...
Splittingred <-> many thanks for the link, I know what I’ll be reading over tonight...
Opengeek <-> Don’t take my comments the wrong way, I love modx, I love the way you are improving the framework (evo felt a little hackish at best) and I really want to begin developing packages for the community through items I develop hopefully for clients.
As part of that I will do my best to write up the stages I go through in attempting to build my first package and will send it in to you guys to read, rewrite and generally have a good laugh at the code and documentation - and call me the pot for calling you the kettle
All the best and I look forward to many more chats and discussions over the next few weeks - my package needs to be functioning in 5-6 weeks time - arrrrrgggh !
Nothing like pressure to add to the excitement !
Also just a small addition - this is the kind of thing I am trying to get across (without sounding whiney or nooobish):
This is taken from here
http://svn.modxcms.com/svn/modx-components/tutorials/storefinder/trunk/_build/build.schema.php
<?php
/**
* Build Schema script
*
* @package storefinder
* @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);
$modx->setLogLevel(MODX_LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$root = dirname(dirname(__FILE__)).'/';
$sources = array(
'root' => $root,
'core' => $root.'core/components/storefinder/',
'model' => $root.'core/components/storefinder/model/',
'assets' => $root.'assets/components/storefinder/',
'schema' => $root.'_build/schema/',
);
$manager= $modx->getManager();
$generator= $manager->getGenerator();
$generator->classTemplate= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
class [+class+] extends [+extends+] {
function [+class+](& \$xpdo) {
\$this->__construct(\$xpdo);
}
function __construct(& \$xpdo) {
parent :: __construct(\$xpdo);
}
}
?>
EOD;
$generator->platformTemplate= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\\\', '/') . '/[+class-lowercase+].class.php');
class [+class+]_[+platform+] extends [+class+] {
function [+class+]_[+platform+](& \$xpdo) {
\$this->__construct(\$xpdo);
}
function __construct(& \$xpdo) {
parent :: __construct(\$xpdo);
}
}
?>
EOD;
$generator->mapHeader= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
EOD;
$generator->parseSchema($sources['schema'].'storefinder.mysql.schema.xml', $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 ();
Whereas this is taken from the tutorial here
http://svn.modxcms.com/docs/display/xPDO20/Generating+the+Model+Code for learning how to write the model code.
$xpdo->setLogLevel(xPDO::LOG_LEVEL_INFO);
$xpdo->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$manager= $xpdo->getManager();
$generator= $manager->getGenerator();
$generator->classTemplate= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
class [+class+] extends [+extends+] {}
?>
EOD;
$generator->platformTemplate= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\\\', '/') . '/[+class-lowercase+].class.php');
class [+class+]_[+platform+] extends [+class+] {}
?>
EOD;
$generator->mapHeader= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
EOD;
$schema = '/path/to/storefinder.mysql.schema.xml';
$target = '/path/to/storefinder/model/';
$generator->parseSchema($schema,$target);
Different and missing vital information
Best Regards,
MM