>I'm sure I'm overlooking something obvious..
>
>If I want to run 2 different sites on 1 fusebox app.. How would I do that?
>
>For example, let's say I own the domain www.foo.com and www.bar.com. I'd
>like to direct people to one directory which will figure out what the
>URL is and then load the appropriate pages. However, I want 2
>directories. Foo and Bar so I can edit one site without worrying about
>the other messing up.
>
>Is there a somewhat simple way to do this or do I need to load in 2
>fusebox apps in different directories?


Put this in your Application.cfc's onRequestStart method:

switch (cgi.server_name) {
  case "bar.com": case "www.bar.com":
     request.siteID = 2;
     request.siteName = "Bar";
  defaultcase:
     request.siteID = 1;
     request.siteName = "Foo";
     break;
}

Then you can include templates or call cfc's with #request.siteName# in the 
path, like: <include 
template="#request.cfRoot#dsp/#request.siteName#/loginForm" /> or <invoke 
component="myApp.#Request.siteName#" method="whatever">.  In my implementation 
of this practice, I've got a shared database as well.  Parent tables usually 
contain 'siteID' fields, foreign keys from a 'site' table that contains the 
same definitions in the onRequestStart switch.  (I really ought to dynamicize 
those site value definitions and param them to the app scope, loaded from the 
database, come to think of it.)

If you really want to go looking for the purple banana, you can dynamically 
include css, js, layout, and other files too, and get the most out of that 
request.siteName variable. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:286445
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to