Easy application question
I think I misunderstand how to use application.cfm files. I have a application.cfm file on the root and I set a group of session variables. I have a folder off the root named products with an application.cfm file in it. It was my understanding that the root application.cfm would take precedence to the subfolder's application.cfm and could share variables to the application.cfm like it could any page in that folder. But when I call a variable in the sub application.cfm file to the higher level application.cfm, I get variable is undefined error. Is that just not possible to share variables among application.cfm files even if they are hierarchically below a higher application.cfm file or am I doing something else wrong? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332837 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy application question
Make sure both Application.cfm files have the same name in the cfapplication tag. thanks, eric cobb http://www.cfgears.com Brian Bradley wrote: I think I misunderstand how to use application.cfm files. I have a application.cfm file on the root and I set a group of session variables. I have a folder off the root named products with an application.cfm file in it. It was my understanding that the root application.cfm would take precedence to the subfolder's application.cfm and could share variables to the application.cfm like it could any page in that folder. But when I call a variable in the sub application.cfm file to the higher level application.cfm, I get variable is undefined error. Is that just not possible to share variables among application.cfm files even if they are hierarchically below a higher application.cfm file or am I doing something else wrong? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332838 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy application question
Only a single Application.cfm file (note the capital 'A') will be run for a single request. CF will look up the directory tree until it finds one, but it will stop it's search at the first one encountered. If you want to chain Application.cfm files as you propose, simply use CFINCLUDE to grab the parent one: cfinclude template=../Application.cfm / Unfortunately, Application.cfc is becoming a requirement for building CF applications, so you should switch to that. It has a host of problems, but it's also the only way to get certain functionality with CF (ORM, default datasource, code-based mappings, etc.). Hopefully Adobe will change that, but it seems unlikely. Railo, by contrast, lets you use the full functionality without forcing you into Application.cfc and all the problems it provides. cheers, barneyb On Mon, Apr 12, 2010 at 7:01 AM, Brian Bradley bbrad...@plrb.org wrote: I think I misunderstand how to use application.cfm files. I have a application.cfm file on the root and I set a group of session variables. I have a folder off the root named products with an application.cfm file in it. It was my understanding that the root application.cfm would take precedence to the subfolder's application.cfm and could share variables to the application.cfm like it could any page in that folder. But when I call a variable in the sub application.cfm file to the higher level application.cfm, I get variable is undefined error. Is that just not possible to share variables among application.cfm files even if they are hierarchically below a higher application.cfm file or am I doing something else wrong? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332839 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy application question
You have it backwards. The sub-directory Application.cfm takes precedent and the higher Application.cfm is not used by default. But there is nothing preventing you to tell the sub-directory Application.cfm by using a cfinclude template=path/to/root/Application.cfm ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332840 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy application question
Barney, Not to pick a fight, but what problems do you see with using Application.cfc? I, personally, find it to be a much better solution, so I am curious about your misgivings... Steve Cutter Blades Adobe Community Professional - ColdFusion Adobe Certified Professional Advanced Macromedia ColdFusion MX 7 Developer Co-Author of Learning Ext JS http://www.packtpub.com/learning-ext-js/book _ http://blog.cutterscrossing.com Barney Boisvert wrote: Only a single Application.cfm file (note the capital 'A') will be run for a single request. CF will look up the directory tree until it finds one, but it will stop it's search at the first one encountered. If you want to chain Application.cfm files as you propose, simply use CFINCLUDE to grab the parent one: cfinclude template=../Application.cfm / Unfortunately, Application.cfc is becoming a requirement for building CF applications, so you should switch to that. It has a host of problems, but it's also the only way to get certain functionality with CF (ORM, default datasource, code-based mappings, etc.). Hopefully Adobe will change that, but it seems unlikely. Railo, by contrast, lets you use the full functionality without forcing you into Application.cfc and all the problems it provides. cheers, barneyb On Mon, Apr 12, 2010 at 7:01 AM, Brian Bradley bbrad...@plrb.org wrote: I think I misunderstand how to use application.cfm files. I have a application.cfm file on the root and I set a group of session variables. I have a folder off the root named products with an application.cfm file in it. It was my understanding that the root application.cfm would take precedence to the subfolder's application.cfm and could share variables to the application.cfm like it could any page in that folder. But when I call a variable in the sub application.cfm file to the higher level application.cfm, I get variable is undefined error. Is that just not possible to share variables among application.cfm files even if they are hierarchically below a higher application.cfm file or am I doing something else wrong? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332841 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Easy application question
The primary issue is that it couples your persistence layer (default datasource and ORM) your business layer (mappings) and your front controller (events) into a very inflexible one-to-one-to-one structure. You can't have multiple frontends for a single ORM persistence layer, for example. You also can't have a single frontend backed by mutliple Hibernate SessionFactories. Then there are some implementation problems, the biggest one being that you don't have access to the application scope when you're defining the this.XXX variables. That means if you're setting them dynamically you can't rely on an application-scope cache, you have to store your per-application configuration in the server scope. But there isn't any sort of event for that, so you end up jumping through all kinds of hoops to deal with the arcane timing of the Application.cfc psuedoconstructor because that's the ONLY place you can define settings. It's enormously better with the CFAPPLICATION tag, because you can run that anywhere you want. Even better, Railo lets you run the CFAPPLICATION tag multiple times, so you can run it once to get your application scope, and then run it again to set up mappings/default dsn/whatever. That's really powerful. So it's not really Application.cfc itself, it's more that Adobe has piggybacked so much functionality on top of Application.cfc that really doesn't belong there. The event handler structure is quite beneficial, don't get me wrong, but they've tried to make Application.cfc the be all/end all place for everything, and it really paints you into a corner with complex applications/deployments. Application refers to a lot of different things in the Adobe parlance, and they've squished them all into a single container. cheers, barneyb On Mon, Apr 12, 2010 at 8:35 AM, Cutter (ColdFusion) cold.fus...@cutterscrossing.com wrote: Barney, Not to pick a fight, but what problems do you see with using Application.cfc? I, personally, find it to be a much better solution, so I am curious about your misgivings... Steve Cutter Blades -- Barney Boisvert bboisv...@gmail.com http://www.barneyb.com/ ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332842 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm