Search

Monday, August 13, 2007

Model-Glue Gotcha - Bug or Feature?

I just ran into an interesting issue while developing with Model-Glue. It took a couple of minutes to figure out so here is a quick reminder for both myself and anybody else using Model-Glue. The scenario: You are using multiple views to build your application template. This means that your template itself is composed of several views such as "reportsMenu", "applcationMenu", etc. The actual template file is defined as follows in the template event:
<include name="template" template="dspApplicationTemplate.cfm" />
To include the "applicationMenu" you do
#viewcollection.getview("applicationMenu")#
somewhere in your dspApplicationTemplate.cfm The gotcha: The included view has to have <cfoutput> around the html even if there is no CF code to be ran. The complete event definition:
<event-handler name="applicationTemplate">
  <broadcasts>
   <message name="GetUsersWorkOrderTypes" />
  </broadcasts>

  <views>
   <include name="lookupWorkOrderForm" template="frmLookupWorkOrder.cfm" />
   <include name="reportsMenu" template="dspReportsMenu.cfm" />
   <include name="applicationMenu" template="dspApplicationMenu.cfm" />
   <include name="template" template="dspApplicationTemplate.cfm" />
  </views>
 </event-handler>
The "applicationMenu" view(dspApplicationMenu.cfm) iteself included the "lookupWorkOrderForm" and "reportsMenu". Unless I surrounded the html in the "reportsMenu" view (dspApplicationMenu.cfm) with <cfoutput>, it kept showing as an empty string.
// //]]>