----
A variable that needs to be set into the set only once but is based on
an environment variable. I am putting it into each /environment/
settings.cfm file but it doesn't seem DRYsince I repeat the same code
in each environment settings.cfm file.
example of /config/design/settings.cfm
<cfset loc.myapp.site = "http://testwww.thissite.com">
<!--- this gets repeated exactly in each settings.cfm since it --->
<cfhttp url="#get('myapp').site#/banner_main.inc" result="header1" />
<cfset loc.myapp.header1 = acfheader1.Filecontent>
<cfhttp url="#get('myapp').site#/banner_main.inc" result="header2" />
<cfset loc.myapp.header2 = acfheader2.Filecontent>
<cfhttp url="#get('myapp').site#/banner_main.inc" result="header3" />
<cfset loc.myapp.header3 = acfheader3.Filecontent>
Any ideas how to dry this? I tried a partial but the function isn't
available yet. I also tried setting in the config/settings.cfm but
the environment/settings.cfm hasn't ran yet.
http://groups.google.com/group/cfwheels/browse_thread/thread/306ac9de56749be2
what you can do, setup default in your config/settings:
<cfset loc.myapp.site = "http://testwww.thissite.com">
<!--- this gets repeated exactly in each settings.cfm since it --->
<cfhttp url="#get('myapp').site#/banner_main.inc" result="header1" />
<cfset loc.myapp.header1 = acfheader1.Filecontent>
<cfhttp url="#get('myapp').site#/banner_main.inc" result="header2" />
<cfset loc.myapp.header2 = acfheader2.Filecontent>
<cfhttp url="#get('myapp').site#/banner_main.inc" result="header3" />
<cfset loc.myapp.header3 = acfheader3.Filecontent>
<cfset set(myapp = loc.myapp)>
then in your config/design/settings you can do:
<cfset loc.myapp = get("myapp")>
<cfset loc.myapp.site = "http://example.com">
<cfset set(myapp = loc.myapp)>
only over riding the variables that you need in each environment.
On Jan 29, 12:34 pm, Mike Henke <henkem...@gmail.com> wrote:
> Here is a discussion for background of where I am coming from:http://groups.google.com/group/cfwheels/browse_thread/thread/1ef535c0...