[eluser]ErwinVanHoof[/eluser]
When using custom Config files I came across the following error:
Using:
Code:
$this->config->load('[config_filename]', TRUE);
I was unable to retrieve the values with the function:
Code:
$this->config->item('[config_filename]','[item]')
The problem is caused by the function
item() in
Config.php.
In the else statement the function first looks at
index and not the
item which should be the other way around, the same fault is repeaeted in the function.
The problems is solved by changing:
-system
-libraries
Config.php
starting at line 124:
Code:
function item($item, $index = '')
{
if ($index == '')
{
if ( ! isset($this->config[$item]))
{
return FALSE;
}
$pref = $this->config[$item];
}
else
{
if ( ! isset($this->config[$index]))
{
return FALSE;
}
if ( ! isset($this->config[$index][$item]))
{
return FALSE;
}
$pref = $this->config[$index][$item];
}
return $pref;
}
to
Code:
function item($item, $index = '')
{
if ($index == '')
{
if ( ! isset($this->config[$item]))
{
return FALSE;
}
$pref = $this->config[$item];
}
else
{
if ( ! isset($this->config[$item]))
{
return FALSE;
}
if ( ! isset($this->config[$item][$index]))
{
return FALSE;
}
$pref = $this->config[$item][$index];
}
return $pref;
}