CoreBOSBB
Including Module.php from a subfolder - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17)
+--- Forum: Administrator Support (https://discussions.corebos.org/forumdisplay.php?fid=8)
+--- Thread: Including Module.php from a subfolder (/showthread.php?tid=198)



Including Module.php from a subfolder - Guido1982 - 11-16-2015

I'm creating a new file in the 'module/Calendar4You/' folder. I saw that other files in that folder included PHP files from the system in respect to the system root, so I tried including Module.php like:

PHP Code:
include_once('vtlib/Vtiger/Module.php'); 

Which gave me an error I understood, because I had to use:

PHP Code:
include_once('../../vtlib/Vtiger/Module.php'); 

to tell PHP to move back two levels first. But now I receive an error when Module.php tries to include files ("ModuleBasic.php") in its turn, because it is also trying to use a relative path. How come other PHP files can include using the system root, and I can only include using a relative one? Must be an easy answer but I can't see it.


RE: Including Module.php from a subfolder - joebordes - 11-16-2015

they probably use the PHP function set_include_path() which tells PHP where to search for files.


RE: Including Module.php from a subfolder - Guido1982 - 11-16-2015

Ah great, thanks. I'll look into this


RE: Including Module.php from a subfolder - Guido1982 - 11-16-2015

No luck, but I'm starting a topic in which this is used, so you can see the context. Maybe this helps.