<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:
<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 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:
<fuseaction name="welcome">
<mg:broadcasts>
<mg:message name="needStuff" />
</mg:broadcasts>
<mg:views>
<mg:include template="main.cfm" />
</mg:views>
</fuseaction>
</circuit>
<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:
<cffunction name="getStuff" returntype="void" access="public" output="true">
<cfargument name="attrs" type="struct" required="true" />
<cfset arguments.attrs.stuff = "1234" />
</cffunction>
</cfcomponent>
<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...<p>This is the main Model-Glue view.</p>
<p>This is the stuff: #viewState.getValue('stuff')#.</p>
</cfoutput>

7 responses so far ↓
1 Nick Tong // Apr 16, 2006 at 1:17 AM
2 Mike Kear // Apr 16, 2006 at 5:28 AM
3 Sean Corfield // Apr 16, 2006 at 10:29 AM
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.
4 John Farrar // Apr 26, 2006 at 6:55 PM
5 Stephen Cassady // Jan 24, 2007 at 8:59 AM
I really want to take Canvas Wiki and drop it into a FB format and the lexicon would be a great process.
6 Sean Corfield // Jan 25, 2007 at 8:15 AM
http://corfield.org/entry/Fusebox_5_in_a_ModelGlue_style
7 Stephen Cassady // Jan 25, 2007 at 1:40 PM
Leave a Comment