Wednesday, March 26, 2008

Per App Settings Example

Per App Settings in CF8 allows you to set 1.Mappings and 2.Custom tag paths on a per-application basis.

These settings override the server-side settings in the ColdFusion Administrator for the specified application only. Specifying per application settings does not change the server-wide settings.

To set per-application settings:

    1.First enable per-application settings on the Settings page of the ColdFusion Administrator. Go to Administrator -> Settings -> Click on Enable Per App Settings -> Submit.

    2. Set the mappings or custom tag paths in the Application.cfc file.

Here is a per application settings example.

The following will be the code in your Application.cfc file:

<cfset MyMappings = StructNew()>
<cfset MyMappings["/MyMap1"] = "C:\Temp\per_app_dir1">
<cfset This.mappings = MyMappings>
<cfset This.mappings["/MyMap2"] = "C:\Temp\per_app_dir2">
<cfset This.customtagpaths = "C:\Temp\my_custom_tags_dir">
<cfset This.mappings["/MyMap3"] = "C:\Temp\my_custom_tags_dir">
Here is how you use this in your code:
Run the following code in a test.cfm

<!---- per_app_test1.cfm is present under C:\Temp\per_app_dir1\ and you should be able to include it. ---->
<cfinclude template = "/MyMap1/per_app_test1.cfm">
<!---- per_app_test2.cfm is present under C:\Temp\per_app_dir2\ and you should be able to include it. ---->
<cfinclude template = "/MyMap2/per_app_test2.cfm">
<!---- mycustomtag.cfm is present under C:\Temp\my_custom_tags_dir\ and you should be able to use this custom tag. ---->
<!---- You can also use cfmodule like below ------>
<cfmodule template = "/MyMap3/mycustomtag.cfm">


Morgan said...

Per application mappings is not working with FLEX?

I set up some per application mappings in a Application.cfc to test it out. I've managed to succesfully use them within my CFCs (init objects etc.) So far so good.

I'm also used to set up "general" mappings using the CFADMIN and to reference these in the services-config.xml file, mapping my FLEX remoteobject calls to my CFSs.

However, the dynamically set per application mappings doesnt seem to work if used in the services-config.xml file.

Can anyone confirm that this is the case or if its possible please provide some hints of how its done.


jones said...

Nice blog...
visit also coldfusion example

Anonymous said...

top [url=]casinos online[/url] brake the latest [url=]online casinos[/url] manumitted no set aside perk at the leading [url=]liberated bonus casino