[eluser]Michael;[/eluser]
Greets Robert;
I recently did something similar in an application I am writing. I took a bit of a different route, but works quite nicely.
#1, Create yourself a library, I call mine "variables". You'll want to autoload it, and depending on your needs you'll have to figure out where the best place to load it is.
#2, The code:
Code:
<?php if ( ! defined('BASEPATH')) exit('You are not permitted direct access to this file.');
class Variables {
var $obj;
function variables() {
$this->obj =& get_instance();
$this->obj->load->model('core/variables_model');
}
function getAll() {
$variables = $this->obj->variables_model->getVariables();
foreach ($variables as $variable){
$this->config->set_item($variable->name, $variable->value);
}
}
}
From here you can season to taste.
Now, for my implementation I did not try to load CI config variables with it, so you might need to play around with things a bit, but this should not pose any problems for those variables at all.
I hope this helps you out, Good Luck.
Michael;