Skip to content

Instantly share code, notes, and snippets.

@jrvaja
Created July 3, 2012 03:52
Show Gist options
  • Save jrvaja/3037537 to your computer and use it in GitHub Desktop.
Save jrvaja/3037537 to your computer and use it in GitHub Desktop.
CodeIgniter:Items
/*************************************************************************
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