what i do, is set 2 different app scope vars that hold path to cfc dir
(in your case that will be website's root) for localhost and remote
(production) site:
<cffunction name="onApplicationStart" output="no" returntype="boolean">
....
<!--- set server-specific app vars (LOCAL server and REMOTE server) --->
<!--- LOCAL SETTINGS --->
<cfif cgi.SERVER_NAME is "localhost">
<cfset application.cfcpath = 'path.to.my.cfcs.from.localhost.root.'>
....
<!--- REMOTE SETTINGS --->
<cfelseif findnocase('photos-of-laos.org', cgi.SERVER_NAME) gt 0>
<cfset application.cfcpath = 'path.to.cfcs.on.production.server.'>
...
</cfif>
....
</cffunction>
in your case the LOCAL cfcpath will be 'mywebsite2.' and remote path
will be just '.'
use it (invoke components. create objects extend components etc) as
#application.cfcpath#componentnamehere
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Didgiman wrote:
> Hi all,
>
> I really hope someone can help me out here, as I can't figure out how to do
> this.
>
> Lets assume the following structure (on my local pc):
>
>
>> wwwroot
>>
>>> mywebsite1
>>> mywebsite2
>>>
>>>> Application.cfc
>>>> ApplicationProxy.cfc (which basically just extends Application.cfc)
>>>> admin
>>>>
>>>>> Application.cfc
>>>>>
>
> I imagine this setup is not that uncommon. On my development pc I have
> multiple sites in the webroot.
> So if I want to extend the Application.cfc in the admin folder (which would
> have the cflogin logic), I would have to use <cfcomponent
> extends="mywebsite2.ApplicationProxy">.
>
> But when I move the site online, it's the only site in the webroot:
>
>> wwwroot
>>
>>> Application.cfc
>>> ApplicationProxy.cfc (which basically just extends Application.cfc)
>>> admin
>>>
>>>> Application.cfc
>>>>
>
> In this scenario, the admin Application.cfc should extend the main
> Application.cfc like this: <cfcomponent extends="ApplicationProxy">
>
> I think so far I'm making some sense, right?
>
> Now, what do I have to do to be able to use the same code for development
> and production? I cannot evaluate the correct path to the root
> Application.cfc like this:
>
> <cfcomponent extends="#IIF(cgi.server_name EQ '127.0.0.1',
> DE('mywebsite2.ApplicationProxy'), DE('ApplicationProxy'))#">
>
> ...because I get this error: "This expression must have a constant value".
>
> I'm sure I'm not the first to have this problem. Can someone please
> guide me through this? I really want to use the same code for
> development and production.
> I'm on a shared hosting, so I can't do server mappings, and I think
> application mappings can't be useful here.
>
> What am I missing here?
>
> Thank you for reading my (quite lengthy) post.
>
> Wim
> Belgium
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307389
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4