• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write to config file

#1
Hello,

I'm making installation file, how can I write to e.g. database config file with fwrite()?
I want to change value of hostname, username, password, database name. How can I select these particular array elements?
Reply

#2
You can create CodeIgniter config.tpl files with dummy values and use
str_replace to replace the dummy values with the inputted values.

1) open and read the ./application/config.tpl config file
2) use str_replace to add the correct values
3) save and write the config.php file to the ./application/config folder

This can be used to write any type of CodeIgniter configuration file.

I'll see if I can give you an example later today.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
Thanks, I know now how to make it! Smile
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.