I'm creating a simple CRUD for adding links to a category. Each category has an id. I have a view that lists all the links for a certain category. In that view I have a link to the add-form which is:
http://example.com/link/add/categoryId/3
I currently build that link in the view using the following syntax.
<?php echo $this->baseUrl();?>/link/add/categoryId/<?php echo $this->category['id']; ?>
I think this can be done cleaner by using the Url View Helper.
<?php echo $this->url(array('controller'=>'link','action'=>'add','categoryId'=>$this->category['id'])); ?>
But that gives me the following url
http://example.com/link/add/id/3/categoryId/3
..which has an extra "id/3". I read but did not fully understand the code of the Url View Helper. How come there's an extra id/3 in there?
Thanks!
@Fge gave the correct answer, below is my updated complete syntax.
echo $this->url(array('controller'=>'link','action'=>'add','categoryId'=>$this->category['id']),null,true);