«« This Month »»
SMTWTFS
 123456
78910111213
14151617181920
21222324252627
28293031   
Bookmark and Share

Aftershock Web Design Blog

ColdFusion and ini files

Mar
23
2006
Related Categories: ColdFusion

This morning I was playing around with this blog and noticed Ray had used some functions I was not familiar with. He used getProfileSections(), getProfileString(), and setProfileString(). These functions are used to read and write ini config files. I was so excited, so I started playing around with it before you know it I had made a rough test app for reading/writing an ini file.

One of the things I wanted to be able to change the settings in a form, and I did not want the system to throw an error if a key was missing in the ini file, or in other words if a key was missing, then set it to be "" when loading the form. So here is how it works:

  1. The administrator loads the form.
  2. ColdFusion or BlueDragon will read the ini file and load the values into the form.
  3. If a key is missing, then the value is "".
  4. Make the changes and save
  5. The system saves the ini file with the new settings. You don't even need to use cffile!

Below is a link to my test app. There is no validation or error trapping with this; like I said, it is a little rough, but it works. To install, just unzip it inside your webroot, and load in a browser. It should work as is.

All I ask is if you use this and improve it, please share your improvements with me.

Have fun!

http://www.aftershockweb.com/blog/enclosures/myini.zip 1.42KB
Posted by Stan Winchester on: March 23, 2006 2:14 PM [Add Comment] [Views: 383]
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)