Viewing By Entry / Main
April 16, 2006
I leave this example to speak for itself...

fusebox.xml:

<fusebox xmlns:mg="ModelGlue/" mg:root="fbmg">
   <classes>
      <class alias="controller" classpath="fbmg.controller.Controller"
         mg:needStuff="getStuff" />
   </classes>
   <circuits>
      <circuit alias="do" path="controller/" />
   </circuits>
   <parameters>
      <parameter name="mode" value="development-no-load" />
      <parameter name="defaultFuseaction" value="do.welcome" />
   </parameters>
</fusebox>

circuit.xml:

<circuit access="public" xmlns:mg="ModelGlue/" mg:viewMappings="views/">
   <fuseaction name="welcome">
      <mg:broadcasts>
         <mg:message name="needStuff" />
      </mg:broadcasts>
      <mg:views>
         <mg:include template="main.cfm" />
      </mg:views>
   </fuseaction>
</circuit>

Controller.cfc:

<cfcomponent name="Controller">
   <cffunction name="getStuff" returntype="void" access="public" output="true">
      <cfargument name="attrs" type="struct" required="true" />
      <cfset arguments.attrs.stuff = "1234" />
   </cffunction>   
</cfcomponent>

views/main.cfm:

<cfoutput>
   <p>This is the main Model-Glue view.</p>
   <p>This is the stuff: #viewState.getValue('stuff')#.</p>
</cfoutput>

This is using what will be the Alpha 2 codebase...

Comments

Neat, can't wait to get my hands on it.


Well perhaps for those of us less attuned to the voices of framework code, can you please explain what the example is saying while it's speaking for itself??


Mike,

The example above uses a custom lexicon ("ModelGlue") that contains a handle of custom verbs I wrote ("broadcasts", "message", "views", "include") to allow Fusebox applications to be written in the style of Model-Glue applications - there's no Model-Glue framework here, just a similar grammar style. It's intended to show how custom lexicons let you extend the Fusebox grammar.

In terms of "speaking for itself", I'm assuming readers know both Fusebox and Model-Glue...

I think it also shows how custom lexicons let you seamlessly use CFCs with Fusebox which was one of my goals for this release.


This is progressive and double KUDOS Sean!!! While some developers may not benifit (or even know how to use XML, Lexicons and such... that is not the point). What you have claimed here is excellent! This could be the another step in the "right" direction for CF. We need more methodologies where the systems work together as community solutions. Fusebox and Model-Glue working together is great for MVC cross application development! This can only work for the good of the community.


Is there an updated or release-stable version of MG through FB available?

I really want to take Canvas Wiki and drop it into a FB format and the lexicon would be a great process.


@Stephen, the most up to date version (based on the concepts in Model-Glue 1.0 - be warned!) was discussed in this blog entry with a download link:

http://corfield.org/entry/Fusebox_5_in_a_ModelGlue_style


@Sean - warned I am but also a fantastic thankyou as well for the starting point. Yummy! :-)


Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by