I have dabbled in php and read a lot both across Stack Overflow and php.net documentation but I fear I have the wrong idea on what goes where my understanding is as follows.
-
included files a best to be held in the includes folder, these things are like functions specific to files ie: users.php would hold the functions for user related items in this folder
-
project root would hold a config.php for items like db root and other set specific items
-
includes drill down like so but only from project root
include('includes/user.php');
this is where my questions are.
-
do I have a general idea or is their an easier way to layout a complex project
-
is a function like
function includes($path, $location){
return $_SERVER['DOCUMENT_ROOT']. "/" .$path. "/" .$location;
}
and usage like
require(includes('includes', 'functions.php'));
be a smart way to accomplish includes accorss the project
-
how do major projects like joomla, phpbb & vbulletin accomplish includes I have looked it over but I am confused totally on how they accomplish this.
-
anything else that needs to be taken into consideration with project layout and including. im looking at separating group of functions together in their own files
thanks
If you want to create a layout for a complex project that both your and other developers will understand, you should look into using an MVC framework.
PHP frameworks include: