First look at newBee - part 3 (newbee.xml)

We have seen that we can have a model cfc and a view template, that does not know anything about each other at all, but still work together.

The way we "stitch together" what model part and what view parts play together is with the newbee.xml file in the config directory. The newbee.xml file is wher you make all conections between the model and the view, and works a birds-eye view of what your whole application looks like.

Let's have a look at what it looks like right now:

<newbee_controller>
   
   <!-- EVENTS -->
   <events>
      <event event="default">
         <model path="HelloWorld.cfc" method="HelloWorld" returnvariable="strHW" />
         <view path="mainpage.cfm" />
      </event>
   </events>

</newbee_controller>

For now we'll look at the model and the view node defined under the event named "default".

The model node has a path to a cfc, relative to the model directory (you can use subdirectories within the model directory), it has a method, which we remember from the cffunction name in the HelloWorld.cfc code we looked at. And we have a returnvariable, which we see is equal to the variable we used in our mainpage.cfm code example.

Then theres the view node that contains the path to the mainpage.cfm file, relative to the view directory.

So we see that to instruct the controller (newBee framework) to connect the model and the view is very easy, intuitive and straightforward.

Comments
Hi Trond, I now see how the vars naming works now :)

One thing on this one, is the .cfc reference in the model path necessary? With the standard in CF to not include the .cfc extension, this seems counter intuitive.

Of course, you may have more up your sleeve that you aren't telling us yet :)

Cheers
# Posted By dc | 2/12/07 6:51 AM
Yeah, I've been arguing with my self about the .cfc reference (as well as the .cfm reference for the view). I've not reached a final conclusion yet. I want to do the same for both. And when invoking cfc's you do not include the extension as you say, but when including cfm files you do... gotta think about it some more.
# Posted By Trond Ulseth | 2/12/07 7:37 AM
Fusebox has a file extension auto look up (or a similar type mechanism), could you implement something like that? Default it to CFC for the model, and CFM for the view? Anyways, all interesting to read at the moment :)
# Posted By dc | 2/12/07 7:51 AM