Saving and accessing site settings in 5.8
Permalink
Hi There,
In 5.6 we used a constant to store a site version for cache busting css/js. In 5.8, the core config file has been overridden and saved to: /application/config/concrete.php
Then the setting has been added like this...
Then in the site's header we're trying to access the setting like this...
But it outputs blank. When outputting $app there's an error...
Does that path look correct? I don't see those directories anywhere in my install.
Any pointers in the right direction would be much appreciated.
Cheers
Ben
In 5.6 we used a constant to store a site version for cache busting css/js. In 5.8, the core config file has been overridden and saved to: /application/config/concrete.php
Then the setting has been added like this...
Then in the site's header we're trying to access the setting like this...
<?php $app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $config = $app->make('config'); $website_version = $config->get('frontend.site_version'); ?> <?= $website_version ?>
But it outputs blank. When outputting $app there's an error...
Object of class Concrete\Core\Application\Application could not be converted to string
Does that path look correct? I don't see those directories anywhere in my install.
Any pointers in the right direction would be much appreciated.
Cheers
Ben
Hi cmscss,
If you added the following code to application\config\concrete.php.
You would read it this way:
I recommend reviewing the documentation.
https://documentation.concrete5.org/developers/packages/storing-conf...
If you added the following code to application\config\concrete.php.
You would read it this way:
<?php $app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $config = $app->make('config'); $website_version = $config->get('concrete.frontend.site_version'); echo $website_version; ?>
I recommend reviewing the documentation.
https://documentation.concrete5.org/developers/packages/storing-conf...
Thanks guys
Which has the following: $app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
Which might just be an example - does anyone know how to access the config settings?