Ju-Pao Posted February 21, 2007 Share Posted February 21, 2007 Is there a way in PHP to use the define function from another file in another directory in your PHP code? For example my code is in this directory /home/dirA/dirB/dirC/ the the define function was from the directory /home/dirA/ define('KEYWORD',boi); how can i use it in my code so that if I echo KEYWORD, it will display boi without putting the define function in my code. thank you guys for your help Link to comment https://forums.phpfreaks.com/topic/39452-define-function-from-other-files/ Share on other sites More sharing options...
scottybwoy Posted February 21, 2007 Share Posted February 21, 2007 What you need to incorporate here is classes, you can have all your defined functions stored in a few scripts/directories then call them at will. It's too big a topic to explain in one forum post, so what I suggest is that you look for a few tutorials / explanations on the net good luck Link to comment https://forums.phpfreaks.com/topic/39452-define-function-from-other-files/#findComment-190363 Share on other sites More sharing options...
Ju-Pao Posted February 22, 2007 Author Share Posted February 22, 2007 thanks for the suggestion scotty Link to comment https://forums.phpfreaks.com/topic/39452-define-function-from-other-files/#findComment-190965 Share on other sites More sharing options...
Ju-Pao Posted February 22, 2007 Author Share Posted February 22, 2007 sorry to double post, but can anyone help me on how to include a file that is on a different directory? Link to comment https://forums.phpfreaks.com/topic/39452-define-function-from-other-files/#findComment-191042 Share on other sites More sharing options...
Jessica Posted February 22, 2007 Share Posted February 22, 2007 include('dir/file.php'); Link to comment https://forums.phpfreaks.com/topic/39452-define-function-from-other-files/#findComment-191043 Share on other sites More sharing options...
Ju-Pao Posted February 22, 2007 Author Share Posted February 22, 2007 wow, thanks jesirose i never thought it was that simple Link to comment https://forums.phpfreaks.com/topic/39452-define-function-from-other-files/#findComment-191050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.