ah - man!
That's likey it huh - snap -

Thanks for the response -
Is there an actual way to view the 'full event-handlers block'??

I'll mod this code and get more aquainted with event-type - thanks!

On Sep 21, 5:03 am, Chris Blackwell <[email protected]> wrote:
> Hi Kevin,
> I going to bet that your full event-handlers block looks something like this
>
> <event-handlers defaultType="templatedPage">
> <event-handler name="page.index" type="templatedPage2">
> <results>
> <result do="template.main" />
> </results>
> <views>
> <include name="body" template="pages/index.cfm" />
> </views>
> </event-handler>
>  <event-handler access="private" name="template.main">
> <views>
> <include name="main" template="templates/main.cfm" />
> </views>
> </event-handler>
> </event-handlers>
>
> The problem here is that you have template.main in the same block and its
> getting a default event of templatedPage applied to it. If you follow the
> logic through its clear why this won't work..
>
> before page.index - include footer2
> page.index results in template.main
> before template.main include footer1
>
> To prove this, if you add append="true" to the event-type includes you'll
> see something like "This is footer 2 This is footer 1" in your output
>
> The solution is to move template.main to a second event-handlers block with
> no defaultType
>
> <event-handlers defaultType="templatedPage">
> <event-handler name="page.index" type="templatedPage2">
> <broadcasts />
> <results>
> <result do="template.main" />
> </results>
> <views>
> <include name="body" template="pages/index.cfm" />
> </views>
> </event-handler>
> </event-handlers>
>
> <event-handlers>
> <event-handler access="private" name="template.main">
> <views>
> <include name="main" template="templates/main.cfm" />
> </views>
> </event-handler>
> </event-handlers>
>
> It may also be worth making your layout event part of the event type
>
> <event-type name="templatedPage">
> <after>
> <views>
> <include template="pages/footer1.cfm" name="footer" />
> </views>
> <results>
> <result do="template.main" />
> </results>
> </after>
> </event-type>
>
> This is a sneaky little gotcha, that if i had a blog would most certainly be
> worth a post.. maybe i'll get round to that one day!
>
> Cheers, Chris
>
> 2009/9/21 Kevin Penny <[email protected]>
>
>
>
> > I am new to MG - but am trying to get the event-type syntax straight.
> > What I'm doing seems pretty simple, but the results are not as
> > expected. For simplicity, I have the event-type simply doing 'footer'
> > content for me - as defined as such (defining 2 footer pages - both
> > with value of 'footer'):
>
> > <event-types>
> >                <event-type name="templatedPage">
> >                        <before>
> >                                <views>
>
> >                                        <include template="pages/footer.cfm"
> > name="footer"/>
> >                                </views>
> >                        </before>
> >                </event-type>
>
> >                <event-type name="templatedPage2">
> >                        <before>
> >                                <views>
> >                                        <include
> > template="pages/footer2.cfm" name="footer"/>
> >                                </views>
> >                        </before>
> >                </event-type>
> >        </event-types>
>
> > The below I have an even-handler defined with a defaultType of the
> > first templatedPage (footer)
>
> > <event-handlers defaultType="templatedPage">
>
> > That works well to get my 'results' template to be populated with the
> > footer variable which I can output as such:
>
> >        <cfoutput>#viewCollection.getView("body")#</cfoutput>
>
> > However, overriding a specific event-handler is NOT displaying the
> > second footer as in:
>
> > <event-handler name="page.index" type="templatedPage2"><!-- HERE I AM
> > OVERRIDING THE DEFAULT TYPE -->
> >                <broadcasts />
> >                <results>
> >                        <result do="template.main" />
> >                </results>
> >                <views>
> >                        <include name="body" template="pages/index.cfm" />
> >                </views>
> >        </event-handler>
>
> > Instead of the text in my footer being 'This is the Footer2' which is
> > the content in pages/footer2.cfm I get the content from footer.cfm
> > 'This is the Footer'. (I have started/stopped service, reload,
> > init=true etc.)
>
> > Also, If i override the event-type on the event-hander as in :
> > <event-handler name="page.index" type=""> (per the event-type
> > documentation) it will also show the 'templatedPage' event-type footer
> > content (instead of what I would expect to be NOTHING populated for
> > the footer variable).
>
> > This is from a brand new download of 'ModelGlue_3.0.final.178.zip'
> > from the site - and am running a prior 3.0 version on another project
> > and am seeing some inconsistencies there as well.
>
> > Please help -
>
> > Sincerely,
>
> > Kevin Penny
--~--~---------~--~----~------------~-------~--~----~
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