0

I'm looking for a solution for the following problem with a piece of software I have inherited. It consists of a lot of HTML-files that source a PHP-script like this at the very beginning.

<?php
    include  "/some/path/commonsettings.php";
?>

Within commonsettings.php some global variables, functions etc. are defined which are used throughout all scripts related to the project. I don't want to have some hard-coded path in that above include statement. Paths in our environment change from time to time, which is why these are generally defined at only one point. In this case this is a Javascript file with definitions like this:

const CommonDirectory = "/www/defs/";

Now, what I want to achieve is something along the line:

<?php
    include  $CommonDirectory . "commonsettings.php";
?>

How can I do this? Is there a way? Or is that impossible?

Thoran
  • 163
  • 1
  • 9

0 Answers0