On Thu, Nov 12, 2009 at 9:26 AM, Chuck <[email protected]> wrote:
> Ezra, thanks so much. I did a search on enablecfoutputonly and found
> a set to true in a EnvironmentConfig Framework file.
> ColdSpringDefinitionMaker.cfc, that had no corresponding set to
> false. I added one and it works. If anyone else is using it, here is
> what I did.
No problem, I'm glad to hear that you figured it out.
> As to why I have the extra results tag in the type template, I got the
> idea from another thread here that was said to guarantee that my main
> view would be last. Thanks for the help.
Just to clarify this issue for anyone else who might read the thread,
it is not necessary to use a result for this purpose with a typed
event. The views are rendered in the order they are defined in the XML
config, so if your main layout is the last view defined, then all the
preceding views will be available to it via the ViewContext. That
said, there is really no "right" way to do this -- it ultimately comes
down to personal preference.
Prior to the advent of event types in Model-Glue 3, results were the
only way to apply a common layout to events, but now event types can
be used instead. Therefore, the following two examples are basically
equivalent, and will both render in the same way.
Result:
<event-handler name="page.index">
<results>
<result do="template.main" />
</results>
<views>
<include name="body" template="pages/index.cfm" />
</views>
</event-handler>
<event-handler name="template.main">
<views>
<include name="header" template="templates/header.cfm" />
<include name="footer" template="templates/footer.cfm" />
<include name="main" template="templates/main.cfm" />
</views>
</event-handler>
Event Type:
<event-handler name="page.index" type="templatedPage">
<views>
<include name="body" template="pages/index.cfm" />
</views>
</event-handler>
<event-type name="templatedPage">
<after>
<views>
<include name="header" template="templates/header.cfm" />
<include name="footer" template="templates/footer.cfm" />
<include name="main" template="templates/main.cfm" />
</views>
</after>
</event-type>
I personally prefer the event type approach, as I find it simpler to
apply multiple types to events than to add multiple result tags, and
the before context adds a capability that doesn't really exist with
results.
--
Ezra Parker
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---