• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get outside config value inside of Constants?

I want to setup my constants.php file variables to be different depending whether on dev site or live site. How can I grab a variable from either config.php or another file so I can upload the same updated constants file to both servers.

In other words, I'd like to do something like this in Constants.php

if (DEVELOPMENT === true) {
 //define these CONSTANTS
} else {
 //define these CONSTANTS

But i'd like to grab the DEVELOPMENT value from another file, so I don't have to worry about uploading the same constants.php file to both my hosting situations.

You could always upgrade to CI3, and then http://www.codeigniter.com/user_guide/ge...ments.html
James Parry
Project Lead

Thanks JLP. If I was starting from scratch, I might do that, but I have all kinds of custom libraries and vendors installed and working live sites are depending on them. Can't take the chance on breaking anything. I am not even sure I am using Version 2. lol

If I look at /system/core/Config.php it says:
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright © 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource

Does this mean I am using Version 1?

Look inside system/core/CodeIgniter.php ... you will find a line like define('CI_VERSION', 'X');
That tells you which version you are using Smile

The "@since Version X" you refer to is a documentation directive.
James Parry
Project Lead

Version 2.1.3


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.