require_once $_SERVER['DOCUMENT_ROOT'].'/settings.php';
require_once $_SERVER['DOCUMENT_ROOT'].'/functions/main.php';
checkLogin(2);
//logic code block goes here
getMetaTags("index.php");
require_once $_SERVER['DOCUMENT_ROOT'].'/includes/header.php';
//view code goes here
require_once $_SERVER['DOCUMENT_ROOT'].'/includes/footer.php';
The problem is I want to move settings outside root. I was thinking to put …/settings.php, but if I will later change settings.php location I will need to update each page.
So if I change settings.php location next time, I only need to update require_settings.php. But this means for each script couple of sub require_once will be performed. Can be this bad?
but I am not talking about including the same file. I am wondering how is about having sub require_once files.
So file A require_once file B, file B require_once file C and file C require_once file D. That is why I am asking if it is ok to put
require_once $_SERVER[‘DOCUMENT_ROOT’].‘/require_settings.php’;
where require_settings.php the only line will have is the following:
The purpose of that is to change easily location of settings.php. But I am not sure if it is ok to have so many sub require_onces (due performance or other reason) because also settings.php require_once some files.
Well, each require (that isn’t skipped because of _once) does have a minor performance hit because it then has to do a disk read.
However, in this case if you are just putting “require settings” in one file, then having “require_once require_settings” in all the others, you should be fine because you are essentially only adding one additional file read.
Did that answer your question or am I missing something else?