Lightning Fast Caching for CakePHP
Frameworks: Benefits Come At A Cost
It is well known that CakePHP is not the fastest gun in the west. Paul Jones has published some great benchmark tests that compare the various frameworks against straight up PHP and HTML. I know that there are a lot of objections to this sort of test:
Despite numerous objections, the maxim still stands: frameworks come with a performance hit.
It boils down to this:
Function auto-completion in vim is ordinarily limited to the files that you have loaded into tabs or buffers. This is usually sufficient for me, but lately I've decided to set up exuberant ctags so auto-completion can be used project-wide. I also use CakePHP for most LAMP-stack projects that I work on, and I figured it would be nice to jump straight to a function to check arguments rather than relying on the online documentation.
Installing exhuberant-ctags on Ubuntu is easy as usual:
$ sudo apt-get install exhuberant-ctags
Next, create a directory in your vim settings directory to store your tag files for different projects:
The "TreeBehavior" built into CakePHP has a number of useful applications beyond the Auth/ACL uses that most developers use it for. As such, it's good to have a way to manipulate the tree relationships in an intuitive, user-friendly way. The goals in this particular project were to create a drag & drop UL/LI list that would retain not only the parent relationships, but also the sibling relationships.
In this example, let's create an organizational chart. This is something you'd see that demonstrates the relationships amongst employees at an organization - something that could potentially change over time.
Prepping The Database
First, obviously, we need a table. Here's what I'm using in this example:
If you're developing several different applications with CakePHP, over time it's easy to run into issues with running different versions of CakePHP across your applications. After a while it may become difficult to keep everything properly organized. Your directory structure can end up looking something like this:
cake_1.1.x/
app1/
cake/
cake_1.2.alpha/
app2/
cake/
cake_1.2.prebeta/
app3/
cake/
This works, but I greatly dislike having all of my applications spread across a file system, and each in a different place depending on what version I'm running. If I want to upgrade to a new version, I have to actually move directories around. That's no good at all.
You could go in and muck about with your app/webroot/index.php file and change the paths to the cake install, but that just means now instead of moving directories you're having to edit hard-coded paths. That's no good either.
What we'd like to see is something like this:
Update (January 30, 2007): Also see this helpful post on CakePHP 1.2 Auth ACL by a commenter, and make sure to read the comments for more suggestions.
Update (August 26, 2007): While managing to get this set up, I've come to the conclusion that the CakePHP ( 1.2.5... ) db_acl implementation is far too incomplete to be using at this point. Some of the problems I've run into in the past month or so: