BlogCFC, Custom tags and applications

This post is more than 2 years old.

This really isn't a BlogCFC post, but more a post about custom tags and application scopes. A quick quiz. Given a root folder and Application.cfc/cfm file named AAA, what Application scope is used if you call a custom in folder /test that has it's own Application.cfc/cfm file?

The answer is the original Application, AAA. Even though your custom tag is being run in a folder with another Application.cfc/cfm file, ColdFusion isn't going to run it. Your custom tag (or cfinclude) is run in context of the original Application.

I'm bringing this up because of the following question from a user:

I obviously don't have a good grasp of the way the application scope work.

When I add a new app that I have written to my intranet, I would just make sure to call it the same as my pplicationName in the root. I do this to be able to use the same login information.

I recently downloaded blogcfc and got it working by itself. However when I try to cfmodule the index.cfm file, I keep getting: "Element ISCOLDFUSIONMX7 is undefined in APPLICATION."

To get it work I have to run the blog by itself, then go back to my intranet page, and the intranet works.

I am having a hard time integrating blogCFC into another app. Should I be having trouble?

Yep, you should be. When you run index.cfm from within BlogCFC, it never loaded up it's own Application scoped variables.

What options do you have? Specifically for BlogCFC, you could simply move the application setup stuff into your own file, or cfinclude my Application.cfm from your own file. You would want to modify it a bit to remove the custom application name, and you have to be a bit concerned about my application variables overwriting yours.

Another option is to simply use the applicationToken value of cflogin (discussed here). That assumes both applications make use of the CFLOGIN feature.

To be fair, making BlogCFC "plugable" is not something I worked on very well, but it is something I can look into for v6.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by noname posted on 1/22/2008 at 4:41 AM

Thanks. And making it "plugable" is definetely something a lot of future users would like. The deal is to save time by not having to rewrite, or write code. Now that people see your blog everywhere, choosing and downloading yours feels almost second nature.

Thanks Ray.

Comment 2 by Cutter posted on 1/22/2008 at 6:35 AM

Yes, pluggable would be great. It would be outstanding to have BlogCFC, Canvas (if it had it), and Galleon all have a shared login capability.