CodeIgniter Forums
loading a config file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: loading a config file (/showthread.php?tid=16878)



loading a config file - El Forum - 03-18-2009

[eluser]bas_vdl[/eluser]
i want to load an item that is located in a config file. the file is form_validation.php and inside the file there is an array like this:

Code:
$config = array(
    'login' => array(
        array(
            'field' => 'username',
            'label' => 'gebruikersnaam',
            'rules' => 'required'
        ),
        array(
            'field' => 'password',
            'label' => 'wachtwoord',
            'rules' => 'required|md5'
        )
    )
)

?>


i try to do it like this but the print_r is EMPTY
Code:
<?php
    $this->config->load('form_validation', TRUE);
    $validation = $this->config->item('login', 'config');
    print_r($validation);
?>



loading a config file - El Forum - 03-19-2009

[eluser]Clooner[/eluser]
Try:
Code:
<?php
    $this->config->load('form_validation', TRUE);
    $validation = $this->config->item('login', 'form_validation');
    print_r($validation);
?>
If that doesn't work try if the config file is loaded correctly by including a
Code:
die(print_r($config));
at the end of it