An%20Introduction%20to%20Fusebox%204 - PowerPoint PPT Presentation

About This Presentation
Title:

An%20Introduction%20to%20Fusebox%204

Description:

An Introduction to FB4. State of Fusebox. The last two years have seen: ... An Introduction to FB4. Fusebox: What's in it for me? ... – PowerPoint PPT presentation

Number of Views:250
Avg rating:3.0/5.0
Slides: 31
Provided by: halh
Category:

less

Transcript and Presenter's Notes

Title: An%20Introduction%20to%20Fusebox%204


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
  • ltcf_querysimgt
  • AllUsers
  • userID,firstName,lastName,newsletters
  • 100StanCox19
  • 200Haywood U.Buzzoff5
  • 300MargeInoferror11
  • lt/cf_querysimgt

13
Write fuses dspUserList.cfm
  • lth2gtUser Listlt/h2gt
  • lttable border"0"gt
  • ltcfoutput query"AllUsers"gt
  • lttrgt
  • lttdgtltstronggtlta href"self?fuseactionxfa.edit
    UseruserIDuserID"gtlastNamelt/agtlt/stronggt,f
    irstNamelt/tdgt
  • lt/trgt
  • lt/cfoutputgt
  • lt/tablegt
  • ltbrgt
  • ltcfoutputgt
  • lta href"self?fuseactionxfa.newUser"gtNew
    userlt/agt
  • lt/cfoutputgt

14
Write fuses qryNewsletters.cfm
  • ltcf_querysimgt
  • Newsletters
  • newsletterID,newsletterName
  • 1Journal of Misanthropy
  • 2Today's Mendicant
  • 4Spotlight on Great Managers
  • 8WaffleWorld
  • 16GeekWeek
  • lt/cf_querysimgt

15
Write fuses qryUserInfo.cfm
  • ltcf_querysimgt
  • AllUsers
  • userID,firstName,lastName,newsletters
  • 100StanCox19
  • 200Haywood U.Buzzoff5
  • 300MargeInoferror11
  • lt/cf_querysimgt
  • ltcfquery dbtype"query" name"UserInfo"gt
  • SELECT FROM AllUsers WHERE userID
    attributes.userID
  • lt/cfquerygt

16
Write fuses dspUserInfoForm.cfm
  • ltcf_lth2gtUser Profilelt/h2gt
  • ltcfoutputgt
  • ltform action"self?fuseactionxfa.submitForm"
    method"post"gt
  • lttable border"0" align"left" width"500"gt
  • lttrgt
  • lttd align"right"gtFirst name lt/tdgt
  • lttdgtltinput type"Text" name"firstName"
    value"UserInfo.firstName" /gtlt/tdgt
  • lt/trgt
  • lttrgt
  • lttd align"right"gtLast name lt/tdgt
  • lttdgtltinput type"Text" name"lastName"
    value"UserInfo.lastName" /gtlt/tdgt
  • lt/trgt

17
Write fuses dspUserInfoForm.cfm
  • lttrgt
  • lttd align"right"gtNewsletters lt/tdgt
  • lttdgt
  • ltcfloop query"Newsletters"gt
  • ltinput type"Checkbox" name"newsletters"
    value"Newsletters.newsletterID" ltcfif
    BitAnd(Newsletters.newsletterID,
    UserInfo.newsletters)gt checkedlt/cfifgtgt
    newsletterNameltbrgt
  • lt/cfloopgt
  • lt/tdgt
  • lt/trgt
  • lttrgt
  • lttd colspan"2" align"center"gt
  • ltinput type"Submit" value" ok " /gt
  • lt/tdgt
  • lt/trgt

18
Write fuses dspUserInfoForm.cfm
  • lt/tablegt
  • ltinput type"Hidden" name"userID"
    value"UserInfo.userID" /gt
  • lt/formgt
  • lt/cfoutputgt

