Search code examples
coldfusioncoldfusion-9

Coldfusion: storing routes and other variables for application in


I'l like to keep a a bunch of variables for access in the application.cfc or other coldfusion files that may be using them.

I've got some routes information where depending on the url entered, certain parameters get predetermined, that I'd like to be easily accessible.

Also depending on the view/template that I'm rendering, I've got a bunch of variables that I need, that I would like to pull only when required.

is there a format that makes this relatively easy to work with and accessible, without extra overhead? Maybe a json, xml, or text file? or is it best to just create a cfm or cfc page to hold all variables?


Solution

  • A ColdFusion struct is pretty versatile and implicitly expressed in ColdFusion 9+. Other formats like JSON, XML, Text would all require parsing to bring into ColdFusion. Many applications use the INI file, which ColdFusion has built-in functions for parsing.