Many thanks Mike and Dave. Sounds like we're in the ball park.  If anyone 
else has different ways of doing it, let me know.  
Best,
Nick

----------------------------------------
Return-Path: <listmas...@houseoffusion.com>
Received: from mail.houseoffusion.com [64.118.74.225] by 
mail67.safesecureweb.com with SMTP;
   Sat, 13 Oct 2012 14:12:49 -0400
To: cf-talk <cf-talk@houseoffusion.com>
Message-ID: 
<CAOnEp2f+=czlr6qqqsjymn6lvnqy0srlow5ts+ks8nv5+a6...@mail.gmail.com>
Subject: Re: Best practice question for Application.cfc
References: 
<CACi=xszchjy1aa1pzuhnjw5qktbat800vd+sasfjpmvugv9...@mail.gmail.com>
Date: Sun, 14 Oct 2012 05:12:19 +1100
Precedence: bulk
Reply-To: cf-talk@houseoffusion.com
From: Mike Kear <afpwebwo...@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
X-Rcpt-To: <n.glea...@citysoft.com>
X-SmarterMail-Spam: SpamAssassin 0.6 [raw: 0.6], SPF_None, DK_None
X-SmarterMail-TotalSpamWeight: 0 

Which ever way you do it,  somewhere or other you have to have a file
that's unique to this site, or have a "settings" record in a database or
some such.     Does it REALLY make much difference if it's a site-specific
Application.cfc or a site-specific Settings.xml file or a site-specific
Settings table in a database?

The way I do it is to have a config folder in the core code, which is 
where
I put the site-specific things that are called by the generic core code.
There's usually a config.xml with site name, application name, passwords 
to
things.  Then when I create a new site, I copy all the core code over,
 then go into the config folder and modify all the values in the
config.xml.    The config.xml file is called into a config.cfc  that sets
up all the application and other critical variables for the site at
application start.

But I dont think you necessarily need to do it the way I do.    I would
suggest though, that you keep all the site-specific variables in one place
 (in my case a config folder) so it's quick and easy to set up a new site.
  And also when you modify your code, you know that you can safely copy 
all
your modified files into your other similar sites without breaking all the
site-specific settings.

This is not related to whether or not you use Application.cfm or
Application.cfc.   The same principles apply however you set up your code.
 But since you are changing your architecture, it's a good time to examine
whether you have opportunities to make your code better organised.

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion 9 Enterprise, PHP, ASP, ASP.NET hosting from AUD$15/month

On Sun, Oct 14, 2012 at 1:46 AM, Dave Watts  wrote:

>
> > We're moving from application.cfm to application.cfc and I had a 
question
> > regarding best practices.
> > We re-use our base code and in the past, we have used a settings page
> that
> > is external from the base code and unique per client to set the
> > applicationname variable (and other variables).  This is called at the
> > beginning of application.cfm and provides  with the unique
> > application name.
> > That same structure seems to work with application.cfc but requires
> calling
> > a file at the top of application.cfc, above setting the application
> > variables in application.cfc, to provide the applicationname.
> > Is that approach (calling a file at the top of application.cfc to
> provide a
> > unique client setting) considered a best practice for this kind of 
thing.
> > Or, is there a more appropriate way?
> > The only other thing I could think of would be to hard code the unique
> > client applicationname in Application.cfc, but that would then require
> that
> > Application.cfc be a unique file per client and thus not part of our 
core
> > base code in the sense that we wouldn't include it in upgrades (so 
that
> it
> > wouldn't over-write a unique client file with default values).
>
> I think the most common approach for this sort of thing with
> Application.cfc is to use inheritance. You can have a base
> Application.cfc, then use the EXTENDS attribute to create a new
> Application.cfc with customized settings, overridden event handlers,
> etc.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> http://training.figleaf.com/
>
> Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
> GSA Schedule, and provides the highest caliber vendor-authorized
> instruction at our training centers, online, or onsite.
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352905
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to