Very cool thanks.
You asked how to make it a package. Check out MyComponent.
http://bobsguides.com/mycomponent-tutorial.html.
It takes a little getting used to, but it will save you a ton of time when creating packages.
Thanks Bob,
I'll have another look at MyComponents, I had a quick look before trying to do a Doodles type example with it but I quickly got confused with the paths I was creating having previously done the Doodles tutorial where it is developed outside the modx filesystem.
Cheers
Mike
MyComponent *should* put everything in the same places as the Doodles tutorial except that the root will be:
assets/mycomponents/componentName/
All those are true of the MyComponent placement too. It's still independent of MODX, it just happens to be in a directory under the MODX assets directory (which MODX will never touch during an upgrade).
I like having all my projects under assets/mycomponents. I have all of them and the MODX install as a single project in PhpStorm. I can do a quick search for anything I've written and all my projects are in the same tree in the editor, which is handy for moving files and bits of code from one project to another (which I do all the time). I can also jump instantly from a call in my code to any MODX method to the code of that method.
That's interesting to know.
I like the sound of everything as a single project in Phpstorm too.
I'm just working through the Doodles tutorial again, when i've done I'll take another look at MyComponents to try and grasp the concepts and work it out again.
Thanks
Mike
MyComponent looks really scary at first, but it's actually not all that difficult to use (really). Other than writing your code (which you have to do anyway), the only thing it adds is editing the project config file -- and the way it does all your lexicon strings for you, creates *all* your files in skeleton form complete with license and sometimes partial code, and creates *all* the build files automatically (including all resolvers) is a huge bonus.
It cuts my Extra development time by at least a factor of 10. If you're only doing one Extra, it might not be worth it, but if you'll do more, or if you'll be updating your Extra, it definitely pays to use it.
I did a presentation on MyComponent at MODXpo where I created a brand new Extra from start to finished transport.zip file (complete with lexicon strings) in about 15 minutes. That includes typing in the snippet code with no cutting-and-pasting. There is a video of that presentation, but sadly it's never been released.
TBH, I've never actually done the Doodles tutorial, though I've looked at parts of it a number of times. The problem is that it mixes up creating a CMP using modExt and creating custom xPDO classes. These are really two separate things. A CMP doesn't necessarily need custom database tables and custom database tables don't necessarily need a CMP.
Trying to learn them both at the same time can get really confusing, imo.
-
☆ A M B ☆
- 24,524 Posts
Plus the Doodle tutorial has you working in a directory external from your MODx installation, so there's a lot of baggage related to getting MODx to be able to find and work with your application files.
With MyComponent, you work within the MODx system, exactly as your files will be when it's an installed component.
Yes, half the difficulty with the Doodles tutorials is getting the paths right for your particular setup which distracts from and obscures the main concepts a bit.