Welcome Guest, Not a member yet? Register   Sign In
[Help/Suggestion] New project - Backend and Frontend Setup
#2

[eluser]Glazz[/eluser]
Well i came up with a "solution" not the best one but it is working so far...

For now i can have both config.php and database.php elsewhere.

My edits is:
application/config/config.php
Code:
<?php defined('BASEPATH') OR exit('Access denied!');

/*
|--------------------------------------------------------------------------
| Application directory name
|--------------------------------------------------------------------------
|
|
|
*/
$config['app_url'] = 'admin';


/*
|--------------------------------------------------------------------------
| Load the global configuration file.
|--------------------------------------------------------------------------
*/
if (file_exists(CONFIGPATH . 'config.php')):
// Include the configuration file.
//
require(CONFIGPATH . 'config.php');

// Merge both $config arrays.
//
$config = array_merge($config, $config);

// Configure the application base url.
//
$config['base_url'] = $config['base_url'] . $config['app_url'];
endif;

/* End of file config.php */
/* Location: ./application/config/config.php */


application/config/database.php
Code:
<?php defined('BASEPATH') OR exit('Access denied!');

/*
|--------------------------------------------------------------------------
| Load the database configuration file.
|--------------------------------------------------------------------------
*/
if (file_exists(CONFIGPATH . 'database.php')):
// Include the database configuration file.
//
require(CONFIGPATH . 'database.php');
endif;

/* End of file database.php */
/* Location: ./application/config/database.php */


index.php
Code:
/*
|---------------------------------------------------------------
| CONFIG FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the nome of your "config" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
*/
$config_path = '../system/config';

/*
* ---------------------------------------------------------------
*  Resolve the config path for increased reliability
* ---------------------------------------------------------------
*/

if (realpath($config_path) !== FALSE)
{
  $config_path = realpath($config_path).'/';
}

// ensure there's a trailing slash
$config_path = rtrim($config_path, '/').'/';

// Is the system path correct?
if ( ! is_dir($config_path))
{
  exit("Your config folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}


// Path to the config folder.
define('CONFIGPATH', str_replace("\\", "/", $config_path));



And i created a config folder inside my system folder that looks like this:
Quote:system
| codeigniter
| config
| config.php
| database.php

Inside this config folder i pasted both original config.php and database.php files, and i can have the same config file for multiple applications.


Messages In This Thread
[Help/Suggestion] New project - Backend and Frontend Setup - by El Forum - 03-05-2012, 01:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB