Zend

Disponível somente no TrabalhosFeitos
  • Páginas : 9 (2140 palavras )
  • Download(s) : 0
  • Publicado : 10 de abril de 2011
Ler documento completo
Amostra do texto
Getting Started with Zend Framework
By Rob Allen, www.akrabat.com Document Revision 1.6.3 Copyright © 2006, 2009

This tutorial is intended to give an introduction to using Zend Framework by creating a simple database driven application using the Model-View-Controller paradigm. NOTE: This tutorial has been tested on version 1.8 and 1.9 of Zend Framework. It stands a very good chance of workingwith later versions in the 1.x series, but will not work with versions prior to 1.8.

Requirements
Zend Framework has the following requirements: • PHP 5.2.4 (or higher) • A web server supporting mod_rewrite or similar functionality.

Tutorial assumptions
I have assumed that you are running PHP 5.2.4 or higher with the Apache web server. Your Apache installation must have the mod_rewriteextension installed and configured. You must also ensure that Apache is configured to support .htaccess files. This is usually done by changing the setting:
AllowOverride None AllowOverride All

to

in your httpd.conf file. Check with your distributionʼs documentation for exact details. You will not be able to navigate to any page other than the home page in this tutorial if you have not configuredmod_rewrite and .htaccess usage correctly.

Getting the framework
Zend Framework can be downloaded from http://framework.zend.com/download in either .zip or .tar.gz format. Look at the bottom of the page for direct links.

Setting up Zend_Tool
Zend Framework is supplied with a new command line tool. We start by setting it up.

Zend_Tool for Windows
NOTE: Zend_Tool in version 1.9.0 ofZend Framework doesnʼt work on Windows. Use version 1.8.4p1 from the Archives at http://framework.zend.com/download/archives until 1.9.1 is released. • Create a new directory in Program Files called ZendFrameworkCli • Double click the downloaded archive file, ZendFramework-1.8.4PL1-minimal.zip. • Copy the bin and library folders from within the ZendFramework-1.8. 4PL1-minimal.zip folder window to theC:\Program Files\ZendFrameworkCli folder. This folder should now have two sub folders: bin and library. • Add the bin directory to your path: • Go to the System section of the Control Panel. • Choose Advanced and then press the Environment Variables button. • In the “System variables” list, find the Path variable and double click on it.
Page 1 of 18

• Add ;C:\Program Files\ZendFrameworkCli\binto the end of the input box and press okay. (The leading semicolon is important!) • Reboot.

Zend_Tool for OS X (Linux is similar)
• Extract the downloaded archive file, ZendFramework-1.9.0-minimal.zip in your Downloads directory by double clicking on it. • Copy to /usr/local/ZendFrameworkCli by opening Terminal and typing: sudo cp -r ~/Downloads/ZendFramework-1.9.0-minimal /usr/local/ZendFrameworkCli • Edit your bash profile to provide an alias: • From Terminal, type: open ~/.bash_profile • Add alias zf=/usr/local/ZendFrameworkCli/bin/zf.sh to the end of the file • Save and exit TextEdit. • Exit Terminal.

Testing Zend_Tool
You can test your installation of the Zend_Tool command line interface by opening a Terminal or Command Prompt and typing:
zf show version

If all has worked,you should see:
Zend Framework Version: 1.9.0

If not, then check you set up the path correctly and that the bin directory exists in the ZendFrameworkCli directory.

Getting our application off the ground
Now that all the pieces are in place, we can build a Zend Framework application. We are going to build a very simple inventory system to display our CD collection. The main page will listour collection and allow us to add, edit and delete CDs. We are going to store our list in a database with a very simple table schema like this: Field name id artist title Type integer varchar(100) varchar(100) No No No Null? Notes Primary key, auto increment

The following pages will be required. Home page Add New Album Edit Album Delete Album This will display the list of albums and provide...
tracking img