zend framework for beginners Part 1

Posted by Unknown On Tuesday, 5 March 2013 0 comments

Hello friends now we are going to discuss on Zend framework, it also known as zf. This is a A to Z step by step articles on zend .this is first one so here cover on the following three basics.
  1. 1.       What is a frame work and why they need?
  2. 2.       Installing zend framework.
  3. 3.       First zend program.

What is a frame work and why they need?

Zend Framework (ZF) is a framework for PHP 5 and it is based on object-oriented paradigm. It is an open-source framework under the BSD License.  The idea of  ZF was conceptualized in the early 2005, and it was publicly announced in October 2005 at the first Zend Conference.
Like other PHP stack zend provides a PHP stack called zend server and also zend provides a IDE for ZF.

To run Zend 1.7.0 we need PHP 5.2.4 or latter .ZF‘s programmer’s reference says strictly 5.2.3 due to some security reasons, for unit testing it need PHP Unit 3.0 or latter
Zend framework of PHP is basically works on MVC architecture   MVC stands for Model View and Controller.
·         Model : The model part deals with the part which is concerned with the specification of the data to be displayed  Business logic part of the program is handled by this part which involves activities like load and save to databases

·         View: Responsibility of this part is to display the content of the application to the user. Usually this section contains the HTML part

·         Controller: This part combines together the specifics of model and view section and gives the assurance of displaying correct data

Installing zend framework. (with xampp )

Now we are going to install ZF framework on our local computer, initially we need to download the zend frame work from http://framework.zend.com/download. Unzip the folder into host c:\xampp\htdocs 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:\ xampp\htdocs \ZendFramework\bin folder

Now you want to go 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.

If it works your path variables are working perfect. After that we need create a directory stretcher that helps to reduce our work load and improve readability.Now type the following command which will create the directory structure automatically

.Here we are using XAMPP so we used root folder as htdocs. After executing above comments directory structure will like blow figure.
Now type http://localhost/myfirstproject/public/ in the address bar of the browser and press return key, the output in the browser should be like this:
go to C:\xampp\htdocs\myfirstproject\application\views\scripts\index folder and in the index.phtml and change the existing code with the following:

echo "<center><b>Hello World</b></center>";

save it and reload page output will as follows
In the next applications we will learn a how connect DB using Zend. plz read some other articles and give some reviews about my personal programming blog.


Post a Comment