CakePHP
CakePHP Digest #25 All Hail 1.3 Stable
Sponsor
For the first time the CakePHP Digest series has a sponsor - and it's me. I need some work. Not a lot, just a few hours a week. What, you thought I did these out of the goodness of my heart? Ha! I've just been waiting for the chance to exploit these digests for my own personal gain. Apparently making it rain (link NSFW...unless you work in a strip club) from rolls of nickels at the dance clubs just isn't a good idea. Paper money is the way to go and I need some to cover all the medical bills those nickels caused.
News
Cake 1.3 Stable
There have been roughly 15 CakePHP 1.3 releases since the last digest, but the only one that matters is 1.3 Stable. Awesome. If you've been waiting for 1.3 to go stable before switching and complaining about bugs (because it's not fun to complain about bugs in RCs) then now's your chance. I made the switchover around RC3 and feel like a moron for waiting so long. It was so damn easy. Almost like they want you to switch. Might have to file a bug about that.
Docs and API for 1.3 are also available.
Congratulations to the entire Cake team and everyone who contributed to 1.3.
Cake 1.2.7 Release
There is also an update to the 1.2 branch, which fixes a "security concern" that only affects sites running with debug enabled. Hahaha! Who runs their sites with debug on. Oh...uh...yea all those dev/testing sites. Hey everyone look over there. *quickly runs and upgrades dev sites*
CakeFest 2010
No info at the moment, just a teaser page. Consider me sufficiently teased.
Croogo 1.3
The CakePHP powered CMS Croogo made the jump to CakePHP 1.3. There isn't an upgrade guide and if you drop the new version over your old Croogo it kicks off the install. The easiest way to handle this is run through the install with a blank database, then once you're done switch the database back to your old one. The schema is pretty much the same - just two new columns in the users table.
Themes and plugins will also need to be updated, which mostly consists of making a yml (ugh) config file.
CakePackages
CakePackages, which helps you find code for your projects, is now tracking upwards of 548 projects by 284 devs. I think between myself and @savant we're responsible for 547 of the projects and the other 283 devs are responsible for the other 1.
In The Wild
Tripeo
Tripeo is a UGC site for Canadian travel. There is a short write-up on it in The Bakery.
PopGames4u.com
Another Bakery article promoting the games directory: PopGames4u.com. I think "pop" is short for popular, but it could be short for Pop Tarts. Hmmm...Pop Tart Games 4 me.
In The Blogs
Why You Should Upgrade to 1.3
If me telling you to upgrade to 1.3 isn't enough here's a post from Mark Beukers with "logic" and "reason".
Screencast - Building a FAQ in 5 Minutes
Deon Heunis has a screencast showing a simple FAQ. It's pretty much a screencast showing how to get Cake setup and use bake. Unfortunately there isn't any audio, so it might be tough for newbs to keep up.
WordPress + CakePHP
The topic of how to link up WordPress and CakePHP seems to come up a lot. Tim Trice has a detailed post showing how to build a Cake app onto WordPress database.
MongoDb with CakePHP
Mark Story has a post about how to use the MongoDB dataousce (from Yasushi Ichikaway) with CakePHP. Am I the only one who wishes the MongoDB logo somehow incorporated an 80s Chicago Bears jacket? Uh, yeah, ok I guess I am the only one.
CakePHP Alias
Nick Baker has a post on the under-appreciated model attribute alias.
Controller::setAction()
Yet another secret function, Controller::setAction(), is detailed by Miles Johnson.
CakePHP and Nginx
Kevin van Zonneveld has a post showing how to setup Nginx (my favorite web server) to host Cake apps.
Deployinh CakePHP apps with Capistrano
By Jean Philippe Doyle, in The Bakery, an article on deploying CakePHP apps with Capistrano.
Code
From CakeDC
CakeDC has been busy releasing plugins, so I'm just going to list them all there:
Sanction Plugin
The Sanction Plugin from Jose Diaz-Gonzalez is an easy way to control permissions within your app.
Oauth Extension
Neil Crooks unveiled his Oauth Extension which looks awesome and it is a much smarter implementation then what I did for my Twitter client, 20Couch. Speaking of Twitter, did you know their shutting off basic auth access on June 30th? If you have a Cake/Twitter app now is the time to switch.
bit.ly Datasource
With short urls being all the craze (I prefer to call them stubby), this bit.ly datasouce from Jonathan Bradley will probably be useful to some of you.
Referee Plugin
Joe Beeson unleashed (hard to come up w/ different ways of saying released) his Referee Plugin, which tracks issues and errors in your app. This almost makes me wish I made errors.
Asset Compress
An already crowded area for CakePHP code gets another addition - Asset Compress from Mark Story. You may also want to check out my Asset Packer. If you didn't see that link coming then you haven't been paying attention. I now know how a rooster trainer feels when his prize cock gets pecked to death by the new champ.
Copyable Behavior
Jamie Nay unshackled his Copyable Behavior, which helps copy DB records including those in associated models. Also from Jamie: Cipher Behavior - which aids in two way encryption if you're willing to infect your app with a Zend component.
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.
CakePHP Digest #24 - Drama Free
News
CakePHP Drama
Note: I wrote this last week before the latest incident, but it mostly still applies. And I'm too lazy to write a new intro. Besides in the time it takes to write a new one something else would happen and then that one would be shot.
If you stalk the Cake devs (and former Cake devs) on Twitter you might have caught some disagreements lately. Mostly related to the new navigation bar on the top of cakephp.org. I'm not going to link to the disputes here, since that isn't what this digest is all about.
Instead I wanted to comment on the thought that these "discussions" are bad for the framework. Whenever an internal dispute spills into the IRC channel or Twitter someone always complains that these public spats reflect badly on Cake.
I disagree (wanna fight about it?). Apart from the entertainment aspect (who doesn't love a internet cat fight?), I would argue that something like 1% (now that the bakery is involved this number is more like 25%) of the people who use Cake even know about the spats . Most developers just use Cake, without following it religiously.
Take jQuery for example - I use it all the time. I keep updated with the latest news. I even contributed (although you could barely call it a contribution) to the latest release (it was a good thing I was already in the bathroom when I was reading that or I would have pooped myself). But if @jeresig got into a Twitter-fight (need a good word for this - anyone?) with a former jQuery developer (who split to start the next generation JavaScript framework lQuery), I wouldn't know anything about it. In fact I can't even name anyone else on the jQuery team.
My point is that unless your virtually stalking a project you'll never even know about these little Twit-fits (nah...that doesn't work) .
Update: Thankfully everything worked out in the end (well at least for the latest incident) and all parties involved had tremendous internet make up sex.
CakePHP 1.2.6
On to the good news: There was a new bug fix release for the 1.2 branch (1.2.6).
As usual I didn't rush to upgrade - mostly because I have absolutely zero issues with 1.2.5 (and prior 1.2.x versions). Kudos to anyone who actually found a bug. You must be doing some really crazy and experimental things. Kind of like what happened in the aforementioned internet make up sex...uh...I heard.
CakePHP 1.3 Beta
There is also new beta release of the 1.3 branch. I probably shouldn't be saying this but the 1.2 release kind of pissed off the 1.3 branch for releasing so soon after. 1.3 was like "bitch, why you stealing my spotlight" and 1.2 was all like "you're stable you can hang in my league, deck officer". They haven't talked since. Kind of sad really.
In The Wild
RentUpdate.com
This one is from Marc Grabanski and is a rental listing site. Might come in handy during messy split-ups.
Almost Musique
From Guillaum comes Almost Musique. I'm not going to look this up on the 1% chance I'm wrong - I'm going to assume the name translates to Almost Music, which is completely hilarious when you think about it. It's not quite music. Close. It has instruments and people singing, but something's missing. Can't put my finger on it.
I think I'm going to change the title on my resume to "Almost Developer". This will really get expectations in line.
DecalCat
From @voidet come DecalCat.com. For whatever reason (probably cause they're too tough to ship) the cat isn't actually included - just the decals. But I found one in my neighbors house and let me tell you: those decals stuck on that cat like Tiger Woods on a cocktail waitress.
Copify
The @cakephp account tweeted about copify.com. For a site about copywriting it's a bit embarrassing that they spelled "organisations" wrong. FOOLS! HAHA!
PRManna
Thanks to @savant for pointing out this Hacker News posting about PRManna.com which is running CakePHP.
In The Blogs
File Upload and Migrations Posts
From the CakeDC blog a post describing file handling in CakePHP and a guide to the migrations plugins, which is now available without mandatory donation.
Custom Routes in CakePHP 1.3
From the always awesome Mark Story - custom route classes in Cake 1.3
Firing Behavior Callbacks in UpdateAll
From Teknoid a snippet on firing behavior callbacks when using UpdateAll.
Croogo Switching to 1.3
Fahad19 announced the migration of Croogo CMS to CakePHP 1.3. Cake 1.3 didn't handle it very maturely, posting numerous Twitter updates taunting Cake 1.2.
Code
Zend Search Lucene Datasource
From Jamie Nay a datasource for Zend's search Lucene class.
MongoDB Datasource
From ichikaway a MongoDB datasource.
Capistrano Integration
From jadb Capcake - a capistrano integration thingy.
Permissionable Behavior
From @jmcneese an updated to his permissionable behavior and a new metadata plugin (also a blog post), which looks really hot.
Facebook Super Plugin
From Nick - a Facebook connect + API + lots of other stuff plugin.
Bakery Clustfuck
A bunch of new stuff in the bakery. As always it's a mixed bad. Here's a few I thought were interesting: Salesforce datasouce, Excel spreadsheet helper, and More tree stuff.
I'm Out!
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.
CakePHP Digest #23 - Moving Day
News
Before We Get Going
I've accumulated a lot of links since the last digest (two months between posts will do that). As a result some links that would normally be included didn't make the cut. The good news is you'll never know if your blog post/code snippet was cut, so don't feel bad. Although if you posted something CakePHP related since Thanksgiving then you can assume I saw it. And if it's not included then you can assume I didn't deem it worthwhile. So maybe you should feel bad...
GitHub and Lighthouse
CakePHP development moved to GitHub (Yea!) and Lighthouse (Lightwhat?). Plus new plugins (localized and datasources), which are already on version 0.2 (that puts them on target for 1.0 around Jan 2024).
Cake Prayer
Via @predominant: A CakePHP Prayer
New CakeDC
Cake's parent company CakeDC got a fancy new design (via @PhpNut). Also you can support CakePHP by grabbing the new migrations plugin for a $15 "donation".
New Default CSS
@mark_story posted a couple screenshots of what could be the new default style sheet. HAWT!
Sites
validcake.com
I actually don't think this a Cake site, but it does generate the validation array for Cake models.
checkoutmygarage.net
From @modethirteen: checkoutmygarage.net - Yes, it is pretty much what you would think it is: A site for uploading pics of your garage. I might post some shots of my garage - boxes of old baby cloths/toys piled on unused exercise equipment. Although I don't think that's what they're going for.
vegasorange.com
From @mgiglesias: A site for Vegas real estate. I used to love Vegas, but haven't been in years. I hear it's kind of lame now and Montreal is the hip gambling spot. Hey, speaking of Canada...
harbourstation.ca
From @???? (I got this from twitter, but didn't note who posted it. I suck): A Canadian arena that hosts Canada's two most popular forms of entertainment: hockey and Gordon Lightfoot. I'll leave it as an exercise to the reader to determine which is the most popular.
iqlink.com.au
From @predominant: iqlink.com.au - A product info site for sweet looking ATM that dispenses documents instead of cash (or something like that).
In The Blogs
Loading Helpers As Needed
Jeremy Burns has a great tip on how to load a helper for a specific action rather then the whole controller. This is nothing new, but it's worth mentioning again.
Better Zip Code Validation
Jamie Nay posted a short validation routine for handling various international postal codes. This is mostly for 1.2 as the localized plugin mentioned above handles these in 1.3.
Bye-bye $cakeDebug
Teknoid has a post marking then of the $cakeDebug variable and some bits on how the new system works.
Code
Fixture Factory
I'm going to screw up the description on this one, but here we go: Fixture Factory is a CakePHP plugin for programatically creating fixture at the top of your unit tests, rather then relying on database records or _fixture files.
CakePHP to LI3 Bridge
This is more of a LI3 plugin for porting Cake apps bit by bit. Here's the official descprition:
The li3_cake plugin allows you to develop applications that use CakePHP and Lithium together, leveraging classes and exposing resources using both frameworks in unison.
Be honest: you threw up a bit in your mouth reading that. That description is a "synergy" away from qualifying for the enterprisey buzzword hall of fame.
Trees
If you're into trees then last month must have been like Christmas for you. Also if you're into Christmas, then last month must have been like Christmas for you. First we have Neil Crookes TreeCounterCacheBehavior plugin. If you're smart you're probably asking:
@AD7six: why have a (total)child_count field at all. no-of-children = (rght - lft -1)/2 .
And obviously the answer is:
@neilcrookes: ah, I remember now, it's for when I add scope functionality
@neilcrookes: when I say remember, I mean, that's the excuse I just came up with for being too dumb to realise no-of-children = (rght - lft -1)/2
Also from Jamie Nay is his post "Adding Better Scope Limiting to CakePHP 1.2’s Tree Behavior". One more: BTree Behavior from jas osborne, which claims to be faster then the Cake Tree Behavior when dealing with overgrown trees.
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.
WordPress To Croogo Migration
I'd been wanting to dump WordPress for awhile. I'm extremely neutral on WordPress in general, but two things drove me nuts:
1) It took me way to long to make simple changes to themes or plugins. Probably my own fault, since I don't really know the WordPress API. But I hated dealing with any of the related code.
2) I had to choose between slow or crashy. I'm on the smallest SliceHost VM - which is generally fine for the dozen other sites that share it. But the two WordPress blogs felt so much slower. I tried the Super Cache plugin, which would bring down all the php-cgi processes randomly when running in "full" mode. Mostly this happened when I was composing a new post (something w/ the auto-save), but other times just randomly in the middle of the night. I was doing all that retarded shit to work around it, like running scripts in cron to check if the site was up and then restarting if need. I hate that. I spent three hours rocking back and forth in the shower the day I turned that cron on.
What's Croogo?
Croogo is CakePHP CMS built by Fahad Ibnay Heylaal (@fahad19). It is currently at version 1.2 (although I'm running trunk with no problems). The full feature list is available on the wiki and their are a bunch of screenshots on Flickr.
Why Croogo?
Because it's CakePHP based and it was released when I was at my most frustrated with WordPress. I'm really that easy. I wanted something Cake based so it would be easy to tweak. Plus it uses Cake's theme, which I already know, so I was able to convert the old WordPress theme (with a few updates) in about 5 minutes. Also this allows me to eventually take all the (neglected) code running on sandbox.pseudocoder.com and move it here. I had been running the subdomain to keep Cake and WordPress separate.
How To Do It
It's actually not that hard...since I did all the work for you :)
1) Install Croogo following the instructions.
2) Head over to GitHub and grab the Bye WordPress plugin. Follow the instructions. I moved about 200 posts and 1000 comments for this site. If you ever left a comment here please check to make sure it made it successfully. Thanks.
3) Create a theme (or use the default one or the one theme that's been released)
There's Always a Catch
Ok, so it isn't quite that easy. Here's some things to watch out for.
1) Database character encoding. I had some weird issues with angled quotes and em dash's. I never really sorted them out - I just fixed in the final database manually.
2) Manually copy uploads. The Bye WordPress plugin will move the DB records for the attachments, but not the actual attachments themselves. Just copy everything in /wp-content/uploads to /app/webroot/uploads. Croogo doesn't support sub directories in uploads the moment, but it works fine with the sub directory structure that you'll be taking from your WordPress install.
Note: WordPress references images by their full url including domain in your posts, so if you're doing the migration on a beta site (as you should) you'll still see broken images until you actually switch the domain over.
3) Spam protection. Croogo comes with Akismet support built in, but it isn't enough to set your API key (Admin -> Settings -> Service). You also need to turn it on for blog posts (Content -> Content types -> Blog -> Comments).
URLs
You'll probably want to maintain your old URLs. Thanks to Cake's routing this isn't hard. Here's a couple I used:
/archives/this-is-a-post-title
CroogoRouter::connect('/archives/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'blog'));
/2010/01/this-is-a-post-title
CroogoRouter::connect('/:year/:month/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'blog'), array('year' => '[12][0-9]{3}', 'month' => '0[1-9]|1[012]'));
/2010/01/11/this-is-a-post-title
CroogoRouter::connect('/archives/:year/:month/:day/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'blog'), array('year' => '[12][0-9]{3}', 'month' => '0[1-9]|1[012]', 'day' => '0[1-9]|[12][0-9]|3[01]'));
/page-title
CroogoRouter::connect('/:slug', array('controller' => 'nodes', 'action' => 'view', 'type' => 'page'), array('slug' => '[\w\n\-]+'));
Note: It's important where in /app/config/routes.php you put these lines. If a URL maps to multiple routes it will use the first one in the file. So put these all at the top or at least the top of the section they apply to.
More Note: routes.php is included in the Croogo package, so if you do an update you could lose these changes.
Make It Fast
I updated my HTML Cache plugin so that it's Croogo compatible. It generates static HTML files for pages, which are super fast to load. Go ahead - refresh this page. Bam! Done! The idea is basically the same as the SuperCache plugin for WordPress...except it doesn't crash the server. I'll be adding that feature in a future version.
Mini Review
All thumbs up so far. And since I decided to replace all the fingers on one hand with thumbs (thumbs are awesome!) that's like 6 thumbs up. The docs are bit sparse, but if you're familar with Cake you should be able to dig in the code to figure stuff out. Likewise the admin isn't as slick as WordPress', but it's certainly functional. All the basic functionality you'd want for a blog is there - maybe missing some polish, but certainly working.
Wrap
I'd definitely recommend making the switch if you're frustrated with WordPress and would rather deal with a Cake based platform. Plus it will give you something to blog about if it's been over a month since your last post.
CakePHP Digest #22 - Don't Go Away Mad...Just Go Away
News
CakeFest IV - Somewhere, America
The Cake team is looking for suggestions for the next CakeFest, which will take place somewhere in the U.S.A. I vote for my backyard. There's a 50/50 chance I could actually make it then.
addons.mozilla.org dumping CakePHP
The most trafficked CakePHP site has announced plans to switch to the PHP framework Django. Wait, Django is only for Python? So they're not only switching frameworks, but re-coding the whole site? They must have some real issues with CakePHP 1.2 and 1.3 to be making such a drastic change. Oh, they're still running 1.1? Don't you at least take a shot at upgrading before making such a major change? That's like switching to Snow Puppy from Vista without even trying Win7. That's right Cake is Windows in this scenario. Anyone have a problem with that?
Once addons.mozilla.org is gone (also xplodsony.com is gone too), what will be the largest Cake site in terms of visits/pageviews? Post your site with average monthly visits and pageviews in the comments. Winner will get a prominent mention in the next digest, plus a feature in a future digest when it inevitably moves to Django.
CakePHP 1.3 Alpha
CakePHP 1.3 looks pretty awesome. If I had a high traffic site that cataloged addons for a popular internet browser, that was still running 1.1, I would think about upgrading to this version. Just tossing that out there.
In The Wild
blackbooksingles.com
Hmmm...blackbooksingles.com (announced via their twitter account) is free online dating site built with CakePHP. Sound familiar?
hardwoodinfo.com
From @nezencreation: The American Hardwood Information Center. If you still find boner jokes funny (and who doesn't!), go to the homepage and read the rotating flash part and pretend all the text is about THAT kind of hardwood. My favorite: "Nature's Brilliance Has Created A Magnificent Material - Eco-Friendly, Durably, Asthetically[sic] Pleasing". I can neither confirm nor deny that this kept for entertained for a solid ten minutes.
andrw.net
A Croogo powered blog from @andruu: andrw.net and damn is it sweet looking. I have to be careful and not say too much nice stuff or WordPress will get jealous and take down my server.
In The Blogs
Ajax Pagination in 1.3
Mark Story has a post showing how to do Ajax pagination with Mootools in CakePHP 1.3. Although it seems like it would be just as easy to do with any of the other supported JavaScript frameworks. We could be seeing this in our favorite browser addons catalog in a matter of days if they didn't need to switch the entire underlying framework and coding language first. Instead it'll be roughly 2012 before they're back to 50% of the functionality they have now.
Routing Explained
If you've read the Cookbook entry and the "Secrets of Admin Routing" article and still don't get it, now we also have "Routing Explained". No more routing articles. I'm putting my foot down. Unless you still really, really don't get it. Then you get one more. But that's it. And then right to bed for you.
Get rid of .htaccess
Ryan Pendergast has a nice article on the bakery showing to speed up your Cake site by moving the mod_rewrite rules that are in your .htaccess file to Apache's config. Another speed up tip: Remove Apache, along with your .htaccess files and install Nginx.
Code
Archivable Behavior
Sohaib Muneer release a new Archivable Behavior. It's kind of like some of the "Soft Deletable" behaviors that are floating around, expect instead of flagging the row in the database it moved it to another table, so that the original table doesn't get too cluttered. I like to call this "The Table of Misfit Rows".
Searchable Plugin
This one is from Neil Crookes. It's a plugin for doing site searches, without having to rely on a search engine. I haven't had a chance to play with it yet, but I have no doubt it's completely awesome.
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.
