Hide
on 26/1/08

Happy new year!

Way back in December I found an awesome article by Cakeexplorer on a script to build an image of your db schema. I had been meaning to write such a script for some time, it was great to have it already ticked off the to-do list.

on 28/11/07

When I first started using cake, bake wasn't around. It took quite some time for me to decide to give it a go, but at that time what bake gave wasn't customizable, as such it's use was limited since it took nearly as much time to bake and edit the files as it did to just write the files (once you know what you are doing that is). Roll the clock forward a bit and bake allowed you to write your own custom templates. It, again, took quite some time for me to take note of the impact of this but it is in reality a big step forwards. Not only can new bakers use bake to get a working editable application, but you can also write your own templates and use bake to get exactly the code you want.

on 19/4/07

I wrote recently about how to have your site(s) email you whenever a problem occurs. Trouble is "problem" turns out to be a rather broad scope. If you have a missing file or fundamental problem of some kind, you would want to know so you can fix it; if there was a dead link on your site, you would also want to fix it; if someone just mistypes the url (or follows a link from an outdated source) you may not want an email each time this happens. At some point in between reading the comment from (the esteemed) Dr Tarique Sani and deleting the 4000+ emails I received from my site in the meantime, I came to realize that there has to be a better way to record what errors are occurring on a site. So that's what I'll be talking about today ;).

Limiting Scope

When I reviewed the emails that my site has sent me in the past week, there were many duplicates. The cause for most of the generated errors were either links to old pages which don't exist anymore or have been moved, or broken links on the site. When I switched host I also changed from (case insensitive) php4 to (case sensitive) php5, this caused many links to stop working. I was glad to know of how and why these errors were occurring, but once would have been enough ;). Of the types of errors that can occur, there is one case in which I want an email every time it happens - if there is a missing connection (which should be rare to never). So changes have been made to check for and only email in this circumstance, for the rest of the time...

on 31/3/07

Have you ever wondered what the reason for that 404 error is when you set debug to 0, or when you move your site onto your live server? How many visitors/clients are confronted by a 404 when they should be looking at the fruits of your work? Cake allows you to modify what happens in the case of an error, and the purpose of this post is to show how to make your site mail you (or the website admin if it's not you) or take whatever other action you might want whenever a 404 is generated.

I'll keep it short and sweet today :). Create the file app/app_error.php app/error.php with the contents below:

on 26/3/07

In the past week, a lot happened to this site, and not all of it was good :). Where to begin... the development machine died (hopefully get it back today); I moved all the code from a backup onto my aging laptop, my previous host account expired; I changed hosts to Dreamhost, the update from my laptop to the live version included some code that doesn't work/isn't finished; I upgraded my cake version only to discover some of my code was incompatible; I decided to take advantage of having php5 as an option and discovered some of my code was not php5 compatible etc. etc. But anyway, enough about that, hopefully things are on the up :).

One of the things that unintentionally became visible during all this was a demo I've been working on to demonstrate and test the use of the new MPTT tree behavior. It has a few quirks for which I have written a patch and the demo also serves to test how well, or not, this patch functions. At the time of writing this post the code available for download won't work, but the demo itself at least is fully functional.