The content Model appears in my index when using cakephp

Asked

Viewed 76 times

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?

inserir a descrição da imagem aqui

  • What is the URL you are using to access the page?

  • 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

  • The name of your application is Posts, you have a PostsController and within this, a action index()? 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?

  • <?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')); }

  • I managed to solve it! It was silly, I just commented on the line $this->set('posts', $this->Post->find('all'));

  • 1

    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!

Show 1 more comment
No answers

Browser other questions tagged

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