Welcome Guest, Not a member yet? Register   Sign In
few general questions about configuration in release
#1

[eluser]chejnik[/eluser]
Hello,
I would like to release an Dictionary application, that can anyone install to your server and use it there.
Is there a simple way to override database confiration settings in config/database.php or is it better to use some new created config file with database configuration settings and other stuff?

This function I have found creates simple config array
Code:
// $toconfig is simple array like this
$toconfig = array (
            'hostname' => $_POST["hostname"],
            'database' => $_POST["database"],
            'username' => $_POST["username"],
            'password' => $_POST["password"],
            'dbdriver' => $_POST["dbdriver"],
            'dbprefix' => $_POST["dbprefix"],
            );
function make_config($toconfig)
    {
        $this->config->load('myconfig', TRUE);
        $myconfig = $this->config->item('myconfig');
        $result = array_merge($myconfig, $toconfig);
        $data = '<?php' . "\n" . 'if (!defined("BASEPATH")) exit("No direct script access allowed");' . "\n" . '$config = ' . var_export($result, true) . "\n" . '?>';
        write_file(APPPATH . 'config/myconfig.php', $data);
        }
I wonder how would you solve it. Thank you


Messages In This Thread
few general questions about configuration in release - by El Forum - 02-22-2008, 05:01 PM
few general questions about configuration in release - by El Forum - 02-22-2008, 07:33 PM
few general questions about configuration in release - by El Forum - 02-23-2008, 08:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB