back to article Put some MVC in your PHP

The Model-View-Controller (MVC) architecture provides a useful three-tier pattern for building software, as MVC patterns decouple the graphical user interface (GUI) from the application logic. That comes in useful when it comes to changing an application after it has been deployed. Separation of the views from the data means …

COMMENTS

This topic is closed for new posts.
  1. tardigrade
    Linux

    Zend isn't the only option you know.

    Try Cake PHP and CodeIgniter as well both are MVC and enjoy considerably better community support. ZendFramework is currently third in terms of popularity behind these two.

    Me I use CodeIgniter and I highly recommend it and no I wasn't paid to write that. ;)

  2. Tim Brown
    Stop

    Design and code can never be completely seperated

    However hard you try, for anything but the simplest applications design and code in php can never be completely seperated. Indeed, it seems to me you often end up with a more complicated structure to a php application if you try. With the code calling 'templates' which in turn contain small bits of code for things like looping and conditional tests and often also call functions (more code) to fill in all the little bits and pieces. I think this sort of arrangement can often be harder to maintain, although has its place with large public php apps such as Wordpress.

  3. Jeff Parker
    Stop

    Escaping?

    And I quote ...

    $where[] = "ID ="."'".$_POST['id']."'";

    Promote safe SQL, contain your values before you inject them.

  4. Deepak Vohra

    RE:Zend isn't the only option you know

    PHP Zend framework has corporate support and follows the PHP best practices.IBM and Google have contributed to PHP Zend framework.

    "..Zend's is the first framework with support from a corporate entity and relevant contributions from companies like IBM and Google..".

    http://www.infoworld.com/article/07/06/27/zend-framework_1.html

    http://www.informationweek.com/software/showArticle.jhtml?articleID=200000468

  5. Caff
    Happy

    zend isn't the only framework

    I like cake

    :D

  6. Deepak Vohra

    RE:Escaping

    To add quoting in a SELECT query PHP Zend framework provides the Zend_Db_Select class, which automatically adds the quoting. PHP Zend framework also provides the quote(), quoteInto(), and quoteIdentifier() functions to add quotes.

    http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.quoting

    To add quoting replace:

    $where[] = "ID ="."'".$_POST['id']."'";

    with:

    $id=$db->quote($_POST['id']);

    $where[] = "ID ="."'".$id."'";

  7. tardigrade

    @Deepak

    Why quote from and link to articles based upon Zend press releases?

    I like Zend as a company, I like the framework and I use Zend Optimizer 3.3 and Zend Guard to protect my released code, but that doesn't mean that Zend is the only option.

    If we want to spread the gospel of MVC it's more helpful to show the options available and the range of resources that are out there. That way we are more likely to attract greater uptake of the MVC standard.

    For example the fact that Zend doesn't have built in user authentication, ajax and active record support may turn some people off. Cake does and it supports PHP4 which could help some developers make the switch when all their legacy code is built upon older versions of PHP. The migration to PHP5 is not to be taken lightly if you have a large and complex web app already deployed on PHP4.

    So I say show us all the options and everyone benefits in the long run including Zend.

    Peace.

  8. Deepak Vohra

    PHP Frameworks Features Comparison

    More than 40 PHP frameworks are available. For a feature comparison please refer

    http://www.phpframeworks.com/

    Akelos and Prado support the most features.

This topic is closed for new posts.