After reading and understanding the concept of plugins, i wrote my own one. Unfortunately, it throwed my an exception, saying that the component definition is invalid. To be sure, that i understood the things correctly, i made a second CFC by using the newbie code “My first Plugin” from the excellent documentation. The sample is very easy, but i got the same exception “can’t find hello”.
I copied the CFC’s first in the folder <root\plugins, and afterwards i moved it to the folder \modules\contentbox\plugins.
In the exception i expected to see the path and file name of my cfc, i see, eg. CBHelper.cfc, but not mine.
What did i wrong, some ideas?
Are you trying to build a ColdBox plugin or a ContentBox widget?
I’m sorry, i miss some basic stuff in my brain: The difference between a ContentBox Module and Widget On the other hand i see CFC’s described as “plugin” inside, e.g Avatar. Maybe i’m just stumbled over the terminology? I didn’t see some docs pointing this out, but i think i was on the right way to checkout the ColdBox docs.
Can you provide some more info about this?
Maybe it makes sense to explain what i like to do: I need some helper functions like you did in CBHelper, e.g. to create a sitewide navigation supporting the CSS Framework we use. As a template i use code from some functions of CBHelper and extend them to my needs.
After reading some post’s from Andy’s great blog, i think it goes into the direction of widgets, which i will use also for other projects.
On the other hand, your CBHelper is a ColdBox Plugin, which does the same i want to do. So, what is the right choice?
A ColdBox Plugin would give me the opportunity to use it for several projects, storing the CFC on a central place. This sounds good to me, but is not mandatory.
Here timid in a nutshell.
Widgets are plugins at the end of they day. They jut have some extra pizzaz so ContentBox can use them, document them and integrate them.
You can also build plugins as you can use ANY ColdBox plugin with ContentBox as well. Plugins are then just standalone CFCs that can work for you in any ColdBox app.
To use plugins in your layouts and views you use the getplugin() as normal.
Ortus Solutions, Corp
Toll Free/Fax: 1-888-557-8057
Twitter: @lmajano, @ortussolutions
Actually I’m learning a lot as a “I don’t have a clue about Frameworks”-Newbie
The problem i had calling ContentBox plugins was, that the inheritance was wrong. Without specifying ‘module’ the plugin needs to be in the ColdBox environment.
Going back to the simple hello plugin, it must be called like this:
The next thing will be creating a proxy for the plugin like you did for the CBHelper. I like the shortcuts…
The learning effect was great.
Again, thank you for your patience & help.
When creating plugins for ContentBox, you can create a module even it is a basic module and have the plugins available to you. So lets say we create a module for ContentBox called myModule. We create a folder in modules/contentbox/modules calle myModule, which we then create a folder called plugins in here.
When you reference this plugin then you can reference it like.
Failing the need to want to create a module, you can place them into the ContentBox plugins folder and call it like
Hopefully that helps you out, as there is no need to go down the route of creating a proxy here.
Personally I like to keep things together, it is a shame that ContentBox doesn’t adhere to external locations for these so we can keep single plugins etc separate from the core of ContentBox. I did raise a ticket for this so hopefully one day soon, this will be added.
Thank you for your answer. I’m on track. Now after understaning some basics, i like the concept of the plugins and widgets very much. Compared to other CMS this allows to do whatever you want. The only hard thing is to get into the concept of a framework, if no experience with frameworks is available at all. But a newbie can grow, beginning with simple stuff like i do right now., e.g. creating the navigation with the css framework i use. And sometimes it isn’t easy to get some specific information. Time will tell…