Updates from November, 2009 Toggle Comment Threads | Keyboard Shortcuts

  • Joe 23:57 on November 10, 2009 Permalink
    Tags: , codeigniter, framework, pear, , symfony, zend   

    Choice of PHP Frameworks 

    PHP

    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.

    Reblog this post [with Zemanta]

    Popularity: 6%

     
  • Joe 12:19 on February 26, 2008 Permalink
    Tags: , finderQuery, , Nigel McNie, pagination, patch,   

    Using pagination with CakePHP’s finderQuery SQL 

    Cakephp 1.2

    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).
    (More …)

    Popularity: 74%

     
  • Joe 13:43 on February 14, 2008 Permalink
    Tags:   

    Cakephp: isAjax weirdness 

    Cakephp 1.2Currently, 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… (More …)

    Popularity: 50%

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel

Twitter links powered by Tweet This v1.8.3, a WordPress plugin for Twitter.