Hello,
        I am Alexandru from InterAKT Online, a company that did mostly PHP
until recently, as we've started to migrate all our products to ColdFusion.

        Of course, because we will be CFMX compatible, we have started to
use CFCs, and we've met the problem that makes impossible to use CFCs in
shared hosting environments. That means that you can't distribute your CFCs
in one of your site's folders, as you cant reference them with
"../cfc/cfc1".

        As we create tools that should be usable on any ColdFusion MX
server, we have received this news pretty sad, and we've searched the
Internet for a solution that could solve our problem - we haven't found one
but we've found a thread with the messages from this list -
http://www.mail-archive.com/[EMAIL PROTECTED]/msg02747.html

        However, we have solved the problem and we want to share it with
you. It will not solve all the issues in shared hosting environments (I've
read on this list that there are many), but maybe it will help some of you
create better distributable software. Comments are welcome.

Problem: Can's instantiate a CFC using a relative path

Solution: Use a dynamic instantiation mechanism that uses an "proxy"
included file that is located in the same folder as the CFCs and that does
the instantiation itself. 

The required file code will look like this:

<cffunction name="KT_CreateObject" returntype="any">
        <cfargument name="path" type="string">
        <cfreturn CreateObject("component","#path#")>
</cffunction>
<cfset Request.KT_CreateObject = KT_CreateObject>

In your page you will require the proxy file

<cfinclude template="../tng/kt_tng.cfm">

        And then you will instantiate your CFCs using it's KT_CreateObject
method.

Insert_tNG1 = Request.KT_CreateObject("kt_tng");

        I hope you will find this useful.

        Looking forward to comments on this method,

                                        Alexandru

--
Alexandru COSTIN
Chief Operating Officer
http://www.interakt.ro/
+4021 312 5312



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to