Reputation: 5716
I am having a link to go to update screen and in the update screen a back button to load the index.
*current url is * http://sample.com/demoZend/public/index/ when i click a post, i take it to this URL, http://sample.com/demoZend/public/index/update/id/1
now there is a button in this view to go back to index.
<?php
$this->title = "Update post";
$this->headTitle('Update Post');
echo $this->form;
?>
<a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index')); ?>">Go Back</a>
the problem is, when back button is clicked it goes here, http://sample.com/demoZend/public/index/index/id/1 instead of http://sample.com/demoZend/public/index/index/
This param id is still remaining. id/1 how this param can be removed and make the url to be public/index/index/
I am newbie to zend framework. so this must be a tiny thing for someone who work with zend.
Upvotes: 0
Views: 696
Reputation: 3928
Use the Reset Parameter on the Url Helper, to reset all params
function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true)
echo $this->url(array('controller'=>'index', 'action'=>'index'), null, true);
Upvotes: 1