CakePHP’s fattie /cake/lib folder holds many hidden treasures, that although documented in Cake’s API, lacks examples of use and simple noobie terms like “howto”. I’m here to help, so settle down.
Archive for the ‘CakePHP’ Category
3 Hidden CakePHP Functions You Can’t Live Without, Flay
Easy Dynamic Database Connection in CakePHP
If you’re like me, you’re strikingly handsome you create Cake applications on your computer, then upload them for testing (and usage) to a server. It’s annoying to have to change the /app/config/database.php file for each new testing environment, especially if the same Cake application is being used on multiple machines.
Thankfully there’s a really simple way around this crap.
Image Upload Component (CakePHP)
Thanks to some fine work by Ben Borowski, uploading images in CakePHP is easy as kicking your kids. I’ve used this component for quite a few projects. It’s safe to say that it rules.
Learn how to use it, love it, code it.
Create Downloadable iCal Events via Cake
iCal just plain rules. Though it’s not a super-detailed, completely all-knowing calendar application, it’s the most user friendly offline event tracker to date. (The best online calendar is Google Calendar, hands down.)
Allowing your loyal, web-savvy fans to download iCal files (enabling them to instantly add events to their iCal program), or subscribing to iCal feeds (allowing their iCal program to update the users calendar whenever they chose – much like RSS) can bring a smile to even the pickiest of web surfers.
A Useless “Missing Layout” Error
Cake can be a real bitch with errors. Deciphering exactly what went wrong (and in what file) can take way longer than it should. One such example was a blank Missing Layout error I received last week. Upon firing up one of my Cake apps on my server, the following appeared when visiting a particular page:
Missing Layout: You are seeing this error because the layout file can't be found or doesn't exist.
Notice: If you want to customize this error message, create /cat/views/errors/missing_layout.thtml.
Fatal: Confirm you have created the file :
Now normally, the last line above points you to the file it’s trying to find. This is Cake’s way of pointing you in the right direction – a hint, if you will.
Example: Fatal: Confirm you have created the file : \project\app\views\pages\index.thtml.
Cake’s “hint” to me was blank. CakePHP, eat me.
