November 10, 2009 at 23:57
· Posted in cakephp, opensource, php, webdev

Image via Wikipedia
As of today there is a Tweet Poll running with the question: Which PHP opensource framework do you mostly use?
An interesting question because the market of PHP frameworks appears pretty fragmented after 750+ votes are cast. Leading is Zend Framework (does this qualify as Open Source?), followed by Symfony, Cake PHP, CodeIgniter, all around 10%. There are also a few stray ones: I don’t consider PEAR a framework and the choice “my own” can be disputed as well.
For now there is no clear winner, something I already had that gut feeling about. Wonder where this is going to stabilize (and of course, how representative the twitter votes are anyway). See for yourself, the embedded graph below should stay up to date and you may cast your vote if you ike.
Popularity: 6%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: cakephp, codeigniter, framework, pear, php, symfony, zend
Permalink
February 26, 2008 at 12:19
· Posted in cakephp, php, webdev

Update February 2009: this article is now about a year old and deals with an early beta versions of CakePHP 1.2. In the mean time, CakePHP 1.2 has been released with many improvements and great documentation. Please don’t use this patch, use this instead. I’ll leave the article below for reference.
Cakephp lets you define various kinds of associations between models. The principle is really simple, just define arrays like $hasMany in your main model, where associations with other models are defined.
For most purposes this does the trick, most associations are made by convention, but you can override these as well for e.g. database (foreign-) keys.
From there on, you can use all cake built-in functionality to retrieve model data. One such feature is auto pagination, where the page size is set through the value of the limit field in the model’s definition.
If you’re crafting something really complex, you can define your own SQL query in the finderQuery field. This is very nice, but the trade-of is that the other fields are ignored in the query. And if fields limit and offset are ignored, you no longer get auto pagination.
The patch below fixes this for the current development tree of CakePHP 1.2 (revision 6461).
Read the rest of this entry »
Popularity: 82%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: cakephp, finderQuery, mvc, Nigel McNie, pagination, patch, php
Permalink
February 14, 2008 at 13:43
· Posted in cakephp, php, webdev
Currently, I’m doing a project in CakePHP.
There’s lots to say about cake, here just a quick note, for myself or for anyone in case you are running into the same problem.
Situation: you are using the Ajax helper, which contains a method isAjax() – returns true if the request was an Ajax request.
Typically, you use this method inside a view, to conditionally render content for regular/ajax views. Example:
...
if (! $ajax->isAjax()) {
// render general page stuff
}
// render stuff for both regular- and ajax view
...
My problem was that the isAjax() call never returned true, regardless of ajax/regular request method.
The solution appears to be really simple: you should include the 'RequestHandler' component in your controller class. This one took me way too long to figure out!
public $components = array (
'Auth',
'Cookie',
'RequestHandler'
);
Update my situation was even worse than described above; I use a redirect between controllers within an Ajax call, something which is officially supported by Cake 1.2. This worked just fine in Safari, but not in Firefox (and Opera) – these browsers would not load the Ajax view but rather the complete page, almost crashing the server by consuming huge amounts of memory.
Read on… Read the rest of this entry »
Popularity: 57%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: ajax
Permalink