plugin / onapplicationstart.cfm

7 views
Skip to first unread message

Mike Henke

unread,
Nov 8, 2009, 2:05:25 PM11/8/09
to ColdFusion on Wheels
Is there a way in a plugin to set some code to run like events/
onapplicationstart.cfm?

Basically, I was hoping to not require the plugin users to add some
code to their onapplicationstart.cfm.

Thanks,

m...@iamjamesgibson.com

unread,
Nov 9, 2009, 6:51:47 AM11/9/09
to ColdFusion on Wheels
Hi Mike,

The current release (1.0 RC1) allows you to specify that you would
like a plugin method mixed into the application scope with the
attribute mixin="application". I have done this for the asset bundler
and you can check out the code at the link below.

http://github.com/liferealized/assetbundler/blob/master/src/AssetBundler.cfc

You will need to have users of the plugin add the method call into
the /events/onappliactionstart.cfm file though :(

James

Mike Henke

unread,
Dec 12, 2009, 9:24:37 AM12/12/09
to ColdFusion on Wheels
What are you gaining (what does it do) by using mixin="application"?
Thanks

Mike Henke

unread,
Dec 12, 2009, 9:26:14 AM12/12/09
to ColdFusion on Wheels
I am going to create a ticket so plugins can use events within the
plugin so users won't have to clutter their events/files. Also making
plugin integration even easier.

On Nov 9, 6:51 am, "m...@iamjamesgibson.com" <m...@iamjamesgibson.com>
wrote:
> Hi Mike,
>
> The current release (1.0 RC1) allows you to specify that you would
> like apluginmethod mixed into the application scope with the
> attribute mixin="application". I have done this for the asset bundler
> and you can check out the code at the link below.
>
> http://github.com/liferealized/assetbundler/blob/master/src/AssetBund...
>
> You will need to have users of thepluginadd the method call into
> the /events/onappliactionstart.cfm file though :(
>
> James
>
> On Nov 8, 2:05 pm, Mike Henke <henkem...@gmail.com> wrote:
>
> > Is there a way in apluginto set some code to run like events/
> >onapplicationstart.cfm?
>
> > Basically, I was hoping to not require thepluginusers to add some
> > code to theironapplicationstart.cfm.
>
> > Thanks,

Mike Henke

unread,
Dec 12, 2009, 9:32:12 AM12/12/09
to ColdFusion on Wheels
http://code.google.com/p/cfwheels/issues/detail?id=356

On Dec 12, 9:26 am, Mike Henke <henkem...@gmail.com> wrote:
> I am going to create a ticket so plugins can use events within thepluginso users won't have to clutter their events/files.  Also makingpluginintegration even easier.

tpet...@gmail.com

unread,
Dec 12, 2009, 9:34:13 AM12/12/09
to ColdFusion on Wheels
by doing mixin="application" the plugin methods would only mixin into
the application.cfc itself and not any other objects like the model or
controller. this prevents "bloat".

in regards to creating a ticket for allowing plugins to use events;
look at issue 351:

http://code.google.com/p/cfwheels/issues/detail?id=351

i had an idea about using something similar to callbacks or rack
middleware that is along the same lines as your idea. take the time to
read and comment about it. it's just an idea right now, but i would
really like some additional input on it.

On Dec 12, 9:26 am, Mike Henke <henkem...@gmail.com> wrote:

Mike Henke

unread,
Dec 12, 2009, 10:16:34 AM12/12/09
to ColdFusion on Wheels
I read through your ticket. You are way smarter than me. I'll need to
print it off and re-read it :-)

Does your idea encompass plugins setting global Callbacks for models
and controllers?

Example currently for this plugin I am working on, I have to add to
models/Model.cfc

<cffunction name="init">
<cfset beforeValidation("ValidateThis")>
</cffunction>

It would be nicer if the end user didn't have to do this and the
plugin handled it.

tpet...@gmail.com

unread,
Dec 12, 2009, 11:06:39 AM12/12/09
to ColdFusion on Wheels
"I read through your ticket. You are way smarter than me"

LOL. calling me smart is a gross exaggeration :)

i see the problem you're having. since plugins need an init() method,
we can't create another init method that can be mixied into models. i
think we could get around this if we supported an "as" attribute on
the methods of plugins:

<cffunction name="modelinit" mixin="model" as="init">

when the plugin code goes to inject the method into the model
component, it will create the method with the name "init" rather then
"modelinit".

any thoughts?

Per Djurner

unread,
Dec 13, 2009, 4:57:54 PM12/13/09
to cfwh...@googlegroups.com
This issue is also similar:
http://code.google.com/p/cfwheels/issues/detail?id=240
> --
>
> You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
> To post to this group, send email to cfwh...@googlegroups.com.
> To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.
>
>
>
Reply all
Reply to author
Forward
0 new messages