Top Stories
|
Put some MVC in your PHP22 Feb 2008 12:02 Trial by separationHands on 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 modifications made in the views do not affect the model and modifications made to the model to not effect the graphical user interface, simplifying maintenance. Also, an application may be expanded to add views and controllers that talk to a model without actually making any changes to the model itself. Unfortunately for web developers, one of the features lacking in PHP until recently has been support for the MVC architecture. That has meant the MVC pattern has had to be implemented externally. Some PHP frameworks have now added support for the MVC pattern, most notably the Zend Framework - one of the leading open-source PHP frameworks. Zend simplifies the task of developing secure, reliable web-based applications and web services. Zend provides an extensible code base, a flexible architecture and does not require any configuration files. In this article we shall connect Zend to a database from Oracle, a company that's been working closely to optimize its software with Zend. Fire up ZendThe Zend framework requires at least PHP 5.1.4. It's recommended to install PHP 5.2.2 or later because of the security and performance improvements in the newer version of PHP. Download the Zend Framework zip file from here and - if you don't already have it - download and install Apache 2.2.3, making sure it's configured with PHP. Then, add the following include_path=".;C:\ZendFramework\ZendFramework-1.0.1\library" Enable the PHP database extension for Oracle database in extension=php_oci8.dll Restart Apache HTTP Server. Install the Oracle database including the sample schemas and create a table Create an MVC applicationNow it's time to create a Create Read Update Delete (CRUD) application using Zend's MVC architecture that'll let us build, read, update, and delete an Oracle database table row. In the MVC architecture the model represents the entities/class objects, the controller implements the business logic and integrates the model with the view, and the view represents the presentation layer or the user interface. The MVC architecture in Zend Framework is implemented by the
Track this type of story as a custom Atom/RSS feed or by email.
|
Breaking Hardware News
HP and supermarket giant Sainsbury’s are asking Londoners to recycle IT kit they no longer use.
Newsletter |