[eluser]developer10[/eluser]
i want to have a file to store my config items. what is the best way of doing this and how am i supposed to retrieve config items from it?
i tried something like this, but it didn't work (NOTE: i looked into some app and tried to replicate this):
i created a file named "app_config" and saved it in the config folder of my application.
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$config['some_item'] = 'blah-blah-blah';
?>
then in my file "Functions" which is located in library folder, put this:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Functions
{
function Functions()
{
$this->ci =& get_instance();
$this->ci->load->config('app_config');
}
}
in my controller, i load this library
Code:
$this->load->library('functions');
Now, i try to retrieve "some_item" value from config (with or without "echo"):
Code:
$this->app_config->some_item;
Code:
$this->functions->some_item;
EDIT: neither of those ways works.
is this the correct way or i'm doing something wrong? do i really need to import config file into library file before i'm
able to use it, or there's a better solution?
Thanks!