Quote from: sottwell at Aug 15, 2013, 03:52 AM
With MyComponent, you work within the MODx system, exactly as your files will be when it's an installed component.
That's not strictly true, since MyComponent has them in this location:
[assets files] assets/mycomponents/componentsname/assets/components/componentname/
[core files] assets/mycomponents/componentsname/core/components/componentname/
When installed, they'll be at
[assets files] assets/components/componentname/
[core files] core/components/componentname/
But with Shaun's trick with the System Settings in your includes, they'll run from your dev. location (under assets/mycomponents/) during development and from the standard locations when installed.
Here's the include for the Notify class. The nf.core_path System Setting is set to {assets_path}mycomponents/notify/core/components/notify/
require_once $modx->getOption('nf.core_path', null, $modx->getOption('core_path') .
'components/notify/') . 'model/notify/notify.class.php';
There's a similar System Setting, nf.assets_path:
{assets_path}mycomponents/notify/assets/components/notify/
and also nf.assets_url (e.g., for injecting CSS and JS):
{assets_url}mycomponents/notify/assets/components/notify/
That said, in theory, you could put them anywhere you want by adjusting the paths in the config file, but I don't think it would work very well (if at all -- I think it would confuse the build file unless you modified it, which kind of defeats the purpose of having a universal build file that works for all projects).
Plus, having absolutely all the project's files under one directory (assets/mycomponents/componentname) makes using Git and working on them a lot easier than if they were in different directories (and I'm not sure where the _build and test directories would go).