Importance of using the CakePHP Helpers

Published on Mar 20, 2009 by Jamie Munro

Uggghh, I hate to even be writing about this!  I have been spending the past two days cleaning up a project that has been running for over one year.  It was our first ever CakePHP project at our company and we were too lazy to be consistent about using $html->link() when creating our links.

Just recently the client has requested a change for their Facebook application.  We simply need to add a "requirelogin" HTML attribute to every link.



Sounds easy, right?  You bet it was, took me a total of 5 minutes to update the HTML helper to automatically add this HTML attribute to every link.  Great we're done then right?  Wrong!  We didn't create every HTML link with the HTML helper.

If we weren't so lazy a year ago when we were first learning CakePHP and took the time to learn the syntax (that is really quite easy) we could have saved ourselves two+ days of work fixing over 500 links that were not done this way :(

This is more of a rant than an article, but hopefully if you're reading this, you are taking advantage of the excellent helpers CakePHP provides!

Remember, just because you do not see a use in creating elements with a helper now (HTML, AJAX, FORM, etc...) down the road there certainly might be, so save yourself the headache and take advantage of the tools at hand!

Tags: CakePHP | helpers

Related Posts

blog comments powered by Disqus