1

There is a problem. Using the CodeIgniter 3, i have a hook that is loaded in 'pre_controller' points and initializes language constant - SITELANG:

define('SITELANG', $lang);

How do i can access to this constant in the CodeIgniter library constructor?

Marsick
  • 138
  • 1
  • 11
  • As I think what you want to achive, would be better to skip pre_controllers, and extend CI Controller, where you can access such variables. If you want a variable available in every controller, let me know, i can suggest. But currently, that wasn't your question :) – Iamzozo Sep 18 '15 at 13:21
  • 1
    PHP constant is accessible just with calling it. Your problem is that you can't be sure when it will be loaded and when not – Svetoslav Sep 18 '15 at 13:30
  • `var_dump(SITELANG);` in library constructor. Load that library in controller constructor and tell if it is output. – Tpojka Sep 18 '15 at 13:53

1 Answers1

0

In project i use MVC and HMVC both. Solved the problem: load library in the constructor controller, not in autoload.php. Thank everyone, especially @Tpojka.

Marsick
  • 138
  • 1
  • 11