I must say, this was a major hurdle for me when I first started out with CakePHP. If you’re working with some data from a database, then it’s all Model-View-Controller magic. Your forms are automatic: $form->input() is pretty much all you need. Why is this? That’s because all the information about the fields (names, sizes, types, etc.) come straight from the database. You’re Out On Your Own The problem right now is that, you’re all on your own.
So I guess the CakePHP development staff doesn’t take any holidays. Bright and early New Years Day 2008, we’re greeted with a fresh new release of CakePHP 1.2.6331 beta. No, not pre-beta a full blown beta. Needless to say I’m excited about this. There have been some nice changes which have gone through all through the Christmas season. Guys, I thank you for your dedication. The one major thing I’m excited about is the way that the Form Helper now processes dates and times; there’s no longer a cleanUpFields() function, everything is automatic (or should I say automagic).
With this post I’m introducing a new segment to this blog: Cute CakePHP Trick of the Day. This is basically going to be a learn as I learn sort of thing. There are always a bunch of little things that I want to do in CakePHP, but just haven’t figured out. So every time I stumble onto something, I’ll let you guys in on it. I love the GenerateList() function. This is generally used when you have models with associations with other models.
One thing which I usually find quite annoying is using input boxes in forms for user entered dates. Having the user manually enter date, day, month, year seems so 1997 to me. However in the interest of time, this is what most programmers slap into the web applications simply because it’s easier to produce and easier to maintain. Well here’s a handful of solutions that can solve that problem for you.