Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-content/plugins/paged-comments/paged-comments/paged-comments.php on line 159

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-content/plugins/paged-comments/paged-comments/paged-comments.php on line 380

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-content/plugins/paged-comments/paged-comments/paged-comments.php on line 382

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-content/plugins/paged-comments/paged-comments/paged-comments.php on line 386

Deprecated: Assigning the return value of new by reference is deprecated in /home/onepixel/public_html/wp-content/plugins/paged-comments/paged-comments/paged-comments.php on line 481
1 Pixel Out » appConstants Mach-II plugin

ColdFusion, WordPress, Flash & other web things


appConstants Mach-II plugin

File name:
appConstants.cfc
Version:
2.3
Last updated:
27 September 2005
Requirements:
Mach-II 1.0.10, CFMX 6.1

This plugin allows you to have a different set of application constants for each server running your Mach-II application. This is really useful if you are using version control and each developer is running the application on their local machine.

If you’re looking for a PHP version of this plugin, you can get one from Dave Spurr’s blog.

Note: this plugin requires version 1.0.10 of the Mach-II core files (although it can be modified to work with 1.0.9).

Place appConstants.cfc in the MachII plugins folder. Place this in the Mach-II configuration file:

<plugin name="appConstants" type="MachII.plugins.appConstants" />

or

<plugin name="appConstants" type="MachII.plugins.appConstants">
	<parameters>
		<parameter name="constantsFile" value="path_to_constants_file" />
	</parameters>
</plugin>

The constantsFile optional parameter should be a path to your constants XML file relative to your application root (set in the properties section of your configuration file). It defaults to “/config/constants.xml”.

The constants XML file should follow the following format:

<?xml version="1.0" encoding="utf-8"?>
<constants>
	<common>
		<constant name="constant_name_1" value="constant_value_1" />
		<constant name="constant_name_2" value="constant_value_2" />
		...

		<property name="property_name_1" value="property_value_1" />
		...
	</common>
	<server name="your_dev_server_name">
		<constant name="constant_name_1" value="constant_value_1" />
		<constant name="constant_name_2" value="constant_value_2" />
		...

		<property name="property_name_1" value="property_value_1" />
		...
	</server>
	<server name="your_testing_server_name">
		<constant name="constant_name_1" value="constant_value_1" />
		<constant name="constant_name_2" value="constant_value_2" />
		...

		<property name="property_name_1" value="property_value_1" />
		...
	</server>
	<server name="your_live_server_name">
		<constant name="constant_name_1" value="constant_value_1" />
		<constant name="constant_name_2" value="constant_value_2" />
		...

		<property name="property_name_1" value="property_value_1" />
		...
	</server>
</constants>

You will have access to the constants set up in the server section of the constants file that corresponds to the server currently running your application as well as all constants in the common block (common constant values are overwritten by server block values).

You can also specify a comma separated list of server names for a single server section (useful if several domains point to the same application).

All constants are placed in a structure named appConstants that you can access as a Mach-II property.

You can also set Mach-II properties with the property tag. These properties will overwrite any existing Mach-II properties.

Note: You can use this plugin for a single server setup. Place all your constants in the common block and don’t bother with any server blocks.

Download appConstants.cfc

21 comments

Pages: [3] 2 1 » Show All

  1. #21: Kai Pradel Says:

    Martin,
    thanks for the quick reply. My flex application is mostly framwork agnostic, so it doesn’t invoke Mach-ii unless I run it through a Gateway that does extend the listener. Hence the constant problem of getting global variables exposed.
    I’ll play around with it some more and if I find a way I will post it here.. thanks again for this very useful plugin.

    Kai

Pages: [3] 2 1 » Show All