URL not found in Cakephp

Asked

Viewed 24 times

0

I’m using Cakephp’s Bake to facilitate development, I’ve analyzed the Models and Controllers it generated and they’re okay. Follow line of index method in one of the controllers.

public function index() {
    $this->Category->recursive = 0;
    $this->set('categories', $this->Paginator->paginate());
}

When I open in the browser gives error 404 NOT FOUND.

I followed some tutorials and activated the mod_rewrite but it didn’t work.

Cakephp version is 2.3.1, also tested in 2.9.8.

1 answer

0

On the index just do

**Public function index(){
(E ao acessar a index ele pede para vc criar uma View e em seguida crie uma função de paginate separada)
}**

You’re doing it this way :

public function index() {
    $this->Category->recursive = 0;
    $this->set('categories', $this->Paginator->paginate());
}

Is spending a $this->set on 'Categories' is setting to consume in a View more in fact who is categories, he does not understand it tries to pass like this:

**public function index() {
    $categoria = $this->Category->recursive = 0;
    $this->set('categoria', $categoria);
}**

Here I am passing that variable $categoria contains $this->Category->recursive = 0; then I insert this variable with a name to consume in another CTP.

Browser other questions tagged

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