ugh. ignore the fact that i call it application.settings in one place and application.defaults in another. I wish google groups had an "edit" button.
On Mar 17, 3:07 pm, "Aaron J. White" <[email protected]> wrote: > Hey all, > > Trying to write an open source application with OpenBD that is very > simple to deploy. A lot of opensource applications I use in php like > YOURLS or Joomla! usually have a simple configuration.php file that > you can open with a text editor to modify the variables. To me this > seems clean and easy for most users to do. I would like to emulate > this behavior in my app, but I don't want users to have to touch the > application.cfc. > > How would you guys do this? Below is my first attempt that works, > however, I don't know if there is a cleaner way or a way that doesn't > require an application restart. > > //** Start Code in Application.cfc **// > <cffunction name="onApplicationStart" returnType="boolean" > output="false"> > > <!--- define default settings ---> > <cfset application.defaults= { > setting1="notOverwritten", > setting2="notOverwritten", > setting3="notOverwritten", > setting4="notOverwritten" > } /> > > <!--- grab user settings ---> > <cfinclude template="settings.cfm" /> > > <cfreturn true > > </cffunction> > //** End Code Application.cfc **// > //** Start Code in Settings.cfm **// > <cfscript> > structAppend(application.settings, { > /*Change settings below this line*/ > > setting1: 'setting1', /* true */ > setting2: 'setting2', /* 'big' */ > setting3: 'setting3' /* 10 */ > > }); > </cfscript> > > //** End Code Settings.cfm **// -- online documentation: http://openbd.org/manual/ google+ hints/tips: https://plus.google.com/115990347459711259462 http://groups.google.com/group/openbd?hl=en
