Created
July 3, 2012 03:52
-
-
Save jrvaja/3037537 to your computer and use it in GitHub Desktop.
CodeIgniter:Items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************* | |
Loading a Config File | |
**************************************************************************/ | |
/*---------------------------------- | |
Manual Loading | |
----------------------------------*/ | |
$this->config->load('filename'); | |
/************************************************************************* | |
Fetching Config Items | |
**************************************************************************/ | |
/*-------------------------------------------------------- | |
$this->config->item('item name'); | |
---------------------------------------------------------*/ | |
/*--------------------------------------------------------- | |
$lang = $this->config->item('language'); | |
---------------------------------------------------------*/ | |
/*-------------------------------------------------------- | |
Loads a config file named blog_settings.php and assigns | |
it to an index named "blog_settings" | |
---------------------------------------------------------*/ | |
$this->config->load('blog_settings', TRUE); | |
/*-------------------------------------------------------- | |
Retrieve a config item named site_name contained | |
within the blog_settings array | |
---------------------------------------------------------*/ | |
$site_name = $this->config->item('site_name', 'blog_settings'); | |
/*-------------------------------------------------------- | |
An alternate way to specify the same item: | |
---------------------------------------------------------*/ | |
$blog_config = $this->config->item('blog_settings'); | |
$site_name = $blog_config['site_name']; | |
/************************************************************************* | |
Setting a Config Item | |
**************************************************************************/ | |
$this->config->set_item('item_name', 'item_value'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment