Published: Wednesday, April 16th, 2008
Somehow I don’t think most people understood what my bias comparison of CakePHP vs Ruby on rails meant. The last few visitors to comments seem to have been Rails fans. One of them seems to think that I shouldn’t touch Ruby on Rails with a ten foot pole and should stick with CakePHP. He doesn’t want someone like me in their community. The other comment, I get the opposite vibe from. He strikes me as a PHP fan, who thinks I’m too lazy for the PHP community.
To all the folks that haven’t seem to understand my whole objective, let me help you guys out. I have general interests in a lot of areas and I also work a 9 to 5 job. So I don’t really have the time and dedication required to poor my heart and sole into everything that comes along. I do a brief overview of something before I spend tons of time delving into it. People are pissed that I’m comparing CakePHP to Ruby on Rails and haven’t even tried it yet. This is where the brief overview comes in; I took a quick look and realized that for what I was doing at the time, Ruby on Rails would have been more trouble that it was worth.
Share This
If you're new here, you may want to subscribe to my Full RSS feed. Thanks for visiting!
Published: Wednesday, April 9th, 2008
This is the third installment of my Auth Component Tutorial. This tutorial builds on the first installment, so make sure you grab the download file:
CakePHP Auth 1 (4.3 KB, 1,647 hits)
You'll find it on almost every popular web site's login page; a nice lil' checkbox that says "Remember Me". It seems to have become a basic addition to any page with a login form. Generally, when a user logs into a web site, he's logged in until his session expires. Which usually translates to when they close the browser window or when they allow the session to timeout.
With a Remember Me cookie, you hit the lil' checkbox and it stores a lil' cookie on the user's computer. This cookie can contain various information (we'll get to that later) but it essentially enables the user to bypass the login process the next time he comes to the page requiring authentication.
So, the simplest way to proceed is to list changes by file, so strap in your seat belts, here goes.
The Obvious, The Login Form - login.ctp
Now of course you need to add the checkbox and a label for said checkbox. Simple enough:
Share This
Published: Friday, January 11th, 2008
This is the second installment of my Auth Component Tutorial. I included a link to download a file for during the first installment:
CakePHP Auth 1 (4.3 KB, 1,647 hits)
I just think that some of the stuff in there warrants some explanation.
isAuthorized()
This function is needed when $this-Auth->authorize = 'controller'. Theory has it, you can do something similar in app_model if $this-Auth->authorize = 'model', but I haven't looked into this.
The thing that confused me about this is that I thought you were required to perform your own validation. But oh no, this is additional authorization. Sort of like what beforeSave() does, where you can cancel the save after the validation. isAuthorized() is performed after the user has been logged in. If after that, you need some additional stuff, then you can put it in there. I'm not sure why it doesn't default to return true like beforeSave() (if everything goes well), but if it's not present, it errors out.
$this->Auth->user('group_id')
In my User Model I have a field called group_id. So you guessed it, this just returns the group_id of the user that's logged in. Things couldn't be simpler.
Share This
Published: Tuesday, January 8th, 2008
First off, I would like to say much thanks to Gwoo for finally helping me to understand this thing.
So I know what you're thinking; I'm probably the last person to finally figure out the CakePHP's Auth Component. For the past few months, I've been using obAuth because that's the only authentication I could get to work with CakePHP. I think that I was just making it more difficult than it should have been.
My main resource for learning the Auth Component has been Chris's tutorial, but even then I still needed help. Also, I'm the type that doesn't really learn much without code.
Note that I'm running off of the CaekPHP 1.2 beta.
Getting Started
Now you can modify this however you like, but I'm starting out with the basics. You're going to need the following:
- A user database with fields username, password. Of course they don't need to be named that way, but defaults are fun.
- A User Model with Controller and Views - This can be baked from CakePHP
- A login view for the user.
- And a base app_controller.php. That's it.
The Setup - app_controller and users_controller
So here's the minimum in app_controller:
Share This
Published: Monday, January 7th, 2008
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). You'll have modify your code since the result in $this->data is slightly different. There's been some stuff deprecated and some stuff added.
The Model::generateList() function has also be deprecated, in favor of Model::find('list'). It's not an exact duplicate of generateList() but it gets the job done. Check out the cakebaker for more essential tips for upgrading from CakePHP 1.2 pre-beta to the fresh new CakePHP 1.2 beta.
Enjoy and Happy Baking!
Popularity: 46%
Share This
Published: Tuesday, January 1st, 2008
One problem that I've always had with finding CakePHP related information over the internet is the multiple sources. I wouldn't so much mind if all these sources were legit. The thing that pisses me off is those scrapers who scrape the entire CakePHP mailing list. To me, there's nothing worse than asking a question in the mailing list, then searching on Google for an answer, just to find some idiot has scraped your question from the mailing list. I try to report them when I can, but I just can't seem to keep up.
Sorry for the rant, back to my point. Sharan over on the CakePHP mailing list has made the process of finding the latest CakePHP information a lil' bit easier. Using Yahoo Pipes, he's taken feeds the most popular CakePHP RSS feeds and consolidated them into one giant feed - http://feeds.feedburner.com/cakephp. The great thing is that he's also taken some of the non-english blog feeds and slapped on some translation. What more could you want?
I'm not sure how much the author values his privacy, so if you want to get in contact with him and/or view the Yahoo Pipes source for this feed, head over to the CakePHP mailing list and search for: "http://pipes.yahoo.com/sharanbrar/cakephp". If you think that their's a blog missing, just leave a comment here and I'll route it to the author.
Share This
Published: Friday, December 28th, 2007
One of the nice things about CakePHP is that it includes ready to use CSS compression. Granted, compressed CSS can be buggy at times, but for the most part it works just fine.
I've always wondered why no one has included something like this for Javascript, since that's usually the bigger culprit when we're talking about document size. I've tried using Minify in the past. However, it took a lot to get it working right. And I really hate hacking stuff just to work with CakePHP. That, coupled with the fact that I'm a lazy bastard, meant that I gave up the Minify train rather quickly.
Mark Story To The Rescue - JSMIN Javascript Helper
At the time, I hadn't heard about the JSMIN library, which does pretty much the same thing the Minify does, but without the CSS. Luckily, Mr. Story had some vision after his Christmas festivities and cake up with a JSMin Helper for CakePHP. This helper works by Minifying the chosen Javascript. This involves stripping unnecessary characters (line breaks, comments, spaces, etc) from the .JS file.
It also includes functionality to cache the resulting files. What more can you ask for?
Usage:
Share This
Published: Friday, November 30th, 2007

Before I start let me say that CakePHP is great. I love it to death. Currently, I'm coding a semester long class project for a friend. I'm trying to illustrate just how much faster it is to create a web application using CakePHP than anything else the other students are using.
The Project
The project consists of computerizing some department of the local university. What she's chosen is to computerize the Audio Visual Department. Specifically the process of submitting equipment requests to the department so they can take the equipment to different classes.
The Competition
The other students are using things like C#, Visual Basic, and other high level programming languages. With all these things, you need to design an interface (and everything else for that matter) from scratch.
You're also on your own when it comes to controls and binding them to the database fields. Not to mention, you need to do all the database relationships by yourself. The other problem is that the project is a multi-user application by definition. That means a central database. This is generally more difficult to implement on a desktop application. The project, to me, just screams Web App!
Share This