CakePHP Digest #15 - Blog Posts Edition

Posted by Matt on Mon, Jun 01 2009

In The Blogs

There were a ton of really good blog posts in the last couple weeks, so pretty much this entire digest is going to be blog posts.

Paginating Custom Find Type

Daniel Salazar has a great post on a simple way to paginate over custom find types. It's scary how easy it is and makes it simple to have multiple pagination schemes per model without having to worry about creating paginate and paginateCount functions.

How To Use Bake

This tutorial on how to use bake was hot on twitter. Don't get me wrong, bake is great, but if I'm introducing someone to Cake showing them the command line bake tool isn't the first place I'd start.

Pagination Sort Direction

Richard@Home has a quick post on how to add a CSS class to the paginated columns that can be used for adding a direction arrow. Crazy that this isn't part of the core, right? If you don't want to create a new helper, you can accomplish the same thing using an element applied to the <th> tag.

Styling Flash Messages

James Fairhurst awoke from a six month coma and posted a pair of new articles. The more interesting one is on using layouts for flash messages.

Tips For Using Accented Characters

Jimmy Bourassa has a series of tips on how to successfully use accented characters. His post can pretty much be summed up as: use UTF-8 or fail hard.

Redefine HTML Tags

Flipflops.org has another simple, but extremely useful tip on how to redefine the html tags that Cake uses if you don't like the defaults (see part 2).

In The Wild

dogcommanger.com

From @rsrose: dogcommander.com

Code

Integrating Facebook Connect With The Auth Component

Before I post the link, let me preface by saying don't actually use this code verbatim. You'd be much better served rolling this into it's own component (preferably as a plugin), rather then just putting it all in your AppController. Anyway, here it is.

I'm Out!

And on that note don't forget to subscribe to my feed or follow me on twitter.

As always if you think I missed something leave a comment. Or if you do something interesting and want it included in the next digest, send me an email.

Posted in CakePHP

8 Comments

Pierre MARTIN said on Jun 01, 2009
Thanks again for this CakePHP digest edition!
Just in case... here is the (forgotten?) link to Richard@Home's article: http://www.richardathome.com/blog/cakephp-extend-paginatorhelper-indicate-sort-field-and-direction ;)
Matt said on Jun 01, 2009
Thanks. Fixed in post.
Dan said on Jun 02, 2009
Thanks for adding my article in the digest Matt. You rule...
alkemann said on Jun 02, 2009
About redefining the HtmlHelper tags, in order to get html 4.01 strict, I add this to the top of my layout file:

docType('html4-strict');
$html->tags['meta'] = '';
$html->tags['metalink'] = '';
$html->tags['link'] = '%s';
$html->tags['image'] = '';
$html->tags['css'] = '';
$html->tags['charset'] = '';
?>
alkemann said on Jun 02, 2009
yea ok that didnt work. I guess you have to use ur imagination to fill in the blanks :)
Richard@Home said on Jun 02, 2009
Thanks for the link to my pagination sort article :-)

"If you don’t want to create a new helper, you can accomplish the same thing using an element applied to the tag."

I've been migrating a lot of my code from elements to helpers recently. This was a natural progression. It means that should I need to override other aspects of the pagination I already have a solid base to build on.
Ryan Rose said on Jun 05, 2009
Hi Matt,

Thanks for mentioning Dog Commander! A couple other websites of ours recently launched that are powered by CakePHP include:

Alaris Technology: http://www.alaristechnology.com
Center for Leadership Studies: http://www.centerforleadershipstudies.com

More to come soon! At Fathom we use a webified version of Cake's Bake shell to rapidly prototype the skeletons for our content management systems. The system includes an interface for quickly adding lots of test data as well as a deployment module for our various environments.