We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Easiest way to access Phalcon config values in views?

I have a section in ini files with some globally used social links, for ex:

[social] fb = URL twitter = URL linkedin = URL

What's the easiest way to access these, or is there a better way to organize these global variables?

someone suggest $config = new \Phalcon\Config\Adapter\Ini("path/config.ini"); from https://docsbay.net/reading-configurations, any other ideas?

edited Oct '19

You can inject your configuration into your DI: https://docs.phalcon.io/3.4/en/config#injecting-configuration-dependency

Then in your view, assuming you injected the config as config, you can just go:

<a href = "{{ config.social.fb }}">Check us out on Facebook</a>