background preloader

AJAX, MVC and How it FIts

Facebook Twitter

Architecting Ajax Applications with Zend Framework. Zend Framework, MVC, Ajax and Cli/Cron. Zend MVC - AJAX (with jQuery) and MVC. -- jjshell <[hidden email]> wrote (on Tuesday, 18 December 2007, 02:47 PM -0800): > Thanks for your reply. I've read about the isXmlHttpRequest() method. > I guess my main problem is to see once a simple real example. Then I'll > build on that. > > I still can't figure how you send data to an action and how this action > tells the client how to react, only on one part of the page (in the case, > say, of a form submission).

I did an unconference presentation on Ajax + ZF MVC during ZendCon; there are slides and code linked to it from here: Basically, you have your XHR requests target a controller/action pair in your application, and that action then returns a response that your XHR request can use -- in whatever format your client-side code requires (XML, JSON, or HTML). -- Matthew Weier O'Phinney PHP Developer | [hidden email]Zend - The PHP Company | Zend Framework & MVC Introduction - Zend Framework Quick Start.

Zend Framework Zend Framework is an open source, object oriented web application framework for PHP 5. Zend Framework is often called a 'component library', because it has many loosely coupled components that you can use more or less independently. But Zend Framework also provides an advanced Model-View-Controller (MVC) implementation that can be used to establish a basic structure for your Zend Framework applications. This QuickStart will introduce you to some of Zend Framework's most commonly used components, including Zend_Controller, Zend_Layout, Zend_Config, Zend_Db, Zend_Db_Table, Zend_Registry, along with a few view helpers.

Using these components, we will build a simple database-driven guest book application within minutes. The complete source code for this application is available in the following archives: Model-View-Controller So what exactly is this MVC pattern everyone keeps talking about, and why should you care? Understanding the Zend Framework, Part 1: The basics. The Zend Framework A couple of years ago, PHP sat at the top of the powerful-but-easy-to-use scripting languages heap — at least as far as popularity was concerned. It was installed on most UNIX®- and Linux®-based web servers. And if you were a programmer, it was easy to get a hosting account that would let you use it. Ruby had been around for quite some time, but not many people were using it. If you wanted to build a web site using dynamically generated content, but you weren't sure that you needed to go so far as to use an application server like J2EE, you would very likely use PHP. It was fast, easy to learn, convenient, and you didn't have to learn Perl.

And then — suddenly, it seemed — the landscape changed. What makes the Zend Framework one of the premier frameworks used by PHP developers is that it provides clean, stable code, complete with intellectual property rights. What is the Zend Framework, exactly? Zend Framework components include: Zend_Controller Zend_Db Zend_Feed Zend_Json. Understanding the Zend Framework, Part 9: Adding interactivity with Ajax and JSON. Introduction In Part 8 of this series, you added Yahoo! , Amazon, Twitter and Flickr results to the Chomp application. Now you're going to improve performance by loading only the data the user requests, when the user requests it.

But first, let's see where we are at. How you got here This nine-part "Understanding the Zend Framework" series chronicles the building of an online feed reader, Chomp, while explaining the major aspects of using the open source PHP Zend Framework. Part 1 talked about the overall concepts of the Zend Framework, including a list of relevant classes and a general discussion of the MVC pattern.

Parts 3 and 4 dealt with the actual RSS and Atom feeds. The rest of the series involves adding value to the Chomp application. Now in the final part of the series, you will use Ajax and the Zend Framework's Zend_Json component to update part of the search results page automatically with specific requested information. Back to top So what are Ajax and JSON, anyway? Listing 1. ...