I'm having trouble when my project has a structure with a large directory depth. When I give include in the file the url is relative to the page that was opened. And then some files includes are not recognized.
For example, I open a page with depth 3 of the directory, dou include in a file with depth 2, and within that file the includes that it has not recognize the files since the url is in about the first page I opened.
Not to mention that many files need to do this ../../../arquivo.php
to recognize files from other directories.
EXAMPLE STRUCTURE
.
├── controller
│ └── entityController.class.php
│
│
├── model
│ └── entity.class.php
│
|
└── ws
├── dir
│ └── page1.php
└── dir2
└── page2.php
SITUATION
1st page1 is opened in it has an include a entityController.class.php at two levels above to be able to access
include '../../controller/entityController.class.php';
2nd entityController has an include a entity that needs to return to a level above to be able to access
include '../model/entity.class.php';
When the problem occurs, this include does not work because it occurs in relation to the level of the page1.php file that was the first to be called, so it will look for the folder model
within the ws
directory, that is to make it right it would have to do so
include '../../model/entity.class.php';
But it would solve in this case, and it would be a problem because the controller is called by other files of different levels.