Setting up MVC
Now that we have our folder structure and the rewrite functionality working, we can begin setting up our MVC-based application. The first thing that we will have to focus on would be to bootstrap our application by loading the required classes. We are storing these required classes in the lib
folder and we will use the config.php
file to store the required configurations such as the location of the lib
folder, the base URL for our application, and the database connection information.
<?php define('LIBRARY', 'lib/'); define('BASE_URL', 'http://localhost/student-portal/'); define('DB_VENDOR','mysql'); define('DB_HOST','localhost'); define('DB_NAME','course_registry'); define('DB_USR','root'); define('DB_PWD','top_secret_pwd');
Let us add the
Bootstrap
class in our lib
folder. This class will be responsible for understanding, interpreting...