Posts Tagged ‘php’

The CakePHP Is A Lie

Tuesday, July 1st, 2008

CakePHP is out of my life. For good.

After six weeks of microconfiguring .htaccess files and begging IRC’s #cakephp for help on inexplicably broken code, I had produced nothing of value. I am a patient man, but I expect some fruition from my studies. I am clearly not alone: my post about .htaccess files rocketed to the #2 spot on Google’s search for ‘htaccess cakephp’.

On Saturday morning I burned it all down, cleaned up the ashes, and started fresh with CodeIgniter, which has many similar qualities to CakePHP. Good news: it has a tiny footprint (one app is < 50kB) and no .htaccess files. Bad news: no AJAX helpers ((They’re working on it. In the meantime, do what I did and pick up jQuery.)), no templates, and CodeIgniter’s name makes inventing blog title gags nigh impossible. I’ll live.

To compare timeframes: In six weeks of study, I produced 10 lines of unjustifiably non-functioning code. In an hour and a half, I had CodeIgnite working with Eclipse (the small footprint helps) and had produced the test app CakePHP couldn’t handle. That’s 0.15% of the time.

CakePHP and .htaccess, Enemies Forever

Saturday, June 7th, 2008

I reiterate last week’s post about CakePHP: the documentation sucks. They do not put nearly enough emphasis on troubleshooting, because for most adopters of the framework, setting up your first working app is rarely a straight shot.

Case in point. It took a week of research to pick up an important point: if any one of four .htaccess files are missing, bits of your CakePHP app will not work. Not might…will. For me, the symptom was broken CSS: the HREF in

pointed to nowhere, and nothing existed to forward it to a valid location.

Unfortunately .htaccess files tend to disappear easily, especially when manipulating directories. Filenames beginning with ‘.’ do not show up, so simple drag-and-drop operations from an operating system’s GUI leaves out .htaccess because you can’t see it.

Good news is in store, though. Working through this tutorial set me straight, and I have a flawless application once again.

Eclipse and CakePHP, BFF

Friday, May 30th, 2008

As popular and awesome as CakePHP is, there just isn’t enough documentation on it. I guarantee many hours or days learning to wrangle with it.

Using Eclipse to maintain CakePHP projects is even worse. Precisely one tutorial exists, and it just doesn’t, um, cut the cake. It left me more confused than before I started.

After spending an hour on IRC’s #cakephp, one very patient user guided me through the process. By the end of the session, all I really needed was a visualisation of the setup. He took a desktop snap and sent it to me. Bam! Eclipse and CakePHP were together in five minutes.

In the interest of aiding visual learners out there and filling in the gaps left by the CakePHP/Eclipse tutorial, I pass this image on to you.

Eclipse setup for CakePHP work

As the tutorial mentions, you will be creating two separate Eclipse projects: one for Cake core, and another for your project. Select everything inside /cake/cake and copy it into the core project; using /cake/cake as an include path works too. ((My biggest criticism yet of CakePHP: the developers didn’t spend any time thinking of the repercussions from naming a directory and its child the same thing.))

In your other project, use the core as an included project (right-click or whatever on Include Paths > Configure Include Path). Finally, select everything inside /cake/app and copy it into your project (again, including /cake/app is also valid).

That should work. If it doesn’t, feel free to comment below, though I’m likely to be of insufficient help. Otherwise, hum to yourself as you happily code away:

This was a triumph
I’m making a note here: ‘HUGE SUCCESS’…

Responses to comments after the jump…
(more…)