Home Tutorial Php Zendframework ZF Transfer Control

 
 

ZF Transfer Control
Posted on: April 26, 2010 at 12:00 AM
Advertisement
This is a very common activity in web site development that we need to transfer controls from one page to another. In this tutorial we will do the same.

How to transfer control from one page to another, in ZF:

This is a very common activity in web site development that we need to transfer controls from one page to another. In this tutorial we will do the same. As we know that in MVC model every page is known as action, to redirect from one page (action) to another page we need to create pages, so at first let's create the pages:

We will create the pages under controller folder, to do this open the command prompt and type the following commands:

ZF_Create_Action

Now as the output indicates that the command has created one action called redirect in the IndexController.php file and one phtml file is created in the index folder and both the entries has been updated in zfproject.xml file.

Now open the index.phtml file and paste the following code:

<?php

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

<a href="<?php echo $this->url(array('controller'=>'index','action'=>'redirect'));?>">Redirect</a>

After refreshing the web page we will get one hyperlink as Redirect, if you click on the link we will move to another page, which has the following content:

View script for controller Index and script/action name redirect

address bar will show the address as:

http://localhost:81/index/redirect.

Similarly you can create more action/scripts and can make links among them.

Advertisement

Related Tags for ZF Transfer Control:


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.

Posted on: April 26, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com