i'm working on a project but, i'm sick of loading all the libraries in every single page
my project directories are something like this
|---x (( PHP PAGES ))
|--- x1.php (( PHP FILE ))
|--- x2.php (( PHP FILE ))
|---y (( PHP PAGES ))
|--- y1.php (( PHP FILE ))
|--- y2.php (( PHP FILE ))
|---includes (( LIBRARIES ))
a.php (( PHP FILE ))
b.php (( PHP FILE ))
c.php (( PHP FILE ))
i tried to load all my libraries in a single file and load that file in all pages, but the problem comes up from the directories like for example loading libraries in x1.php will be something like this "../include/", but loading in a.php just needs "include/" i know there is a way to reach the "includes" directory no matter from where the request comes from but i have no clue how to do this.
Thanks
Loading each and every single file as an include will add unwanted bloat and possibly slow down your site. What you might try is class autoloading: http://www.php.net/manual/en/language.oop5.autoload.php
It eliminates the need to scatter includes all over the place but only the files you really need will be included.