Archive for the 'Coding' Category

PHP: Organize Code With an Include of Includes

File structure and code optimization is very important to keep systems maintainable. One way to do this is through the use of an include files that serves as a container that holds all of your other include files. Normally, you would have a shared set of includes as part of your source code. For example you can have a couple of PHP files, index.php for the home page and another file called categories.php. In both of these files you would include your shared set of files as so:

<?php
// These would be the include statements for index.php, categories.php, or any other *.php that you have
include(‘includes/functions.inc’);
include(‘includes/constants.inc’);
include(‘includes/mail.inc’);
include(‘includes/database.inc’);
// Add the rest of your include files here


// The rest of your code goes here
?>
Continue reading ‘PHP: Organize Code With an Include of Includes’