
Patty Cake, Patty Cake, Baker’s Man
One of the things that sold me on CakePHP is the bake routine. This is basically code generation for the lazy types like myself. It was good in CakePHP version 1.1, now it’s just awesome. The only way they can make it better is to implement a web version, but that’s another story.
What Baking Does
In CakePHP we refer to the automatic code generation as baking (get it now?). An entire application can be baked from nothing more than a few tables in a database. CakePHP uses some skeleton templates, which you can of course customize to your needs, to generate your Models, Views and Controllers. The controllers and views come with the standard CRUD (create, read, update, and delete) functions and can also contain admin functions.
Currently, we run the Bake routine from the command line. I’m hoping sooner or later this can change, but with a lot of hosts allowing shell access to your account, this isn’t a priority with the developers.
Posted in CakePHP.
Tagged with bake, CakePHP, database, Linux.
By Kevin Lloyd
– November 21, 2007
Here’s the kindergarten version of a 3 Column CSS layout that you’re going to get from most other websites:
<div id="header">header stuff</div>
<div id="left">left stuff</div>
<div id="center">center stuff</div>
<div id="right">right stuff</div>
<div id="footer">footer stuff</div>
Simple enough right? The alignment is done in your style sheet, where the left would float left, the center would also float left and the right would float right.
You could set all your styles based on these column ids. Whether it’s background images or just background colors, the sky’s the limit here. But here’s the kicker: your column heights are all dependent on how much text you have in each div. Leaving you with a messy, uneven mess.
Wrap It Up Before Messing With CSS
There’s the easy way and there’s the hard way, which a lot of people mistake for the right way. If you’re looking for the hard way, then you need to look somewhere else. Try Googling “3 column css hack ie ns, oh crap this doesn’t look right, wtf”. That should lead to to the pain that you searching for.
Posted in CSS.
Tagged with column, CSS, layout, template.
By Kevin Lloyd
– November 19, 2007
The Problem
I’ve had this problem for a while, but it’s become more of a problem since I started working heavily with CakePHP.
Here is my WAMP folder structure: D:\wamp\www\cake\[various app]
Under this folder, I would have baked all the different applications that I’m working on at the time (app1, app2, app3, etc). So I could have my DocumentRoot set to my cake folder and access the different apps in my browser by:
- http://localhost/app1/
- http://localhost/app2/
- http://localhost/app3/
That’s a perfectly fine idea, except that 95% of the time, when I deploy an application for a client it’s going to be installed on their root directory of that domain name. Even on my server, all my applications (CakePHP and otherwise) have their own domain or sub domain.
If we keep everything to relative paths and stress using CakePHP’s $html->url() function, then everything should be fine. But sometimes I’m lazy and I want to do a quick href=/ and not have to try to figure out how many levels I’ve gone. Also, I want to confidence to upload my entire folder to the clients server and only have to change database configurations.
Posted in General.
Tagged with apache, CakePHP, wamp.
By Kevin Lloyd
– November 16, 2007

Today I popped onto the CakePHP Bakery looking for the obAuth Component. To my surprise, I got a blank page.
Seems like there’s a database issue. Here’s hoping that it’s not down for too long.
Update (11/20/07):
Most of the stuff is back up on the bakery. The rating is still a small issue, but all the code and tutorials are up and running.
Bake On!
Posted in CakePHP.
Tagged with bakery, CakePHP.
By Kevin Lloyd
– November 6, 2007
First of let me state that this post is very bias towards CakePHP. Truth be told, I haven’t even installed or used Ruby on Rails. The closest I’ve come is looking at various code snippets I’ve found around. With that said, you may want to stop reading now.
These arguments are not based on hard facts, since I haven’t done much research on the matter. A lot of them come from a post at Clickable Bliss discussing the PHP vs. Ruby On Rails Issue.
-
Steep Learning Curve - Laziness
One thing I really hate is learning stuff. It is especially bothersome when you’re trying to crank out a project or web application in a limited amount of time.
With CakePHP I’m required to learn about the MVC style of development as well as CakePHP conventions.
With Ruby on Rails, I would have to learn MVC, Ruby on Rails conventions and I would have to start from scratch with the Ruby programming language as well.
Posted in CakePHP.
Tagged with CakePHP, Fast CGI, PHP, ruby on rails.
By Kevin Lloyd
– November 5, 2007

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. The GenerateList function is often used in these cases to populate a drop down list or a multiple select list. A typical example is a state drop down on an address form.
One problem that I have with this implementation is that it always produces a complete list and there is no empty slot. There is nothing to say that I don’t want to associate anything for this entry. On a drop down list, it’s impossible not to select an element. On a multiple selection list, even if the user holds CTRL and clicks to unselect the current entry, CakePHP ignores this entry.
Here’s the fix. Assuming in your controller you have something like:
Posted in CakePHP.
Tagged with CakePHP, form, PHP.
By Kevin Lloyd
– November 1, 2007

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. Create user friendly and attractive date entries with these Date Pickers. Some are just normal entries used for basic forms, while others have more database integration.
Some use the jQuery library. Others use mootools or the Yahoo! UI. No matter what your needs, you’ll find something here that you can use.
Source: Online Calendars and Date Pickers [Smashing Magazine]
Posted in Ajax.
Tagged with Ajax, calendar, date, form, JavaScript, time.
By Kevin Lloyd
– October 29, 2007
Recent Comments