Still a work in progress, and pretty rough: protected function _loopArray($data) { $string = ”; $count = 0; foreach ($data as $key => $val) { if ($count == 0) { if (is_numeric($key)) { $type = ‘ol’; $string = ‘ ‘; } else { $type = ‘ul’; $string = ‘ ‘; } } $string .= ‘ ‘; if ($type == ‘ul’) [...]
If you’re working in a place other than a controller, view, helper, or component – such as an event listener, custom lib class, etc. – and need to access the CakeRequest object (which is available as $this->request in controllers/views/helpers), then use Router to get it: $request = Router::getRequest();
The CakePHP book page on the new Hash class, the replacement for Set, is not exactly extensive. There’s even an error: the arguments for Hash::extract are $data, $path, but the example given uses $path, $data (the former is correct). One aspect of Hash that the book is particularly quiet on is how to use path conditions with methods such as [...]
Wow, I’ve really been neglecting my blog lately – sorry, everyone! With two kids, a full-time job, and a couple of side projects it’s hard to find time to sit down and write blog posts. I’ve been pouring most of my extra energy and time into Hockey Pool Geek, which is a website built on CakePHP that I’m very proud [...]
THIS CONTENT IS OUT OF DATE! IF YOU’RE USING CAKE 2, YOU SHOULDN’T READ THIS. Wow, I haven’t posted anything on my blog for a while. I guess I must be busy. A new baby will have that effect. Anyway, I’m happy to release an update to my Copyable behavior, which I shared with everyone a few months ago. Download [...]
Trying out a new WordPress theme. My last one got boring fast. One of these days I’ll have enough time to make my own theme… maybe. It’s been a while since I’ve posted anything of substance, but stay tuned!
THIS CONTENT IS OUT OF DATE! IF YOU’RE USING CAKE 2, YOU SHOULDN’T READ THIS. UPDATE June 02/10: Please check out the update to Copyable behavior Until I switched to CakePHP, any CMS I built for a client had a “copy this item” tool. The Cake framework doesn’t have anything like that built in, so for the past year or [...]
Yup, I realize that beforeSave() is a little wonky. My fault for not testing before making a major change. Update coming tonight on Github.
THIS CONTENT IS OUT OF DATE! IF YOU’RE USING CAKE 2, YOU SHOULDN’T READ THIS. Here’s a quickie – a Cipher behavior for CakePHP to handle two-way encryption of sensitive data. If you want to store, say, credit card information, you’ll need a way to retrieve it later; Cake’s built-in security hashing is one-way, meaning that once it’s encrypted it [...]
Well, I’ve finally gathered enough good CakePHP links to warrant another tutorial roundup. It’s not that there haven’t been any good CakePHP posts out there – the blogs are full of ‘em, especially with 1.3 finally in beta – it’s just that I’ve been (and still am) pretty busy. But as always, I’m constantly coming across useful CakePHP tips, code, [...]
