I want to store the site name in some file, for example conf.php, and I define the value as

define ("SITE_NAME", "Site Name");

I would like to be able to override the value of this variable in the site settings. The question is: is there some kind of ready play, or is it just to fantasize and write your own? Or, maybe, it is more correct to store the site name in the database and pull it all the time?

    3 answers 3

    Create a configuration XML file and store there all the information that affects the display of the site (name, language, etc.). This approach is good because almost all native languages ​​can parse XML.

      : D - conf-.php is a good approach. If everything will be held exactly on it - try to overwrite it :) And cho - quite original solution: DDDD

        Constants can not be redefined, and I don’t see much sense, then you will get confused in your code.

        Better as you already wrote above to make a class / function that will take information from a file or database and output as you need.