external config file for homepresenter
- kolaloka
- Member | 69
I need to create an external config file where a web admin can change some variables. I do not know how to set the /path/to/my/config/
Also where to put it and how to use the variables in presenter functions?
My idea is something like this:
config.php:
<?php
$ds = something;
$identity1 = something_else;
$identity2 = something_else;
$password = secretpassword;
?>
HomePresenter.php:
<?php
...
include /path/to/my/config/config.php
private function connectionOne{
$bind = ldap_bind($ds, $identity1, $password);
}
private function connectionTwo{
$bind = ldap_bind($ds, $identity2, $password);
}
...
?>
Please, help.
- CZechBoY
- Member | 3608
OK, then you can use neon file, or php script or other format…
Only thing you should do is to load that configuration file(s) in bootstrap.php
[https://doc.nette.org/…on/bootstrap#…]
like this
$configurator->addConfig('config.neon');
And put there some parameters
like this
parameters:
ldap:
user: xxx
password: yyy
host: abc
For more info read the whole DIC page https://doc.nette.org/…introduction
Last edited by CZechBoY (2018-06-04 10:27)