Kirby options
All available options can be set in your config file in /site/config
like this:
c::set('option', 'value');
There are a number of available options in Kirby, which help you to customize the system just the way you want it. Check out the full list of options in the cheat sheet.
Your own options
If you need a simple way to store options throughout the system and access them in any plugin, template or snippet, you can define your own options in the same way:
c::set('yourOption', 'yourValue');
You can fetch your options later with…
echo c::get('yourOption')
// will output 'yourValue'
If you want to make sure to get a proper default value if the option is not set you can define a fallback:
echo c::get('undefinedOption', 'fallbackValue')
// will output 'fallbackValue' if undefinedOption is undefined
Multi-environment setup
Kirby has a built-in way to set different options based on the domain by adding additional config files containing the domain.
Example setup
/site/config/config.localhost.php
/site/config/config.staging.yourdomain.com.php
/site/config/config.yourdomain.com.php
/site/config/config.www.yourdomain.com.php
By setting different options in those config files you get a very flexible system, which can be deployed to different servers and react to the current environment accordingly.
Note that the settings in the standard config.php
file are always used. If you need different settings in another environment, you will have to overwrite those settings in the domain specific configuration file (or only set those options in your domain specific config file).