Aliaspooryorik
ColdFusion ORM Book

Remove circuit.xml.cfm from Model and View circuits

I recently did a talk on Fusebox 5.5 at Devon CFUG and mentioned that you get rid of all those pesky circuit.xml.cfm files from the Model and View directories, and found that it isn't widely known that you can do this. For those of you who don't know this, Fusebox 5.1 had an undocumented feature which is now official in 5.5 where you can supress the need for xml files to be placed in every directory with scripts in.

Firstly let's look at how it used to be done with the "do" verb:


<!-- controller circuit.xml.cfm -->
<circuit access="public">
  <fuseaction name="List">
    <do action="vTestimonials.List" contentvariable="content.main" />
  </fuseaction>
</circuit>

Then in your View folder you'd have this.


<!-- view circuit.xml.cfm -->
<circuit access="internal">
  <fuseaction name="List">
<include template="dspList.cfm" />
</fuseaction>
</circuit>

This meant having to create lots of XML files which could be time consuming and didn't really do anything. Now we can use the "include" verb instead and delete the circuit.xml.cfm file from our View (and Model) circuits.


<!-- controller circuit.xml.cfm -->
<circuit access="public">
    <fuseaction name="List">
        <set name="Request.BreadCrumb" value="Testimonials" />
        <include circuit="vTestimonials" template="dspList" contentvariable="content.main" />
    </fuseaction>
</circuit>

You also need to add a new entry to the parameters section of your fusebox.xml.cfm config file.


<parameter name="allowImplicitCircuits" value="true" />

That's it. What a time saver!

Don't forget to reload Fusebox to get it to pick up the new parameter.


4 comments

  1. This is great and I'm currently using the do verb in all my controller circuits. I think this will save some load time :-)

    Thanks,
    Akbar

    Comment by Akbar – June 25, 2008
  2. It was a revelation to me when I found out! Glad you found the post useful.

    Comment by John Whish – June 26, 2008
  3. How this thing resolve the model? Can you give me one example?

    Comment by Flávio Garcia – March 17, 2009
  4. Hi Flávio, For the model you would just do:

    <include circuit="mTestimonials" template="actList" />

    Instead of:

    <do action="mTestimonials.List" />

    Hope that helps.

    Comment by John Whish – March 18, 2009

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.

Please subscribe me to any further comments
 

Search

Wish List

Found something helpful & want to say ’thanks‘? Then visit my Amazon Wish List :)

Categories

Recent Posts