How to create correct reference with parameters in view in Zend Framework

Hi I'm new to Zend Framework 1.12. I want to create a link that simulates the same result than when the form is submitted in the Get method.

When I submit my form the generated url mysite.com/mymodule/mycontroller/myaction?steps%5B%5D=3

How can I create this link in the view except in this ugly way:

<a href="<?php echo $this->baseUrl('mymodule/mycontroller/myaction?steps%5B%5D=3'); ?>">
    My link
</a>

      

Maybe by passing an array to something like this?

+3


source to share


2 answers


You can try this:

$this->url(array('action'     => 'myaction', 
                 'controller' => 'mycontroller', 
                 'module'     => 'mymodule', 
                 'steps[]'    => 3));

      



$this->url()

is a Viewer

+1


source


Here's a small solution to avoid using% 5B% 5D.



<a href="<?php echo $this->baseUrl('mymodule/mycontroller/myaction?'.urlencode('steps[]').'=3'); ?>">
    My link
</a>

      

0


source







All Articles