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

#1
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.
Reply

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

#3
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?
Reply

#4
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
Reply

#5
Version 2.1.3

Thanks
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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