The purpose of using MVC in our scripts is to make it easier to isolate different elements of the software process. By using the MVC system, the script code is divided into three parts: the data processing, the input process and the output process. This means that changes to one part of the PHP script code can be made more smoothly without having to also rewrite the other parts of the script. For example if you want to change the layout of the script you will only have to edit the files reponsible for generating the layout and not those which actually process all the data.
We use our own in-house build framework which is really easy to understand and work with. Below you can see a sample file strucutre for our PHP scripts.
Script root folder
app - this is the folder where all important script files are stored
core - this is the folder where framework files are and as per our license agreement you cannot modify them as they are obfusticated. Even without access to the framework code you can do any change to our scripts - change layout, add/edit/delete fields, add/edit/delete features, and so on. Upon request we can provide documentation for the framework so you can study how it works.
index.php file is the master file which based on the parametars passed loads the correct page. For example if you go to options page of the script you will notice that URL in your web browser is like this
this means that layout files are placed in views/pjAdminOptions and controller file is
More about Controllers and Views below.
config - configuration file, database structure files, functions file
controller - these are all the files where PHP functions are defined for each script component. For example all PHP functions for managing script options are defined in AdminOptions.controller.php
models - there are all files where MySQL tables and data structure is defined for each script component. For example in Booking.model.php file you will see all the data fields used for storing booking details
plugins - we use different plugins for the most popular functionalities. For example a PayPal payment plugin which is the same for all our products.
views - these are the layout files for backend and front end
web - this is the folder where all images, js code and css are stored
these are the layout files for backend and front end. They are organized in sub-folders where folder name is the section of the script and its files are the actual pages.
For example in subfolder pjAdminOptions you will find the files for the script layout related to admin page where script options are managed.
in each of these files you will find the PHP functions used to manipulate all the data. For example, if you open pjAdminReservations.controller.php, which is available in most of our booking scripts, you will see functions to manage booking details:
function pjActionCreate() - to add a new reservation
function pjActionDeleteReservation() - to delete a reservation
function pjActionExportReservation() - to export reservations details
function pjActionCalcPrice() - to calculate reservation price
function pjActionGetReservation() - to get reservation details
function pjActionIndex() - to list all reservations
function pjActionUpdate() - to update a reservation
We also have most of the code used multiple times taken out in different files (/components/) so if you need to make a change to it, you only need to edit it in one place.