Archive | Zend Framework Tutorials RSS feed for this section

Zend Framework and Dojo: a simple but complete Zend_Dojo_Form tutorial

28 Jun

sorry this blog is deprecated. visit full article here.

http://zendgeek.blogspot.com/2009/07/creating-nice-dojo-form-in-zend.html

Well, after writing few separate article about Zend Framework and dojo, I feel that I’d need to write a complete Zend_Dojo_Form. So here I am with complete example.

I am going to explain everything step by step.

1. Download Zend Framework latest version

Download least stable version from http://www.zend.com. Copy external/dojo to js/.

Hopefully you will create your directory structure as

html_root

/application

/controllers

DojoController.php

/models

/forms

CustomDojoForm.php

/views

/scripts

/dojo

index.phtml

/libaray

/Zend

/public

/js

/dojo

/css

/images

/bootstrap.php

/index.phtm

It’s not compulsory to create the similar directory structure I have created, this can vary. For best practice read Zend Quick start from Zend Framework documentation.

2. Enable dojo in the bootstrap file

I am not going to discuss everything you will need to have in your bootstrap file. I am explaining only the line of code needed to enable dojo.

Advertisements

Zend Framework Form: A simple but complete Zend_Form sample/tutorial

27 Jun

A sample application can be found here“.

Sorry this blog is deprecated.

“Please read complete tutorial here.” http://zendgeek.blogspot.com/2009/07/zend-framework-formzendform-tutorial.html

I got “The Zahir”, a novel by Paula Coelho about a month back, very sweat one and highly intrigued. It was highly entertaining and most importantly author shared his experiences in a nice way. I learned plenty of new ideas.

Eh, you may think that I am insane, supposed to write about Zend Framework, but discussing a novel.

Well, novel can not only be a good companion of yours, but it also put shade of light on simple things from many angles. This make you think dynamically.

If you are solving a puzzle or implementing your logic, do not think straight forward, give multiple tries and chose a more appropriate solution. Solving a problem will not be hard. You should chose a solution that require less code, small maintenance overhead and most importantly one that will be less resource intensive.

Now lets stick to the topic and discuss how you can use Zend_Form component for creating html form easily, handling filters and errors messages and how to see how easily you can fetch data from the data source and present that in html form and let the visitors change/modify the existing data and save changes to the data source.

I am gona break this topic in three steps.

1. Creating Zend_Form

Although I’ve already discussed creation of Zend_Form in some of my articles but it will be better to discuss it here again.

Creating Zend form is simple is this.

<?php

class CustomForm extend Zend_Form

{

public function init()

{

}

}

defined a class by extending it from Zend_Form. This allow access to many of methods already defined in Zend_Form.

The only thing you need to do is to override init() method and create your own element such as input box, select statement, checkboxes, radio buttons and so on.

Sorry this blog is deprecated.

“Please read complete tutorial here.” http://zendgeek.blogspot.com/2009/07/zend-framework-formzendform-tutorial.html

Zend Framework : basic configuration

1 Feb

Zend Framework Quick Start (click for ppt presentation)

After writting seperate articles on different Zend Framework topics I recieved many email from newbie asking me to write an article on how to make initial configuration.

Although this must have been done in the beginning however its never to late. Clikcing the above link you will find a powever point presentation where i have discuss what are design patterns, especially MVC design patterns, how to make initail directory structure, bootstrap file and a simple hello world example.

I have made all these things as simple as possible for beginners.

Although it is not necessary to learn design patterns for working in the Zend Framework however it will better to have a atleast basic idea of some conceptual topics like design pattern and object oriented programming.  This will enable you to get most benefits out of the Zend Framework.

Beside giving definition of design patterns i have given an example of the directory structure and most importantly the bootrap file. 

This is the minimal code require in the bootstrap file for working with Zend Framework MVC.

I haven’t discussed topics like how to make database configuration, configuration for two step view and how to add helpers to you Zend Framework application. This is becuase when you will get used to the minimal difinition you will be able to learn how to make extra configuration in future.

And finally I have developed a simple “hello world” example for better understanding of how controllers and views work togather. You will also find an example of how to use models in your application.

Zend Framework Tutorial- simple signup and login authentication

17 Jan

After writing separate articles on different Zend framework topics, its now time to write a full fledge tutorials. I am starting from a simple sign up and login authentication example and hopefully will discuss some advance topic in future.

So lets get started.

First create a table in your database by executing the following sql query.

CREATE TABLE ‘users’ (

‘id’ int(11) NOT NULL auto_increment,

‘firstname’ varchar(100) default NULL,

‘lastname’ varchar(100) default NULL,

’email’ varchar(255) NOT NULL,

‘username’ varchar(100) NOT NULL,

‘password’ varchar(15) NULL,

PRIMARY KEY  (‘id’)

)

Next create a model against this table in your application/model/ directory. I am creating Users.php and writing the following code in it.

<?

class Users extends Zend_Db_Table

{

protected $_name=”users”;

}

?>

Now create a controller named AuthController.php in application/controllers/ directory and place the following code in it

<?

class AuthController extends Zend_Controller_Action

{

public function loginAction()

{

}

public function signupAction()

{

}

public function logoutAction()

{

}

public function homeAction()

{

}

}

?>

Sorry this blog is deprecated.

“Read new version of this article here”.http://zendgeek.blogspot.com/2009/07/zend-framework-sign-up-and.html