Redirect cakephp

Asked

Viewed 42 times

1

I created an action, in which, when clicking an icon on the page, it calls this action and in itself has a redirect to the page itself. The problem is you’re not doing this redirect.

Action:

public function limpar_criterios(){
    return $this->redirect('/intercambio/pesquisa_nova');
}

Link that makes the call:

<a href="/limpar_criterios/inglês"><img src='/img/bandeiras/small_45x31_1.jpg' width="39" height="31" /></a>

1 answer

2


The problem with your link is that the controller is clear criteria and the action is english when in fact the clear criteria is the action. Note: Try not to use accents in url’s.

Create the link using Htmlhelper cakephp:

$this->Html->link(
    $this->Html->image('bandeiras/small_45x31_1.jpg', 
        array(
            'alt' => 'Imagem',
            'width' => '39',
            'height' => '31'
        )
    ),
    array(
        'controller' => 'NOME_DO_CONTROLADOR',
        'action' => 'limpar_criterios'
    ),
    array('escape' => false)
);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.