diff options
Diffstat (limited to 'user_guide/libraries/config.html')
-rw-r--r-- | user_guide/libraries/config.html | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html index 98b6052a9..71c68332c 100644 --- a/user_guide/libraries/config.html +++ b/user_guide/libraries/config.html @@ -28,7 +28,7 @@ <div id="masthead"> <table cellpadding="0" cellspacing="0" border="0" style="width:100%"> <tr> -<td><h1>CodeIgniter User Guide Version 2.0.0</h1></td> +<td><h1>CodeIgniter User Guide Version 2.0.1</h1></td> <td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td> </tr> </table> @@ -150,23 +150,42 @@ $site_name = $blog_config['site_name'];</code> <p>Where <var>item_name</var> is the $config array index you want to change, and <var>item_value</var> is its value.</p> +<a name="environments"></a> <h2>Environments</h2> -<p>You can set the environment of you application and load config items depending on the current environment. It also disables PHP from displaying errors in environments other than development. To set your environment, open <strong>index.php</strong>, located at the root and change the <var>ENVIRONMENT</var> constant. By default, there is support for a development, test and production environment.</p> - -<code> -define('<var>ENVIRONMENT</var>', '<var>development</var>'); -</code> +<p> + You may load different configuration files depending on the current environment. + The <kbd>ENVIRONMENT</kbd> constant is defined in index.php, and is described + in detail in the <a href="../general/environments.html">Handling Environments</a> + section. +</p> + +<p> + To create an environment-specific configuration file, + create or copy a configuration file in application/config/{ENVIRONMENT}/{FILENAME}.php +</p> + +<p>For example, to create a production-only config.php, you would:</p> + +<ol> + <li>Create the directory application/config/production/</li> + <li>Copy your existing config.php into the above directory</li> + <li>Edit application/config/production/config.php so it contains your production settings</li> +</ol> + +<p> + When you set the <kbd>ENVIRONMENT</kbd> constant to 'production', the settings + for your new production-only config.php will be loaded. +</p> -<p>To make a config file environment-aware, copy the file from <samp>application/config/</samp> to <samp>application/config/development/</samp>, depending on the environment the config file belongs to. You can place the following configuration files in environment folders:</p> +<p>You can place the following configuration files in environment-specific folders:</p> <ul> -<li>Default config files</li> -<li>Database config files</li> -<li>Custom config files</li> +<li>Default CodeIgniter configuration files</li> +<li>Your own custom configuration files</li> </ul> -<p><strong>Note:</strong> CodeIgniter always tries to load the config file for the current environment first. If the file does not exist, the global config file (i.e. <samp>application/config/</samp>) is loaded. This means you are not obligated to place <strong>all</strong> your config files (but rather the files that change per environment) in an environment folder.</p> +<p><strong>Note:</strong> CodeIgniter always tries to load the configuration files for the current environment first. If the file does not exist, the global config file (i.e., the one in <samp>application/config/</samp>) is loaded. This means you are not obligated to place <strong>all</strong> of your configuration files in an environment folder − only the files that change per environment.</p> <h2>Helper Functions</h2> @@ -195,4 +214,4 @@ Next Topic: <a href="../database/index.html">Database Class</a> </div> </body> -</html>
\ No newline at end of file +</html> |