Archive for November, 2009

There are two main methods for finding random records with PHP (and in this case CakePHP) and MySQL: Use a SELECT query with ORDER BY RAND() and LIMIT x (where x is the number of results you want). Get a list of the primary keys of every record in the table, use PHP to select [...]

If you use CakePHP’s caching system but don’t like having to wrap you calls to Model::find() in if statements (“if cache result found… else…”) then this little quick tip is for you. Basically, we’re just going to put a slightly modified version of Model::find() in AppModel. Our new find() method will check for the existence [...]

Yup, I’ve finally joined the party and created a GitHub account for myself. There’s not much on there – currently just one bit of code, a CakePHP component. I’m hopefully going to fill out the repository with a bunch of uself stuff soon.

Most people who do serious, large scale development with CakePHP would agree that keeping the bulk of a project’s code segregated in plugins is the best way to keep things organized. Sometimes, however, we want to use a plugin’s functionality outside of the scope of that plugin’s controllers. For example, we might have a products [...]

Wow! It’s been a while since I’ve written much about CakePHP, PHP, or just anything useful in general. I guess I’ve been pretty busy. Hectic job, baby on the way, that sort of thing. But I’m trying to get back into blogging because it’s a good outlet for my desire to write, plus I love [...]

I’m officially fed up with my latest WordPress theme. So, I’m going to try out a couple to try to find the best fit. Yes, I’m a web developer and yes, I should come up with my own, but…

Just a quick bit of advice to those who may have been banging their heads against the walls when trying to pass “form” as a custom parameter in a CakePHP URL. Apparently ‘form’ is a param – an array, to be specific – that’s already set by Cake and using it as a custom parameter [...]


top