My tutorial of utilizing Zend Framework without MVC will be a jQuery rating controller, with ZF used to query the database, spit out the view (the actual stars), and handle rating changes thru Ajax, updating the DB. Though I prefer not to use ZF as an application, I tried to program as close to the MVC structure as possible. If you’re using ZF already, you will see that my way of utilizing it is close to a ZF plugin resource – with some minor changes, you’ll be able to adapt it into the framework in no time at all.

Installing Zend Framework

On your server, add some directories to accomodate ZF, jQuery, and your own PHP files. Assuming that you start from scratch, you need to point your webserver to the „public“ directory, instead of  „document root“. This way, one can’t access your lib files, e.g. configs, by URL.

> document root
> library
> Mylib
> Zend
> public
> images
> includes
> js
> jquery

Download the lastest ZF version at http://framework.zend.com/download/latest, and unpack the files. Get the content of the „library/Zend“ form your archive, and copy it into the „library/Zend“ folder on your server. Next, get the latest of jQueryUI at http://jqueryui.com/download, and put the content in the „jquery“ folder. jQueryUI is just a nice JavaScript framework (that word again…) with widgets and effects… you might need them later 😉

A short note: though ZF supports the Dojo JavaScript framework, I personally prefer jQuery. Dojo definetly has the cooler widgets, but the support sucks… no forum to speak of, and mailing list support slow if ever. If you run into problems with Dojo, you’re basically on your own… the exact opposite of jQuery, where you 1. get support within hours, and 2. rarely run into problems to begin with 😉 Just my 2 cents…

Anyway, the part missing for our little tutorial is the Star Rating plugin for jQuery. Get it at http://zensoftware.org/archives/483, and put it in your „js“ folder, into a „rating“ subdirectory.

Next up: Bootstrapping ZF