In the wake of setting up the site, the following thing that we ought to do is to design the site. The application/config organizer contains a gathering of documents that set essential setup of your site.
Configuring Base URL
The base URL of the site can be arranged in application/config/config.php record. It is URL to your CodeIgniter root. Ordinarily, this will be your base URL, with a trailing cut for example
http://example.com/
In the event that this isn't set, at that point CodeIgniter will attempt to figure the convention, area and way to your establishment. In any case, you ought to consistently design this expressly and never depend on autoguessing, particularly underway situations. You can arrange the base URL in the $config cluster with key "base_url" as appeared underneath −
$config['base_url'] = 'http://your-domain.com';
Database Configuration
The database of the site can be arranged in application/config/database.php document. Frequently we have to set up database for various condition like turn of events and creation. With the multidimensional exhibit gave in the CodeIgniter, we can arrangement database for various condition. The setup settings are put away in the exhibit as appeared underneath −
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'database_name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array()
);
You can leave hardly any alternatives to their default esteems with the exception of hostname, username, secret word, database and dbdriver.
- hostname − Specify area of your database here for example localhost or IP address
- username − Set username of your database here.
- secret word − Set secret key of your database here.
- database − Set name of the database here.
- dbdriver − Set sort of database that you are utilizing for example MySQL, MySQLi, Postgre SQL, ODBC, and MS SQL.
By changing the key of the cluster $db, you can set other setup of database as demonstrated as follows. Here, we have set the way to 'test' to set the database for testing condition, by keeping the other database condition for what it's worth.
$db['test'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'database_name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array()
);
You can basically change to various condition by changing the estimation of a variable as appeared underneath −
$active_group = ‘default’; //This will set the default environment
$active_group = ‘test’; //This will set the test environment
Autoload Configuration
This record determines, naturally, which frameworks ought to be stacked. So as to keep the structure as light-weight as could reasonably be expected, just unquestionably the insignificant assets are stacked as a matter of course. One ought to autoload the often utilized framework, as opposed to stacking it at neighborhood level, over and again. Following are the things you can stack naturally −
- Libraries − It is a rundown of libraries, which ought to be auto stacked. Give a rundown of libraries in a cluster as demonstrated underneath to be autoloaded by CodeIgniter. In this model, we are auto stacking database, email and meeting libraries.
$autoload['libraries'] = array('database', 'email', 'session');
- Drivers − These classes are situated in framework/libraries/or in your application/libraries/catalog, but on the other hand are put inside their own subdirectory and they broaden the CI_Driver_Library class. They offer different compatible driver alternatives. Following is a guide to autoload store drivers.
$autoload['drivers'] = array('cache');
- Partner records − It is a rundown of assistant documents, to be autoloaded. Give a rundown of libraries in the exhibit, as demonstrated as follows, to be autoloaded by CodeIgniter. In the given model, we are autoloading URL and record partners.
$autoload['helper'] = array('url', 'file');
- Custom config records − These documents are expected for use, just on the off chance that you have made custom config documents. Something else, leave it clear. Following is a case of how to autoload more than one config documents.
$autoload['config'] = array('config1', 'config2');
- Language documents − It is a rundown of language records, which ought to be auto stacked. Take a gander at the model given underneath. Give a rundown of dialects in an exhibit as demonstrated beneath to be auto stacked by CodeIgniter. Remember that do exclude the "_lang" some portion of your record. For instance, "codeigniter_lang.php" would be referenced as array('codeigniter');
- Models − It is a rundown of models document, which ought to be autoloaded. Give a rundown of models in an exhibit as demonstrated beneath to be autoloaded by CodeIgniter. Following is the case of how to auto load more than one demonstrates records.
$autoload['model'] = array('first_model', 'second_model');