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:
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:
<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:
Similarly you can create more action/scripts and can make links among them.
Recommend the tutorial