CounterMarch Systems

so much to say


We used to blog more before twitter came along.

Farcry 3: Two sites, one domain

Worked on an interesting little project last night with Farcry. It's been a while since I've written about it at all. so I figured I was overdue.

Lehigh's alumni association runs two major reunion events each year. There's a "traditional" reunion in the springtime that is for anyone who graduated more than 10 years ago. In the fall. there's an event called Young Alumni Reunion that I have blogged about many times before as the site we use for marketing is powered by Farcry.

This year. we rebuilt the traditional reunion site in Farcry and strapped it to a homegrown reservation system (Ajaxy goodness. Mach-ii badness...so nice) replacing a system that another consulting company had built about 6 years ago in ASP. The plan was to get both reunions running off of a common system for both marketing and reservations so the staff could easily work both events without relearning the tech systems. Made a lot of sense!

The thing is - both events have a very different look. feel. message. tone. approach...all that stuff. Also. much of the content doesn't change terribly much from year to year for each event. The greatest part of this is that the reunions don't overlap at all. so we can get away with using one domain for the entire thing. I have a little hangup about clean URLs that I can't seem to shake. so putting each event in a separate "folder" wasn't going to be acceptable.

I needed to use one domain for two separate sites (and therefore Farcry applications) that would transition seamlessly and without intervention twice a year. Seems simple enough - tweak a couple of files and it should work. right? Yep!

The two separate Farcry sites (farcry_reunion and farcry_yar) have their own independent databases. I mapped the site root in IIS to the www folder under farcry_reunion and moved any graphical/js/css assets from the www folder of farcry_yar to the reunion www folder. Cool - so now everything web-accessible is in one place. Not really ideal for ripping things apart. but since a) I kept a backup and b) the assets are very. very different it's not a major concern. Now to get the sites to switch over without manual intervention. we tweak a few files:

In apps.cfm. we define July 1 as the transition date. On January 1. the traditional reunion site will kick in again.

<cfscript>
stApps = structNew();
if(datepart('m'. now()) lt 7) {
stApps['***site domain name***'] = 'farcry_reunion';
} else {
stApps['***site domain name***'] = 'farcry_yar';
}
</cfscript>

In the Application.cfm file under farcry_reunion (since that's the "primary" www folder now) we have to set the application name to the right farcry app name depending on the time of year:

<cfif datepart('m'. now()) lt 7>
<cfset appname = "farcry_reunion">
<cfelse>
<cfset appname = "farcry_yar">
</cfif>
<cfapplication name="#appname#" sessionmanagement="Yes" sessiontimeout="#createTimeSpan(0.1.0.0)#">

In that same file you have to make sure the right app init file is loaded. I replaced ".." with "/farcry/#appname#" in the following line of code:

<!--- Project Specific Initialisation --->
<cfinclude template="/farcry/#appname#/config/_applicationInit.cfm">

That should be sufficient to get the site up and running (after a quick ?updateApp=1). To get the administrator running. I had to comment out the guts of the farcry_yar/www/Application.cfm file and replace it with a cfinclude of farcry_reunion/www/Application.cfm.

Most people will never need to do something this loony. I did it because I wanted to create a hands-off transition from one reunion to the next (basically removing some busy-work from my plate). Ping me if there's anything you'd like to know or have any comments on - remember. if you have a better way. it has to be a hands-off transition!

Come to think of it...we could have written some code to make IIS remap the domain's home folder to farcry_yar/www at the right time of year too...that might have been much simpler!

Comments

About the blog

7 years of outstanding software development

CounterMarch Systems is a professional consulting firm specializing in Adobe technologies with a special focus on higher education.

2771 Red Oak Circle
Bethlehem, Pennsylvania 18017
610.280.3455
Contact Us