I did something like this:

I have each site in a folder with its own application.cfc.  Each
individual site has:

<cfcomponent extends="baseComponent">

</cfcomponent>

Anything custom I will stick as a method in the site's individual
application.cfc, otherwise they all extend a base .cfc and inherit its
methods.  I really love it for hit tracking and security layers, makes
it a cinch to apply styles or  google analytics to them all, and
centralized error handling is great =)

Just an idea!

Chris Peterson


On 4/13/07, Che Vilnonis <[EMAIL PROTECTED]> wrote:
>
> Is there anything inherently wrong with this Application.cfm file? Its

> for a shared CF hosting account w/ multiple domains (around 10 or so).

> Could it be improved? FWIW, it does work. :)
>
> My goal is to write my code so that I can host many related domains 
> with one set of "core" code. Only ini files, stylesheets, images and 
> site navigation includes will change from site to site. These site 
> aren't very complicated, so there is no great need for a MVC type app.

> And yes, much of the code below was modified from Ray Camden's 
> original work. :)
>
> Thanks for any input... Che
>
> <cfsilent>
>
> <!--- determine the domain name. --->
> <cfset strSiteUrl = LCase(Replace(cgi.server_name, "www.", "", "ALL"))

> />
>
> <cfswitch expression="#strSiteUrl#">
>        <cfcase value="buickpartspage.com">
>                <cfapplication
>                        name="BuickPartsPage"
>                        applicationtimeout="#CreateTimeSpan( 1, 0, 0, 0
)#"
>                        sessionmanagement="false"
>                        setclientcookies="true"/>
>        </cfcase>
>
>        <cfcase value="pontiacpartspage.com">
>                <cfapplication
>                        name="PontiacPartsPage"
>                        applicationtimeout="#CreateTimeSpan( 1, 0, 0, 0
)#"
>                        sessionmanagement="false"
>                        setclientcookies="true"/>
>        </cfcase>
>
>        <cfdefaultcase>
>                <cfapplication
>                        name="ThePartsPages"
>                        applicationtimeout="#CreateTimeSpan( 1, 0, 0, 0
)#"
>                        sessionmanagement="false"
>                        setclientcookies="true"/>
>        </cfdefaultcase>
> </cfswitch>
>
> <cfif not isDefined("application.settings") or 
> isDefined("url.reinit")>
>
>        <!--- Clear the existing Application to make sure we don't have

> any old data. --->
>        <cfset StructClear(application)>
>
>        <cfswitch expression="#strSiteUrl#">
>                <cfcase value="buickpartspage.com">
>                        <cfset iniFile = 
> expandPath("./ini/buick.ini.cfm") />
>                </cfcase>
>                <cfdefaultcase>
>                        <cfset iniFile =
expandPath("./ini/tpp.ini.cfm") />
>                </cfdefaultcase>
>        </cfswitch>
>
>        <cfset sections = getProfileSections(iniFile)>
>        <cfset data = structNew()>
>        <cfif structKeyExists(sections, "default")>
>                <cfloop index="key" list="#sections.default#">
>                        <cfset data[key] = getProfileString(iniFile, 
> "default", key)>
>                </cfloop>
>                <cfset application.settings = data>
>        <cfelse>
>                <cfthrow message="Ini file has a missing default
section!">
>        </cfif>
>
>        <!--- load and init rss feed. other than writing results to a 
> file, not sure how to cache results. --->
>        <cfset application.settings.rssFeed = createObject("component",

> "com.rss").getEntries(xmlData=application.settings.rssFeedURL)>
>
>        <!--- load and init flickr feed. let's grab only the latest 8 
> photos. --->
>        <cfset flickr = createobject("component", "CFlickr.Flickr")>
>        <cfset flickr.init(application.settings.apikey,
> application.settings.secret)>
>        <cfset pi = flickr.getPhotosInterface()>
>        <cfset photoSearch = pi.search(text="classic buick", 
> tag_mode="all", sort="date-posted-desc", per_page=12)>
>        <cfset application.settings.arrayPhotos = 
> photoSearch.getPhotos()>
>
>        <!--- We are initialized :) --->
>        <cfset application.init = true>
>
> </cfif>
>
> <!--- <cfsetting showdebugoutput="false"> --->
>
> </cfsilent>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

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

Reply via email to