|
Hi guys,
We have a few issues here:
Do we need to modify the FB3 app being
called?
If we want an FB3 app to be used both as a stand-alone app
(something a normal CustomTag doesn't do) and as a helper module for other apps,
then we may need to put a little conditional logic in somewhere. The two
areas you that may need to change are layout and
return-scope.
If your app/module outputs HTML, then you may want to
strip out the extraneous layout so that the calling app can do its own
stuff. The simplest way is probably to check the isCustomTag API variable
in your fbx_layouts:
<cfif fusebox.isCustomTag>
<cfset fusebox.layoutfile="">
<cfelse>
<cfset
fusebox.layoutfile="lay_medown.cfm">
</cfif>
If your app/module returns pure data, then you have to return the data in the caller scope, so that the calling app can use it. There are a few ways to so this, but as Hal says, it's enough to check isCustomTag in your fbx_setting, and set a #scope# variable on that basis. How do we call it? We use CFMODULE to call the app. You need to specify the TEMPLATE, which will always be an index.cfm file for FB3 apps. Then you add attributes to your call. The most important of these is, of course, FUSEACTION. In other words, you are calling an FB application that has a number of publically accessible functions called "fuseactions". You have to tell it which one you want. After that, you can pass any extra attributes that might be required by the fuseaction you are requesting: <cfmodule "Bottoming out" Recursion is a piece of code calling itself. Whenever you use recursion in any context, no matter what the language, platform or architecture, you have to plan to "bottom out" somewhere. That means that you eventually have to reach some circumstance where you no longer make the recursive call. In order for this to happen, you need two things: You need conditional code; and you need some condition to actually change ;-) If you don't do this, you will inevitably get an infinite loop. Global Variables If your calling app, and your helper module share the same variable space, then the helper might overwrite variables that the calling app needs. This may be what you want, or it may not. In ColdFusion and FB3, we need to take particular care of request-scope variables (although session, client, application, cookies are obviously a problem too). That is why the FB3 core code has stepped away from using request-scope to hold important internal variables, and that is why FB3 is so robust when using helper modules. The rule here is simple: Think about your variables.
Okay, I think that's about all you need. The rest is just practice. Have a look at Hal's MVC example. Have a look at my Basic Portal. Both of these use recursive calls. I'm not aware of any examples out there that use cfmodule calls to external applications (ie apps outside the current home app), but I certainly use them at work. They're just not the kind of thing you are likely to see in a stand-alone sample application, for obvious reasons ;-) Hoping that helps some, See ya, LeeBB
----- Original Message -----
==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================ |
- Moduling circuits Drew Parker
- RE: Moduling circuits hal helms
- I need some help with WireFrameTool ! Jerzy Kalat
- Re: Moduling circuits Drew Parker
- RE: Moduling circuits hal helms
- Re: Moduling circuits Drew Parker
- Re: Moduling circuits Jeff Peters
- Re: Moduling circuits John Quarto-vonTivadar
- RE: Moduling circuits CKKemp
- Re: Moduling circuits Drew Parker
- Re: Moduling circuits Lee Borkman
- Re: Moduling circuits Drew Parker
- Re: Moduling circuits Birgit Pauli-Haack
- RE: Moduling circuits Rey Muradaz
- RE: Moduling circuits hal helms
- RE: Moduling circuits CKKemp
- RE: Moduling circuits Rey Muradaz
