Re: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Tom Chiverton
On Thursday 12 Apr 2007, Che Vilnonis wrote:
 !--- determine the domain name. ---
 cfset strSiteUrl = LCase(Replace(cgi.server_name, www., , ALL)) /

You can save doing this work each and every call by giving move than one item 
in each case.

 cfif not isDefined(application.settings) or isDefined(url.reinit)

You might want to check 'reinit' has some special secret value here.
Also, start a lock.

   cfset application.init = true

And end the lock.

Nothing too bad.

-- 
Tom Chiverton
Helping to administratively cluster seamless architectures
on: http://thefalken.livejournal.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.


~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

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


Re: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Andrew Scott
I did something similar for a client. But I did it differently.

First port of call is identify the doman, then call the database (in my
case site settings are part of the CMS system we designed) then that would
return a struct for the site.

So the code looked something like this in the Application.cfm /
Application.cfc

cfset appSettings = CreateObject('component','com.aegeon.websiteManager')
/
cfapplication name=#appSettings# ... /




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


 

~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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


RE: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Peterson, Chris
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


Re: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Andrew Scott
I guess it also depends on the requirements too.

With my solution, all the client needed to do was to register the domain and
setup the settings in the CMS system and no extra code from us. kind of
makes me redundant, but the client was charged heavily for that feature.



On 4/13/07, Peterson, Chris [EMAIL PROTECTED] wrote:

 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
 
 
 



 

~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

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


RE: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Che Vilnonis
Tom... I'm not following you... Please explain how I don't have to evaluate
the domain on each page?



-Original Message-
From: Tom Chiverton [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 13, 2007 6:58 AM
To: CF-Talk
Subject: Re: Is there anything inherently wrong with this Application.cfm
file?


On Thursday 12 Apr 2007, Che Vilnonis wrote:
 !--- determine the domain name. ---
 cfset strSiteUrl = LCase(Replace(cgi.server_name, www., , ALL)) 
 /

You can save doing this work each and every call by giving move than one
item 
in each case.


~|
ColdFusion MX7 by Adobe®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

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


Re: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Tom Chiverton
On Friday 13 Apr 2007, Che Vilnonis wrote:
 Tom... I'm not following you... Please explain how I don't have to evaluate
 the domain on each page?
  !--- determine the domain name. ---
  cfset strSiteUrl = LCase(Replace(cgi.server_name, www., , ALL))
  /

Your doing a replace to remove the 'www' ?
Why not just write
cfcase value=buickpartspage.com,www.buickpartspage.com
?

You are also lower casing it. AFAIK all web servers will present 
CGI.SERVER_NAME in a consistant case not matter what the user types in.

-- 
Tom Chiverton
Helping to economically establish back-end solutions
on: http://thefalken.livejournal.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.


~|
Macromedia ColdFusion MX7
Upgrade to MX7  experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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


RE: Is there anything inherently wrong with this Application.cfm file?

2007-04-13 Thread Che Vilnonis
Gotcha. Thanks.

-Original Message-
From: Tom Chiverton [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 13, 2007 8:39 AM
To: CF-Talk
Subject: Re: Is there anything inherently wrong with this Application.cfm
file?


On Friday 13 Apr 2007, Che Vilnonis wrote:
 Tom... I'm not following you... Please explain how I don't have to 
 evaluate the domain on each page?
  !--- determine the domain name. ---
  cfset strSiteUrl = LCase(Replace(cgi.server_name, www., , 
  ALL)) /

Your doing a replace to remove the 'www' ?
Why not just write
cfcase value=buickpartspage.com,www.buickpartspage.com
?

You are also lower casing it. AFAIK all web servers will present
CGI.SERVER_NAME in a consistant case not matter what the user types in.


~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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


Is there anything inherently wrong with this Application.cfm file?

2007-04-12 Thread Che Vilnonis
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