We have been trying to make the programming style ideal to standard.
- Valid XHTML 1.0
- Valid CSS 2
- MVC approach
- register_globals = off ready
- Layout by CSS
- Basic HTML Class
- Formage Class
- Error message system
Each component has its own method to control them.
- Three section: top-section, content and footer
- The content section consists of two fixed column: left-column and content
- Navigation bar on the left column
- Main menu on the top section
- Page title on the top section
We are using our own architectural pattern similar to Model-View-Controller (MVC). MVC is the most used architecture in web applications.
phpFramewerk is designed to keep the code in controller files as simple as possible so that the control flows between user interface, data handling and the display responds to the user will remain ease.
Control FlowsIn phpFramewerk we handle control flows as follows:
- The user triggered events with the user interface such as clicks or presses a button.
- A controller handles the request from the user interface by evaluate
the $_GET[cmd] or $_POST[cmd] variable.
- The controller processes the event in a way appropriate to the user's action (this is where controller accesses the model such as Add,Read,Edit and Delete).
- The controller accesses the view to render an appropriate response (this is where the data from the model displayed within the HTML).
- The user interface waits for further events triggered by the users.
Directory StructureAfter you extract the package in a folder . then you will find the structure as follows:
We put all configuration files in folder ./conf
We put all view files in folder ./view
We put all classes in folder ./library
We put all images in folder ./images
And all controller files in root ./
You can move the conf, view and library folder to non-accessible folder on your server to reduce security risk.
When you open the config.php file the configuration should explain it self.
We combine OOP and procedural progamming style. So the application will behave based on following aspects.
The application structured as conf-object-control-view. When a controller file is executed the script will read the config first (located in folder conf). On the conf all configuration will sets and construct 2 new objects $doc-> and $frm->.
All objects were put on classes located in folder library. We currently use these 2 object (document and forms) as basic methods for all operation in the application. We will add more object in the future to provide more method as needed.
In a controller file there are 3 steps.
- Initialization (init)
In init step you can construct additional object if needed or you can set any other parameter (e.g pagetitle or sidebar navigation).
- Processes (proc)
In proc step the script will do the processes by evaluate the variable
$_GET[cmd] or $_POST[cmd]. This variable represent typically user actions.
- View (view)
After the control step take all necessary action to provide appropriate response parameter then the view step do the display task based on parameter given by the control step.
- Initialization (init)
All view files are located in folder view except the CSS file is located in the root. The basic file is body.php, this file is the template of the application. You need to know how the CSS script works to improve the design.
Do not change the body.php file, changes to this file will affect the layout of the web application unless you know what you're doing.
Actually the view folder consists of not only presentation files but also some content files which is not stored on database nor config files. The files for greetings or response could be located in here.