Cannot Access Config Values from app.php
Permalink
Hi There,
I am trying to access configuration values from app.php / concrete.php config files from within my theme header partial or from a block view. I have read the documentation about
https://documentation.concrete5.org/developers/appendix/concrete5-ve...
and
https://documentation.concrete5.org/developers/appendix/concrete5-ve...
My application/config/app.php looks like this:
In my block view, I am trying to access the config like this:
but $dateFormat is always an empty string. I also tried to access other config values which are defined by concrete5 itself, but I also cannot access them.
Am I doing something wrong?
Best
Jan
I am trying to access configuration values from app.php / concrete.php config files from within my theme header partial or from a block view. I have read the documentation about
https://documentation.concrete5.org/developers/appendix/concrete5-ve...
and
https://documentation.concrete5.org/developers/appendix/concrete5-ve...
My application/config/app.php looks like this:
In my block view, I am trying to access the config like this:
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $config = $app->make('config'); $dateFormat = $config['date.format'];
but $dateFormat is always an empty string. I also tried to access other config values which are defined by concrete5 itself, but I also cannot access them.
Am I doing something wrong?
Best
Jan
Hey..
The problem is not the date string itself, but generally accessing config values.. I tried to access different config values but I always get an empty string back.
The problem is not the date string itself, but generally accessing config values.. I tried to access different config values but I always get an empty string back.
Solved:
If anybody has the same problem, my "mistake" was to not specifying the config namespace.
The config namespace implicitly gets defined by the filename of the config file.
E.g. if you have the config file /application/config/app.php, the config namespace is "app". You can access config values from this file like this:
If anybody has the same problem, my "mistake" was to not specifying the config namespace.
The config namespace implicitly gets defined by the filename of the config file.
E.g. if you have the config file /application/config/app.php, the config namespace is "app". You can access config values from this file like this:
$dateFormat = $config->get('app.date.format');
Or 'd/m/Y'