Getting the root to the site's folder isn't difficult but I am trying to get the folder in which all sites are located rather than the root folder of a specific site. I have been using the code below but I came across an instance affecting $CommonPath where it isn't working due to one site's specific structure.
In other words, one of my Windows development systems has something like:
C:\Server\Sites\site1.loc
C:\Server\Sites\site2.loc
C:\Server\Sites\site3.loc
and another Linux-based development system has:
/var/www/html/site1.loc
/var/www/html/site2.loc
/var/www/html/site3.loc
and I am trying to fetch C:\Server\Sites\ or /var/www/html/ from code that is inside a subfolder or two from these roots. How is it done without having to specify which subfolder the variable is being created in?
$SiteFolder = @end(explode(DIRECTORY_SEPARATOR, dirname(__DIR__)));
$CommonPath = str_replace($SiteFolder,"",dirname(__DIR__)) . "common" . DIRECTORY_SEPARATOR;
$ConfigPath = dirname(__DIR__) . DIRECTORY_SEPARATOR . "configuration" . DIRECTORY_SEPARATOR;
$FunctionsPath = dirname(__DIR__) . DIRECTORY_SEPARATOR . "functions" . DIRECTORY_SEPARATOR;