19
Write fuses qryUserInfoEmpty.cfm
  • ltcf_querysimgt
  • UserInfo
  • userID,firstName,lastName,newsletters
  • """"""0
  • lt/cf_querysimgt

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
  • ltcircuit access"public"gt
  • ltfuseaction name"list"gt
  • ltxfa name"editUser" value"Users.edit" /gt
  • ltxfa name"newUser" value"Users.new" /gt
  • ltinclude template"qryAllUsers.cfm" /gt
  • ltinclude template"dspUserList.cfm" /gt
  • lt/fuseactiongt
  • ltfuseaction name"edit"gt
  • ltxfa name"submitForm" value"Users.doEdit" /gt
  • ltxfa name"home" value"Users.list" /gt
  • ltinclude template"qryNewsletters.cfm" /gt
  • ltinclude template"qryUserInfo.cfm" /gt
  • ltinclude template"dspUserInfoForm.cfm" /gt
  • lt/fuseactiongt

22
Define how/what fuseactions the Users circuit
will handle circuit.xml
  • ltfuseaction name"new"gt
  • ltxfa name"submitForm" value"Users.doNew" /gt
  • ltxfa name"home" value"Users.list" /gt
  • ltset name"dsn" value"OurApp" /gt
  • ltdo action"query.getNewsletters" /gt
  • ltinclude template"dspUserInfoForm.cfm" /gt
  • lt/fuseactiongt
  • ltfuseaction name"doEdit"gt
  • lt/fuseactiongt
  • ltfuseaction name"doNew"gt
  • lt/fuseactiongt
  • lt/circuitgt

23
Define the configuration for the Fusebox
application fusebox.xml
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltfuseboxgt
  • ltcircuitsgt
  • ltcircuit alias"Users" path"circuits/Users/"
    parent""/gt
  • lt/circuitsgt

24
Define the configuration for the Fusebox
application fusebox.xml
  • ltparametersgt
  • ltparameter name"fuseactionVariable"
    value"fuseaction" /gt
  • ltparameter name"defaultFuseaction"
    value"Users.list" /gt
  • ltparameter name"precedenceFormOrUrl"
    value"form"/gt
  • ltparameter name"reparse" value"true" /gt
  • ltparameter name"execute" value"true" /gt
  • ltparameter name"mode" value"development"/gt
  • ltparameter name"parseWithComments"
    value"true" /gt
  • (continued)

25
Define the configuration for the Fusebox
application fusebox.xml
  • ltparameter name"scriptFileDelimiter"
    value"cfm"/gt
  • ltparameter name"maskedFileDelimiters"
    value"htm,cfm,cfml,php,php4,asp,aspx"/gt
  • lt/parametersgt
  • ltglobalfuseactionsgt
  • ltpreprocessgt
  • lt/preprocessgt
  • ltpostprocessgt
  • lt/postprocessgt
  • lt/globalfuseactionsgt
  • (continued)

26
Define the configuration for the Fusebox
application fusebox.xml
  • ltpluginsgt
  • ltphase name"preProcess"gt
  • lt/phasegt
  • ltphase name"preFuseaction"gt
  • lt/phasegt
  • ltphase name"postFuseaction"gt
  • lt/phasegt
  • ltphase name"fuseactionException"gt
  • lt/phasegt
  • ltphase name"postProcess"gt
  • lt/phasegt
  • ltphase name"processError"gt
  • lt/phasegt
  • lt/pluginsgt
  • lt/fuseboxgt

27
Try it out
28
The Fusebox grammar
  • include
  • ltinclude template"dspProducts" /gt
  • set
  • ltset name"dsn" value"FruitProducts" /gt
  • xfa
  • ltxfa name"success" value"home.main" /gt
  • do
  • ltdo action"home.listProducts" /gt
  • relocate
  • ltrelocate url"http//techspedition.com" /gt
  • 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 ltcfmodulegt 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"
Write a Comment
User Comments (0)
About PowerShow.com