How I’ve gone as far as I have without looking into this sooner is beyond me. Creating Custom Types is basically how I spend 80% of my time and I had hit a wall until now. Custom Types deserve custom config options so their behavior can be configured by the users. Here’s how…
I have a very simply type which is a way to track registrations. The fields are unimportant, it’s simply a way to track what’s entered on registration forms. The client came back and wanted to be able to send the completed forms to someone via email but that person might change. So, rather than me having to change the code manually any time the email had to change, I set up a custom config for this type.
- Create a .cfm file in /farcry/
/system/dmConfig/ with the name you want to show up (i.e. myCustomConfig.cfm will show up as myCustomConfig in the config files list)
- Inside the file create a structure containing the config options with defaults:
<cfscript> stConfig = StructNew(); stConfig.EmailFrom = "email@example.com"; stConfig.EmailTo = "55PLUS@bryanlgh.org"; stConfig.EmailSubject = "55PLUS Application"; </cfscript>
- Log into farcry and navigate to Admin -> Custom Config
- Deploy your config
- navigate to Admin -> Config Files
- Update as necessary
Doing this will essentially create a new key in the structure “application.config” with the same name as the filename you created and placed in dmConfig. Farcry automatically handles updating the custom config files.
There is additional information at the Farcry Wiki