Suggestion for clean code.

amr1991

New Member
Messages
396
Reaction score
0
Points
0
I am creating my own website using PHP and MySQL and plan on having it dynamic, being able to change templates in an administration panel etc. Here is my current index.php file. I am wondering if using functions will run efficiently to create the header, body, and footer.

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title></title>
    </head>
    <body>
        <?php
        
            //Include or require global files
            require($_SERVER['DOCUMENT_ROOT'] . "/requires/config.php");
            require($_SERVER['DOCUMENT_ROOT'] . "/requires/connection.php");
            require($_SERVER['DOCUMENT_ROOT'] . "/requires/functions.php");
            require($_SERVER['DOCUMENT_ROOT'] . "/requires/navigation.php");
            
            //Draw header
            createHeader();
            
            //Draw body
            createBody();
            
            //Draw footer
            createFooter();
            
        ?>
    </body>
</html>
 
Top