Welcome Guest, Not a member yet? Register   Sign In
Config Static Variables Not Working
#1
Star 

Hi,
I am using a custom Config file. I populate its static variables by calling a method & then use those variables in BaseController. Its working fine in BaseController but when I try to use those same variables in AdminController extended from BaseController its variables show empty. I don't call the method to populate its variables in AdminController as its extended from BaseController. 
Following are details. Kindly help me understand why config file variables don't show any value in AdminController:
BaseController
PHP Code:
$this->config config('My_config');
// Following load_values() method loads users names & populates other static variables (eg: $users_array) of config class 'My_config'. I dont call this method again in AdminController
$this->config::load_values();  
echo $this->config::$users_array[0];  // Prints User Name 

AdminController extends BaseController

PHP Code:
$this->config config('My_config');
echo 
$this->config::$users_array[0]; // Empty 

$this->config::$users_array[0]; prints values in BaseController but don't print anything in AdminController. Please advise.
Regards
Reply


Messages In This Thread
Config Static Variables Not Working - by myo - 08-03-2021, 06:08 AM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 08:08 PM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 09:56 PM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 10:37 PM
RE: Config Static Variables Not Working - by myo - 08-04-2021, 02:52 AM
RE: Config Static Variables Not Working - by myo - 08-04-2021, 09:03 AM
RE: Config Static Variables Not Working - by myo - 08-05-2021, 03:57 AM
RE: Config Static Variables Not Working - by myo - 08-06-2021, 06:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB