Share on Google+Share on Google+

Zend FrameWork Part-5

In this tutorial we will study about Zend Framwork 1.10 of PHP, the configuration, how to set this framework, database design of the project etc. are discussed in this tutorial. In next page we will discuss on the bootstrapping and other configuration files.

Zend Framework-5

As we have mentioned in our last tutorial that we will study about the same project under ZF 1.X version, so in this current tutorial we will do the same.

Functionalities of ZF 1.10 is completely different from version 0.6 as we have discussed in the previous tutorial. All we need to download the Zend Framework from Unzip the folder and copy the bin and library folder from the unzipped folder and place it in c:\program files\ZendFramework folder. Since most of the works in ZF is done from command prompt, so we need to do some preliminary settings, so right click on the My Computer icon, select properties, select Advanced tab, click on Environment Variables, now under the System Variables select Path and click edit button, now select the c:\program files\ZendFramework folder, put double quote around it (optional) and two semicolons before and after the path, reboot your system.

Now after that go to command prompt (WIN key + R=Run, Window=> type cmd and press enter key). Type zf show version and press enter, it should display like this.

syntax to show the version

If it displays like the above output, that means you have set it right. Now we need to create the project which will be based on a library like application in which you can add, edit, delete book and at the same time you can see the details of the book, before we move further let's see what would be the design of the table.

database design

Since this is not a big project, we can consider a small table of four columns. To create the database and tables copy the following codes and paste on the mysql console or any mysql gui:

create database rose;
use rose;
create table book_sel (
   id integer auto_increment primary key,
   author varchar(20) not null,
  publisher varchar(20) not null, title varchar(20));
 insert into book_sel vvalues

Insert few more data as per your choice, which will be modified in our project.

Now we will create the directory structure using zf command, which will save our time and effort and create a fully functional MVC based project. Now type the following command which will create the directory structure automatically:


We are using XAMPP, and the root folder here is htdocs, use the same commands mentioned above for your header folder. After executing the command a directory structure will be like (book_sel is the name of the project):

directory-structure of ZF 1.10

Application is our main directory in which we will put all the source code of the application, in this directory model, view and controller are different folders in which  we place the respective files. The use of public directory is the public facing root of the website, that means to access the application's root page we need to type: http://localhost:81/public/ and by doing this we will make our website more secure because most of the files of the application are not accessible by Apache.

Images, CSS files will be stored in separate directories in  public directory. Library files will be stored in library folder, in the current example we will copy the zend folder, (from the unzipped folder (ZendFramework<version>/library/zend) ) to the library folder of the project.

Now type http://localhost:81/public/  in the address bar of the browser and press return key, the output in the browser should be like this:

zend framework 1.10 default page

In the next tutorial we will learn about how to configure the basic files and bootstrapping.


Posted on: April 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null