Hi all, I have an application developed with codeIgniter that I would like to write a nice user friendly install script for. The biggest problem with this is that code-igniter needs configuration manually before this can happen, does anyone know a way around this / the the best way to allow this with minimal configuration?
Hi there,
I assume you can introduce a flag parameter either in master index.php file outside system directory or config file inside the system/config to see if setup has previously run or not, also you should not get any error from database before calling any model in your controllers.
If your configuration is built into a form you could include the configuration in the install.
The form would need to validate and verify configuration options such as testing database connections and validating the urls.
Take a look at how WordPress do their 5 minute install. It has a couple of customisations and tests them before proceeding.
Hey
You can get the content out of the config files and write (or overwrite) them.
There are really only 2 areas in a codeigniter project that need manual configuration:
- the index.php front controller for the application
- the config.php file in the application directory
There are a ton of configuration options that you can use but basically you're going to need to know:
- the base URL for the application
- the base path the application/system folder reside on
You can determine #2 by the path you just installed the application to.
If your application is running at the docroot you could set the base url to:
"http://".$_SERVER['SERVER_NAME']."/";
otherwise you'll need to ask the user what URL this application is supposed to reside at.