1 / 30

An Introduction to Fusebox 4

An Introduction to Fusebox 4. If written directions alone would suffice, libraries wouldn't need to have the rest of the universities attached. —Judith Martin (aka "Miss Manners"). State of Fusebox. The last two years have seen: increased corporate acceptance of Fusebox

Download Presentation

An Introduction to Fusebox 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction to Fusebox 4 If written directions alone would suffice, libraries wouldn't need to have the rest of the universities attached. —Judith Martin (aka "Miss Manners")

  2. State of Fusebox • The last two years have seen: • increased corporate acceptance of Fusebox • increased developer acceptance of Fusebox • increased demand in job postings for Fusebox • no new version of Fusebox…

  3. Fusebox: What's in it for the client? • Less risk in software projects • Greater "project visibility" • Not locked into a non-standardized framework

  4. Fusebox: What's in it for managers? • Reduces costs of deployment • Reduces cost of tools and training • Allows better allocation of resources

  5. Fusebox: What's in it for me? • Helps good programmers produce great results • Lets you distinguish yourself from your competition • Helps stop the madness

  6. FB4: It's all new! • XML file defines overall application parameters: Fusebox.xml • XML file defines individual circuits: Circuit.xml • a permissions attribute for fuseactions • Plugins allow developer extensions of core Fusebox • Content components • Change in way layouts are handled • Parsing cycle

  7. FB4: It's just the same! • Core files process a fuseaction request • Circuits provide logical groupings of fuseactions • Fuses hold the code • dsp for display • act for action • qry for query • lay for layout

  8. Building a simple FB4 app

  9. Download/install the FB 4 core files

  10. Add a circuits/Users directory

  11. Write Fusedocs • Omitted here for space

  12. Write fuses: qryAllUsers.cfm <cf_querysim> AllUsers userID,firstName,lastName,newsletters 100|Stan|Cox|19 200|Haywood U.|Buzzoff|5 300|Marge|Inoferror|11 </cf_querysim>

  13. Write fuses: dspUserList.cfm <h2>User List</h2> <table border="0"> <cfoutput query="AllUsers"> <tr> <td><strong><a href="#self#?fuseaction=#xfa.editUser#&userID=#userID#">#lastName#</a></strong>,#firstName#</td> </tr> </cfoutput> </table> <br> <cfoutput> | <a href="#self#?fuseaction=#xfa.newUser#">New user</a> | </cfoutput>

  14. Write fuses: qryNewsletters.cfm <cf_querysim> Newsletters newsletterID,newsletterName 1|Journal of Misanthropy 2|Today's Mendicant 4|Spotlight on Great Managers 8|WaffleWorld 16|GeekWeek </cf_querysim>

  15. Write fuses: qryUserInfo.cfm <cf_querysim> AllUsers userID,firstName,lastName,newsletters 100|Stan|Cox|19 200|Haywood U.|Buzzoff|5 300|Marge|Inoferror|11 </cf_querysim> <cfquery dbtype="query" name="UserInfo"> SELECT * FROM AllUsers WHERE userID = #attributes.userID# </cfquery>

  16. Write fuses: dspUserInfoForm.cfm <cf_<h2>User Profile</h2> <cfoutput> <form action="#self#?fuseaction=#xfa.submitForm#" method="post"> <table border="0" align="left" width="500"> <tr> <td align="right">First name: </td> <td><input type="Text" name="firstName" value="#UserInfo.firstName#" /></td> </tr> <tr> <td align="right">Last name: </td> <td><input type="Text" name="lastName" value="#UserInfo.lastName#" /></td> </tr>

  17. Write fuses: dspUserInfoForm.cfm <tr> <td align="right">Newsletters: </td> <td> <cfloop query="Newsletters"> <input type="Checkbox" name="newsletters" value="#Newsletters.newsletterID#" <cfif BitAnd(Newsletters.newsletterID, UserInfo.newsletters)> checked</cfif>> #newsletterName#<br> </cfloop> </td> </tr> <tr> <td colspan="2" align="center"> <input type="Submit" value=" ok " /> </td> </tr>

  18. Write fuses: dspUserInfoForm.cfm </table> <input type="Hidden" name="userID" value="#UserInfo.userID#" /> </form> </cfoutput>

  19. Write fuses: qryUserInfoEmpty.cfm <cf_querysim> UserInfo userID,firstName,lastName,newsletters ""|""|""|0 </cf_querysim>

  20. Write test harnesses!!! • Make sure that all your fuses fulfill their contract • For this, you will need to use the Fusedocs

  21. Define how/what fuseactions the Users circuit will handle: circuit.xml <circuit access="public"> <fuseaction name="list"> <xfa name="editUser" value="Users.edit" /> <xfa name="newUser" value="Users.new" /> <include template="qryAllUsers.cfm" /> <include template="dspUserList.cfm" /> </fuseaction> <fuseaction name="edit"> <xfa name="submitForm" value="Users.doEdit" /> <xfa name="home" value="Users.list" /> <include template="qryNewsletters.cfm" /> <include template="qryUserInfo.cfm" /> <include template="dspUserInfoForm.cfm" /> </fuseaction>

  22. Define how/what fuseactions the Users circuit will handle: circuit.xml <fuseaction name="new"> <xfa name="submitForm" value="Users.doNew" /> <xfa name="home" value="Users.list" /> <set name="dsn" value="OurApp" /> <do action="query.getNewsletters" /> <include template="dspUserInfoForm.cfm" /> </fuseaction> <fuseaction name="doEdit"> </fuseaction> <fuseaction name="doNew"> </fuseaction> </circuit>

  23. Define the configuration for the Fusebox application: fusebox.xml <?xml version="1.0" encoding="UTF-8"?> <fusebox> <circuits> <circuit alias="Users" path="circuits/Users/" parent=""/> </circuits>

  24. Define the configuration for the Fusebox application: fusebox.xml <parameters> <parameter name="fuseactionVariable" value="fuseaction" /> <parameter name="defaultFuseaction" value="Users.list" /> <parameter name="precedenceFormOrUrl" value="form"/> <parameter name="reparse" value="true" /> <parameter name="execute" value="true" /> <parameter name="mode" value="development"/> <parameter name="parseWithComments" value="true" /> (continued)

  25. Define the configuration for the Fusebox application: fusebox.xml <parameter name="scriptFileDelimiter" value="cfm"/> <parameter name="maskedFileDelimiters" value="htm,cfm,cfml,php,php4,asp,aspx"/> </parameters> <globalfuseactions> <preprocess> </preprocess> <postprocess> </postprocess> </globalfuseactions> (continued)

  26. Define the configuration for the Fusebox application: fusebox.xml <plugins> <phase name="preProcess"> </phase> <phase name="preFuseaction"> </phase> <phase name="postFuseaction"> </phase> <phase name="fuseactionException"> </phase> <phase name="postProcess"> </phase> <phase name="processError"> </phase> </plugins> </fusebox>

  27. Try it out…

  28. The Fusebox grammar • include • <include template="dspProducts" /> • set • <set name="dsn" value="FruitProducts" /> • xfa • <xfa name="success" value="home.main" /> • do • <do action="home.listProducts" /> • relocate • <relocate url="http://techspedition.com" /> • if • loop

  29. Good Stuff in Fusebox 4 • Language/version-neutral syntax • Extensibility through plugins • Improved performance • No gut-wrenching changes • Can execute multiple fuseactions in same HTTP request (reduces <cfmodule> calls) • Very flexible content components • Less need to understand the Fusebox API

  30. For more info… • www.fusebox.org site and forums • Discovering Fusebox 4 book at techspedition.com • Classes (halhelms.com) • FastTrack to Fusebox 4 • Fusebox Mastery class • Fusebox Lifecycle Process (FLiP) • Articles in "ColdFusion Developer's Journal"

More Related