Custom Config

Custom Config Items

Overview

Farcry already has customisable default configuration items built in (Eg: Admin >> Config Files >> File). Within the file config, the default settings can be easily changed.

The reason for creating a custom config item could be to allow admin users to easily modify settings that may otherwise be inbuilt in code. An example of this could be a listing of email addresses that are required for contact emails.

Creating

Creating a custom config item is simple.

Step 1 - Script it

To render your config item, you will firstly need to write some cfscript which outlines the custom config structure and default values.

<cfscript>
     stConfig=structNew();
     stConfig.firstItem = "some value";
     stConfig.secondItem = "some value";
     ...
</cfscript>

This file will need to be stored in the dmConfig folder which is found in the system folder of your farcry application.

The name that you give this '.cfm' file will also be the name of the custom config item. Eg: 'myCustomConfig.cfm' = 'myCustomConfig'.

Step 2 - Deploy it

To deploy your custom config item (ie create it in the database), you will need to login to Farcry and go to Admin >> Custom Config and click on the 'Deploy' link.

Editing

Default settings

Now that the custom config item has been created successfully in the database, there may be times when a change in the default settings is required. This can be achieved easily.

Login to Farcry and go to Admin >> Config Files. Your custom config item will be listed with all other default config items.

Click on your custom config item to invoke the edit handler, make any required changes and don't forget to update!

Restoring defaults

If you ever need to restore the custom config defaults, go to Admin >> Custom Config and click on the 'Restore Default' link. This will overwrite all of the edited fields with the defaults originally set up in the cfscript file stored in dmConfig folder.