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>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275100
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4