Chris,

You're right. I was so quick to get the code working that I didn't even realize I was in a cftry/catch (I was getting the error because of something else I was working on). the core is now left untouched =).

Still, thanks for the fix. Since the cookie is not needed I got rid of it and made it a local variable (and shortened the code a little more).

Thanks again,

Jeff


<!--- Final Code --->


<CFSCRIPT>
    Variables.farcryCallPath = Trim(GetToken(cgi.PATH_INFO,1,"/"));
    SWITCH (Variables.farcryCallPath)
    {
        CASE "base_admin" :{ // Base
            stApps = structNew();
            stApps['localhost'] = 'base';
            break;
        }CASE "haresfoot_admin" :{ // haresfoot
            stApps = structNew();
            stApps['localhost'] = 'haresfoot_admin';
            break;
        }CASE "issuefm_admin" :{ // issuefm
            stApps = structNew();
            stApps['localhost'] = 'issuefm';
            break;
        }DEFAULT :{ // (default)
            stApps = structNew();
            stApps['localhost'] = 'mxdesign';
            break;
        }
    }
</CFSCRIPT>



Chris Kent wrote:

Jeff,


What i wanted was a solution that did not change the core files - I accept that app.cfm is still a core file, but I have upgraded to new versions without having to re-work core code. So far there have been no version upgrades that have changes apps.cfm

I dont think that the mod to /farcry_core/admin/Application.cfm is required. As this is only called if there was an error processing the appnames application.cfm

Chris.

Jeff Coughlin wrote:


It Worked!


There was one thing that you missed (which explains why you used a cookie or session variable if the programmer prefers). The following core file had to be modified:


STEP 1 ============ [/farcry_core/admin/Application.cfm]

Changed the following:

(original)
9: <cfinclude template="/Application.cfm">

(new)
9: <cfinclude template="#cookie.farcryCallPath#/Application.cfm">


-------------
I also made the code a little easier to read by compacting it to one cfscript.


note: I am not using localhost, rather the NetBIOS name over the network. But it works either way.


STEP 2 ============= [/app.cfm]

<cfif Trim(GetToken(cgi.PATH_INFO,1,"/")) neq "farcry">
<cfcookie name="farcryCallPath" value="#Trim(GetToken(cgi.PATH_INFO,1,"/"))#">
</cfif>


<CFSCRIPT>
    SWITCH (cookie.farcryCallPath)
    {
        CASE "base_admin" :{ // Base
            stApps = structNew();
            stApps['localhost'] = 'base';
            break;
        }CASE "haresfoot_admin" :{ // haresfoot
            stApps = structNew();
            stApps['localhost'] = 'haresfoot_admin';
            break;
        }CASE "issuefm_admin" :{ // issuefm
            stApps = structNew();
            stApps['localhost'] = 'issuefm';
            break;
        }DEFAULT :{ // (default)
            stApps = structNew();
            stApps['localhost'] = 'mxdesign';
            break;
        }
    }
</CFSCRIPT>


Thanks Chris. You should probably write this up as a "How-To: Run multiple FarCry websites under one domain name (Useful for working on a development server)" The only problem with it is that you have to modify that one line in a core file. Maybe there is another way around it without having to modify a core file. Anyone?


Best Regards,

Jeff Coughlin
Web Application Developer




Chris Kent wrote:



I have done this. By modifying the apps.cfm and setting up a IIS Virtual Directory for each site admin.


I have had this running for a few months now on my development machine. Everything appears to work 100%. No guarantees offered.

Method:
1. Set an extra IIS virtual directory pointing to the farcry_core/admin directory for each app. I set them up as follows
"appname" points to appname/www
"appname_admin" points to farcry_core/admin
When you want to go to admin area http://localhost/appname_admin/
When you want to view site http://localhost/appname/


2. Mod the apps.cfm as follows.
<cfif Trim(GetToken(cgi.PATH_INFO,1,"/")) neq "farcry">
<cfcookie name="farcryCallPath" value="#Trim(GetToken(cgi.PATH_INFO,1,"/"))#">
</cfif>


