3
Mine index.cpt
and Layout.cpt
are empty. But in the browser, my index appears with the contents of my Model:
<?php
class Post extends AppModel {
public $validate = array('title' => array('rule' => 'notEmpty'), 'body' => array('rule' => 'notEmpty'));
}
How to fix this?
What is the URL you are using to access the page?
– bfavaretto
127.0.0.1/Posts/Posts The translation got a little bad, in fact what I meant was that I cleaned my layout, but the content of my model class keeps appearing on my index
– Eliane Tomás
The name of your application is
Posts
, you have aPostsController
and within this, a actionindex()
? It is possible to place the contents of this action? Maybe it’s a problem in the PHP interpreter itself. Some other PHP file (not even in Cakephp) is displayed normally?– Paulo Rodrigues
<?php class Postscontroller extends Appcontroller { public $helpers = array('Html', 'Form', 'Session'); public $Components = array('Session'); public Function index() { $this->layout = 'default'; $this->set('posts', $this->Post->find('all')); }
– Eliane Tomás
I managed to solve it! It was silly, I just commented on the line $this->set('posts', $this->Post->find('all'));
– Eliane Tomás
If you can put the solution below, as an answer, to help those who may have the same problem. It’s a strange problem, never seen it happen before!
– bfavaretto