Home arrow PHP arrow Adding a Form Helper to an MVC-based Framework in PHP 5

Adding a Form Helper to an MVC-based Framework in PHP 5

In this fifth episode of the series, I start building an HTML form helper class to add to this sample MVC framework the ability to render some basic form elements.

  1. Adding a Form Helper to an MVC-based Framework in PHP 5
  2. Review: the framework’s source files
  3. Building a basic web form helper class
  4. Adding a method to render input elements
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
June 15, 2010

print this article



Since the web is in constant evolution, developing applications for it often requires mastering different disciplines that range from using client-side technologies such as (X)HTML, CSS and JavaScript, to working with server-side languages like PHP, Ruby and SQL, among others.

While all of these technologies are quite different from each other, they do share one common thing. Whether you are building a simple JavaScript program or a full-fledged PHP application, it frequently involves performing a lot of repetitive tasks, which is an annoying and time-consuming process.

To prevent web developers from doing the same things over and over again, many client and server-side frameworks have emerged in the last few years. Some of them have become so successful, that for many people it is nearly impossible to work without them.

In the case of PHP, frameworks such as Zend, Kohana and CakePHP, to name just a few, allow programmers to quickly build web applications based on the Model-View-Controller design pattern. Still, they’re only a part of a long list that includes other valuable software stacks. Having so many frameworks available to choose from nowadays, is it really worthwhile to learn how to build one on your own?

While at first sight this seems to be a pointless task, going through the entire development process can be really educational, whether you want to learn how to apply the MVC pattern in PHP, or gain a basic understanding of the inner workings of well-established frameworks.

So, if you’re interested in grasping the basic concepts that surround the creation of an MVC-based framework in PHP 5, then you should start reading this series of articles. In it, you'll learn in a step-by-step fashion how to create a stack of extensible classes that can be put to work together under the schema followed by the Model-View-Controller design pattern.

Speaking of classes, you’ll surely recall that I left off the last tutorial adding to the framework being constructed a class that sanitizes user-supplied input in a pretty basic way. However, it’s necessary to add to it many other features, including the ability to render HTML forms. So, in the following lines I’m going to build a form helper class, which will perform the aforementioned rendering task in a painless manner.

Now, to learn how this form helper class will be developed, jump ahead and start reading!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: