HomePHP Finishing a Form Helper Class for an MVC-based Framework in PHP 5
Finishing a Form Helper Class for an MVC-based Framework in PHP 5
In this sixth part of the series, I finish building a basic HTML form helper class. Doing this adds yet another important component to the sample MVC-driven framework we're developing in this group of tutorials.
If youíre a PHP developer who wishes to learn how to develop an extensible framework that relies on the structure of the Model-View-Controller design pattern to separate business and application logic from visual presentation, then you've come to the right place.
Welcome to the sixth installment of the series that focuses on building a simple MVC-based framework in PHP 5. Made up of fourteen tutorials, this series walks you through the progressive development of a stack of modular classes. These classes can be put together to work very easily under the schema imposed by the MVC pattern.
Now itís time to recall the concepts that were deployed in the last tutorial, in case you haven't read it yet. In that part of the series I started to build a helper class whose main task was rendering different elements of an HTML form, such as input boxes, radio and submit buttons, and so forth.
The loosely-coupled and flexible structure of this class helper allows you to use it either as a standalone entity or within the context of the MVC-based framework that Iím currently developing, which is all good and neat. Nonetheless, despite this benefit, the class in its current incarnation lacks an important feature. It cannot construct another common web form element, such as a basic text area.
Since the form helper class must suit that specific need, in the next few lines Iím going to add a whole new method to it that will be responsible for rendering those HTML elements.
Now that you know what to expect from this sixth chapter of the series, itís time to get our hands dirty with some functional code. Letís get going!