php - Zend view url function issues -


first i'd admit didn't enough searching because didn't know how put in words fit search. 'getting clean urls in zend' or 'ignore comes after action in zend' can't name well, sorry this. guide me duplicates, i'll delete @ once :>

now, story goes this:
let's in pageproject/public/home i've got link

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

that me project/public/home/test/index (index omitted default)

let's link parameter

<a href="<?php         echo $this->url(array(             'controller' => 'message',             'action' => 'add',             'id' => 1//some value or parameter         ));         ?>            ">                <?php echo $this->translate('go_to_add_message'); ?> </a>   

that take me project/public/home/message/add/1 till understand issue appears when try go

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

as far know should take me project/public/home/test/index instead project/public/home/test/index/id/1 (index not omitted) test/index page displayed id parameter wrong there

what proper name of problem? what's causing it? missing parameter of url? pointers on how fix it?

thanks lot in advance

duplicate of stackoverflow question

documentation referenced there zend view helpers

use reset option in url view helper shown below.

<a href="<?php         echo $this->url(array(             'controller' => 'test',             'action' => 'index'         ), null, true);         ?>            ">                <?php echo $this->translate('back'); ?> </a> 

and here few more tips generating urls.

  1. create virtual host , point projects public directory.
  2. use baseurl helper generate absolute urls.
  3. create routes , generate urls using routes.

hope helps.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -