Entries tagged under ' framework '

Written May 5, 2008 in webdev, zend framework

While we’re waiting for me to recover from my vacation over the weekend… Decorators with Zend Form - Matthew has posted what he hopes will be the definitive Zend Form & Zend Form Decorators tutorial.

Continue Reading »

And now the fun begins! Today we’re going to really show some of the power of Zend Framework. All the steps that you’ve taken in the previous tutorials will suddenly make sense — you’re going to be set up to authenticate users in a few minutes flat.

If you don’t know basic OOP (Object-Oriented Programming) principles, now would be a good time to go do some reading on them. We’re going to make heavy use of inheritance, as well as overriding. Just keep in mind that PHP is not a strongly typed language.

Let’s get started. For authentication, we’re going to build the form the old fashioned way so that you can get a good example for ‘how it was done’ versus ‘how smoothly it can be done’ with Zend Framework.

Continue Reading »

Today, let’s take a look at Zend_Db. Zend_Db implements a Table Data Gateway, in which the object is considered to be extended to have the properties of a table, as opposed to a Object Relational Model (ORM) / Data Access Object (DAO) where the object is considered to be a representation of the database object. Philosophy aside, it’s a great tool, and we’re mostly interested in how to use it. It is worth noting that you can use Zend Framework along with the excellent Doctrine ORM… and the syntax is even pretty similar.

The general procedure when setting up Zend_Db is to create a bunch of objects that extend Zend_Db_Table_Abstract. When defining an object, you can define what table it connects to, what the primary key is, and any foreign keys that relate to it. Upon instantiating the object in your code, you can use it to build queries against it’s related table, which returns a collection of row sets for direct use in your applications. Today’s tutorial assumes that you’re very comfortable with looping and other control structures in PHP.

Continue Reading »

Yesterday we left off with a basic folder structure in a Subversion repository, including the Zend Framework libs. It isn’t really much to look at, and it just doesn’t do anything. Not impressive. Let’s fix that.

Today we’ll be covering the front controller and some basic modules and actions. You still won’t need a database at this point, but you will need to have Apache configured correctly. You’ll also want to have the Zend Framework Reference Guide within easy reach.

Before we get started, make sure that your Apache configuration

Continue Reading »

Over the next few days, I’ll be covering how to set up your first Zend Framework application using PHP and MySQL.

First, some requirements. You should be comfortable on the command line or with your Subversion client. I’m writing from the point of view of someone who codes on a Linux or Mac machine using vim. You will need to have PHP 5 installed on your server — this will not work unless you do. Second, I would recommend getting a VPS from a host like Futurehosting — for $20/mo, you get root access to your own machine, you can host as many sites or servers and have as many domain names as you want, and you get 350gb a month in transfer — I don’t think I’ve used 1gb of transfer ever, and I do a ton of work with the server. I also Also, we’re going to assume you have access to a Subversion server. That’s just good practice, folks. Subversion hosts are very cheap — I usually use CVSDude.

Today we’re going to cover the folder structure, getting things into subversion, and locating the different files. Tuesday, we’ll cover the bootstrap and getting your index module and error module to show up. Wednesday, we’ll cover Zend_Db_Table_Abstract, Thursday we’ll cover Zend_Form, and Friday we’ll put it all together to get a user registration and login working.

Disclaimer: I’m by no means a whiz kid with Zend Framework. ZF is unique among frameworks in that it gives you a toolset but does not enforce any conventions. The conventions I’m giving here are *my* conventions and may have nothing to do with the way you want to code.

Let’s dive right in.

Continue Reading »