Solved

Using Coldfusion Fusebox 5 Model

Posted on 2011-09-07
2
578 Views
Last Modified: 2012-05-12
I've created the following alias in the root fusebox.xml.cfm.
<circuit alias="mContact" path="/model/mContact/" parent="" />

Open in new window


The pathing is correct, and the mContact directory exists.  Within it, there are three query files and an action file.  There is also the circuit.xml.cfm, which is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit>
<!--
	Example circuit.xml file for the model portion of an application.
-->
<circuit access="internal">
	
	<!--
		Example model fuseaction that just references an action fuse.
		Model fuseactions should only reference actions and queries.
	-->
	
	<fuseaction name="buildForm">
		<include template="qry_formBuild" />
	</fuseaction>
	
	<fuseaction name="returnAddresses">
		<include template="qry_addresses" />
	</fuseaction>
	
	<fuseaction name="returnNumbers">
		<include template="qry_numbers" />
	</fuseaction>
	
	<fuseaction name="formSubmit">
		<include template="act_formSubmit" />
	</fuseaction>
	
	<!--
		This is executed at application startup (from <appinit>) and
		therefore is thread safe (and does not need a lock):
	-->
	<fuseaction name="initialize">
		<set name="myFusebox.getApplication().getApplicationData().startTime" value="#now()#" />
	</fuseaction>
	
</circuit>

Open in new window


This is my first time working with Fusebox 5.  How do I call each model fuseaction?  (E.G. Say I want to return the query data from the 'returnAddresses' fuseaction in the mContact model.)  Everything I have tried has equaled 'fail' so far.
0
Comment
Question by:brianmfalls
2 Comments
 
LVL 3

Accepted Solution

by:
devilJinKazama earned 500 total points
ID: 36499611
When you call a fuseaction in the URL, fusebox looks in the controller xml to run the appropriate fuseactions for that call. So lets say you wan to run the 'returnAddress' fuseaction.

firstly you will need to define the fuseaction in the root fusebox xml file :

<circuit alias="mContact" path="/model/mContact/" parent="m" />  --(parent 'm' for model, would be 'v' for view)
<circuit alias="vContact" path="/view/vContact/" parent="v" />
<circuit alias="contact" path="controller/contact" parent="app" />

Now inside your controller folder you would have a folder called 'contact' and inside that your circuit.xml.cfm file.

put this code in that file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit PUBLIC "circuit.dtd" "circuit.dtd">
<circuit access="public">

  <fuseaction name="returnAddresses">
          <do action="mContact.returnAddresses" />
          <do action="vContact.showAddresses" contentvariable="content.body" />
  </fuseaction>

</circuit>

controller : controls your fuseactions, model : gets your data, view : displays data.

so have your view file set up as well. inside view folder you have 'contact' folder and in the circuit.xml.cfm file you will put this code:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit PUBLIC "circuit.dtd" "circuit.dtd">
<circuit access="internal">

      <fuseaction name="showAddresses">
             <include template="dsp_showAddresses" />
       </fuseaction>

</circuit>

inside the dsp_showAddresses file you can dump your qry results. the url u will call to view that page will be

 www.mysite.com/contact/returnAddresses

lemme know if u need more help
0
 
LVL 1

Author Closing Comment

by:brianmfalls
ID: 36536652
Sorry for the delayed response.  Thanks for the help.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question