My client has multiple companies; different names/logos etc, but all the content on the sites are identical with the exception of said names/logos.
In a ColdFusion environment, what would be the best way for me to serve up identical content and swap out the logos/company names on the fly so I can keep everything in one spot? Is this a jQuery solution? regex? Or will ColdFusion enable me to deploy this in an efficient manner based on the url and session variables?
I would recommend something similar to what @Ben Doom suggested; though not storing in session scope. Instead, I would recommend using Application scope. There’s no reason to make every user’s session repeat the same information over and over.
You can get 2 different “applications” (basically just different address spaces) running from the same codebase by giving them different application names. As Ben suggests, I would base the application name on a CGI variable. Using a hash will guarantee that the value will be safe to use as an application name, but won’t be as easy to switch on.
Application.cfc:
Not all CGI variables are safe — some can be modified by the user (referrer, ip, etc), so if you’re going to use one of those, I recommend doing something like hashing it as I’ve done above to make sure it’s safe to use here… But if you use one of the safe values (like cgi.server_name), then you should be safe using it without hashing/etc.
In that case, it would be much easier to setup the theme of the display to switch on which application is running:
Application.cfc:
index.cfm:
layouts/layout.cfm:
(Tested on Win7/IIS7)