Hi, like many of us, I’m new to cakePHP and full of questions.
I want to develop a site which will load a different GUI and mainly uses a different database depending on the domain it was been requested.
My first thought was to play with $_SERVER predefined variable and alter the FileConfigTrait.php from
vendor\cakephp\cakephpsrc\Core\Configure\ folder.
if ($plugin) {
$file = Plugin::configPath($plugin) . $key;
} else {
// Change: New lines to select different app.php
// configuration file according to requested domain
if($key == 'app')
$key=$_SERVER['SERVER_NAME'].'_'.$key;
// End Change
$file = $this->_path . $key;
}
In that way if a create one app.php file for each domain - i.e. www.domain1.com_app.php for www.domain1.com - i can achieve my goal.
But i fill that this not right or at least there is a better way.