If I return anything after the dood variable and if statment nothing returns. I have also tried echo's but it is the same thing... Here is my snippet.doodles.php code:
<?php
/**
* @package doodles
*/
$dood = $modx->getService('doodles','Doodles',$modx->getOption('doodles.core_path',null,$modx->getOption('core_path').'components/doodles/').'model/doodles/',$scriptProperties);
if (!($dood instanceof Doodles)) return '';
/* setup default properties */
$tpl = $modx->getOption('tpl',$scriptProperties,'rowTpl');
$sort = $modx->getOption('sort',$scriptProperties,'name');
$dir = $modx->getOption('dir',$scriptProperties,'ASC');
$m = $modx->getManager();
$created = $m->createObjectContainer('Doodle');
return $created ? 'Table created.' : 'Table not created.';
return $output;
I have set the doodles.core_path and doodles.assets_url inside of my system settings. They are working because the path for the static snippet ([[++doodles.core_path]]/elements/snippets/snippet.doodles.php) is pulling the correct file.
My modx error log has this in it:
[2012-11-20 17:46:13] (ERROR @ /modx/index.php) Could not load class: Doodles from doodles.
[2012-11-20 17:46:13] (ERROR @ /modx/index.php) Problem getting service doodles, instance of class Doodles, from path /srv/www/htdocs/modx/doodles/core/components/doodles/model/doodles/
I have checked the path and it exists and is correct. All of my classes and maps are located inside of the 3rd doodles folder in the path including my doodles.class.php file that looks like this:
class Doodles {
public $modx;
public $config = array();
function __construct(modX &$modx,array $config = array()) {
$this->modx =& $modx;
$basePath = $this->modx->getOption('doodles.core_path',$config,$this->modx->getOption('core_path').'components/doodles/');
$assetsUrl = $this->modx->getOption('doodles.assets_url',$config,$this->modx->getOption('assets_url').'components/doodles/');
$this->config = array_merge(array(
'basePath' => $basePath,
'corePath' => $basePath,
'modelPath' => $basePath.'model/',
'processorsPath' => $basePath.'processors/',
'templatesPath' => $basePath.'templates/',
'chunksPath' => $basePath.'elements/chunks/',
'jsUrl' => $assetsUrl.'js/',
'cssUrl' => $assetsUrl.'css/',
'assetsUrl' => $assetsUrl,
'connectorUrl' => $assetsUrl.'connector.php',
),$config);
$this->modx->addPackage('doodle',$this->config['modelPath']);
}
}
Does it need the <?php at the top? It didn't have it on the tutorial...
[ed. note: jsteffan1 last edited this post 13 years, 10 months ago.]