Cómo quitar los parámetros utilizados de la url?
-
09-10-2019 - |
Pregunta
Estoy usando Zend Framework y la URL Ayudante de Vista para crear direcciones URL
Tengo algunas líneas como esta en mi navegación:
$this->url(array('controller' => 'index', 'action' => 'index'))
$this->url(array('controller' => 'who', 'action' => 'view', 'id' => $row->who_id));
$this->url(array('controller' => 'projects', 'action' => 'view', 'id' => $row->mai_id));
$this->url(array('controller' => 'content', 'action' => 'view', 'type' => 'theater', 'id' => $row->the_id));
$this->url(array('controller' => 'shows', 'action' => 'view'));
De esta manera, en un primer momento, tengo una URL como esta ??p>
http://ccgss.local/information/location
http://ccgss.local/who/view/id/1
Pero cuando accedo a otro enlace con más parámetros como http://ccgss.local/content/view/id/1/type/theater
ya que se rompe con los parámetros que todavía estaban allí: http://ccgss.local/who/view/id/1/type/theater
Es decir, los parámetros no limpian cuando accedo a otra página.
¿Cómo puedo solucionar esto?
Solución
You need to reset parameters when calling url
helper.
$this->url(array('controller' => 'index', 'action' => 'index'), null, true);
The second argument is the name of the route to use. Keep it null
if you want to use the current route.
The third argument tells whether or not to reset parameters. It's false
by default.
So, just set it to true
to get rid of existing parameters.