Joomla 3 - How to get value from configuration file?

I am creating a custom component and I just want to get the value from the global configuration in my controller. I can not find information on how to do this.

Sort of...

$config = JFactory::getConfig();
$this->_db = $config->get('db');
+4
source share
2 answers

The documentation on how to do this is a bit outdated:

http://docs.joomla.org/JFactory/getConfig

But if you check the code, they will actually reset the ampersand function:

https://github.com/joomla/joomla-cms/blob/staging/components/com_users/models/registration.php

$config = JFactory::getConfig();
$fromname = $config->get('fromname');

Also, if you are trying to connect to a database, you can really just use the DB object from JFactory.

$db = JFactory::getDbo();

:

http://docs.joomla.org/Accessing_the_database_using_JDatabase

+9

Joomla 3.2:

JFactory::getApplication()->get($varname, $default);

+4

Source: https://habr.com/ru/post/1526349/


All Articles