<cfswitch expression="#cookie.farcryCallPath#">

<cfcase value="base_admin">
<cfscript>
stApps = structNew();
stApps['localhost'] = 'base';
</cfscript>

<cfcase value="haresfoot_admin">
<cfscript>
stApps = structNew();
stApps['localhost'] = 'haresfoot';
</cfscript>
</cfcase>

<cfcase value="issuefm_admin">
<cfscript>
stApps = structNew();
stApps['localhost'] = 'issuefm';
</cfscript>
</cfcase>

<cfdefaultcase>
<cfscript>
stApps = structNew();
stApps['localhost'] = 'mxdesign';
</cfscript>
</cfdefaultcase>

</cfswitch>

I cant remember why i used cfcookie above, it took a lot of experimentation to get this to work and when i did i was so relieved that i just stopped thinking about it and started using it.

hth,
Chris.


David Ross wrote:


nope, I don't think so. Look at the application.cfm inside
farcry_core/admin...

5: <cfinclude template="/farcry/apps.cfm">
6: <cfinclude
template="/farcry/#stApps[cgi.server_name]#/www/Application.cfm">

cgi.server_name will not have any path information in it.

Why can't you set up CNAME-records (aliases) for each site, e.g.
website1.domain.com?

CGI variables are not reliable... basically, pick from the top 3
(everything else should be spoofable):

http://hoohoo.ncsa.uiuc.edu/cgi/env.html
-dave





[EMAIL PROTECTED] 5/10/2004 2:55:49 PM >>>




So you don't think there is a way to run multiple FarCry websites under

one domain?

(e.g. app.cfm)
<cfscript>
stApps = structNew();
stApps['DOMAIN/website1'] = 'farcry_website1';
stApps['DOMAIN/website2'] = 'farcry_website2';
</cfscript>

The above code obviously wont work, however something similar to this would be nice (or maybe just make it a multi-dimensional array. Or complex structures. I don't really care how it needs to be done =) ).

Before I can this project, does anyone have a work-around to get multiple FarCry websites to work on the same domain (but exist under different sub-directories)?

-Jeff


------------ David Ross wrote:


ok...

1 copy of farcry_core on the server, period.
1 folder for each farcry "instance" (aka "site").
1 database & datasource  for each "instance"

For each new instance, re-run the installer. It will create the




site's

folder for you (you need to create the datasource before you do




this).

For development, you will have to modify apps.cfm to tell it which




site

you want to "admin". I don't think there is any production-grade




method

to run multiple farcry "instances" on the same domain. I could be




wrong.

In production, apps.cfm will determine which "instance" the user is
trying to get to based on the url they are accessing it from. You




cannot

"admin" multiple sites at the same time.

Basically I am saying you will need a different domain for each




site,

unless you are the only admin and have no problem modifing apps.cfm




each

time you want to "admin" a different site.

-dave









[EMAIL PROTECTED] 5/10/2004 11:09:01 AM >>>




I know I've seen this talked about somehwere in the list, but I am having a difficulty finding it.

What I am looking to do...

Two websites (and more later) under one domain name (each site under
its own subdirectory):

1. http://DOMAIN/website1 2. http://DOMAIN/website2
We are using IIS5 (Win2k) and FarCry 2.11 (This is a development
server).

A. Can I leave all the Core folders in the root folder and then have





multiple <farcry_project> folders? Or do I have to have seperate installations of FarCry for each website (I'd prefer to just have one





installation)?

B. If I 'can' have one installation of FarCry core folder do I just
need to make changes in the app.cfm (if so, what is a good example)?

C. If I can have one installation of FarCry, how can I manage all my





websites from a single login (Or is there a different way to manage




the

websites)?

-Jeff

---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED] To unsubscribe send a blank email to
[EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004





---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED] To unsubscribe send a blank email to
[EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004










--- You are currently subscribed to farcry-dev as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to