You make a great point about documenting the app.

I've figured out my holes in my config and have it working much better now.
I even have separated config files. :-D Woot! lol

Let me know if this is good:

<event-type name="Global">
            <before>
                <broadcasts>
                    <message name="SetPageConfigs" />
                </broadcasts>
            </before>
            <after>
                <views>
                    <include name="globalnav"
template="global/globalnav.cfm"/>
                    <include name="utilities"
template="global/utilities.cfm"/>
                    <include name="navsearch"
template="global/navsearch.cfm"/>
                    <include name="quicksearch"
template="global/quicksearch.cfm"/>
                    <include name="messagecenter"
template="global/messagecenter.cfm"/>
                </views>
            </after>
        </event-type>
        <event-type name="HomeTemplate">
            <after>
                <results>
                    <result do="template.home" />
                </results>
            </after>
        </event-type>
...
        <event-handler name="home" type="Global,HomeTemplate">
             <views>
                <include name="body" template="pages/home/body.cfm"/>
                <include name="panel" template="pages/home/panel.cfm"/>
            </views>
        </event-handler>

The idea is my page is separated into mini-views so I can pick and choose
what is included from the config. For instance, the messagecenter is only
shown on some pages and not all. Whenever it is "config'd" it shows up.

The SetPageConfigs event basically gets a custom bean and adds it to the
event so on the page I can control specific things like base url's to
images, styles, scripts, etc.

<cffunction name="SetPageConfigs" access="public" returntype="void"
output="false">
        <cfset arguments.event.setValue("urlConfig",
getModelGlue().getBean("urlConfig")) />
    </cffunction>

...
    <bean id="urlConfig" class="ModelGlue.Bean.CommonBeans.SimpleConfig">
        <property name="config">
            <map>
                <entry
key="imagesPath"><value>/assets/images</value></entry>
                <entry key="stylesPath"><value>/assets/css</value></entry>
                <entry
key="scriptsPath"><value>/assets/scripts</value></entry>
            </map>
        </property>
    </bean>

Is this a good way to approach things?

Mind you, the url's are config'd purely for the sake of a potential move to
a CDN in which I don't want to find/replace all assets/images paths.

Thoughts?

---
John C. Bland II
http://www.johncblandii.com
http://www.johnandseason.com
http://www.twitter.com/johncblandii
---
Suggested sites:
http://www.lifthimhigh.com - "Christian Products for Those Bold Enough to
Wear Them"
http://www.sportsmatchmaker.com - "What are you doing today?"


On Thu, Oct 8, 2009 at 11:09 AM, Jared Rypka-Hauer
<[email protected]>wrote:

>
> I don't think typed events have any sort of inheritance, and typically
> the broadcasts are redundant like that by design. Its something
> everyone complains about until they have an ultramassive application
> and realize that knowing what your events are doing at a glance is
> extremely valuable.
>
> The thing is, In exchange for a bit of redundancy, you have automatic
> documentation built in to your application. If you name your events
> and controller functions well, and you use the MG config file as it's
> intended, you could send me your config file and I would have an
> immediate idea of what your application is doing. It's why MG is so
> popular for team dev efforts.
>
> Trust me, I understand your frustration, but there is a payoff... it
> just comes a bit later on.
>
> J
>
> On Oct 8, 2009, at 10:09 AM 10/8/09, John C. Bland II wrote:
>
> > Ok...I'm messing with the typed events and realize I have multiple
> > event types with duplicated code.
> >
> > <before>
> >                 <broadcasts>
> >                     <message name="SetPageConfigs" />
> >                 </broadcasts>
> >             </before>
> >
> > I try to set a type on an eventtype but it doesn't work (figured it
> > wouldn't) so my question is: can I "chain" (create parent types)
> > typed events?
> >
> > I don't want to have to have the above block for all X of my typed
> > events. Thoughts?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to