jquery - The best way to deploy one site for two companies in ColdFusion? -


My client has many companies; Different names / logos etc., but all the content on the site are identical with the exception of name / logo.

In a Coldfusion environment, what would be the best way for me to serve the same content and swap the logo / company names on the fly so that I can keep everything in one place? Is this a jQuery solution? Regex? Or will it be able to deploy it in an efficient manner based on ColdFusion URL and session variables?

I have suggested bin bin as suggested by some; However, instead of storing the scope of the session, I would recommend using the application scope instead. There is no reason to repeat the same information in every user's session.

You can get 2 different "applications" (basically just a separate address space), which give them different application names and run them from the same codebase. As Ben suggests, I will be the basis of 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 switching will not be easy.

Application.cfc:

Components {this.name = hash (cgi.server_name); }

Not all CGI variables are safe - some can be modified by the user (Referrer, IP, etc.), so if you are going to use one of them I like something like I did the above, to ensure that it is safe to use here ... but if you use a safe values ​​(like cgi.server_name) Safe without using it Ahia. / P>

In that case, to switch to the application running, it will be very easy to set the theme of the display:

Application.cfc:

  element {this.name = cgi.server_name; }  

index.cfm:

  & lt; Cfimport prefix = "custom" taglib = "# extension path ('./layout') #" /> & Lt; Custom: Layout Theme = "# application.applicationname #" & gt; & Lt ;! --- Your stuff here --- & gt; & Lt; / Custom: Layout & gt;  

layout / layout.cfm:

  & lt; Cfparam name = "attributes.theme" default = "www.site1.com" /> & Lt; Cfif features. Theme eq "www.site1.com" & gt; & Lt ;! --- Contains material for this topic --- & gt; & Lt; Cfelse & gt; & Lt ;! --- Contains material for this topic --- & gt; & Lt; / Cfif>  

(tested on Win7 / IIS7)


Comments