BAD_SEED
BAD_SEED

Reputation: 5086

CAKEPHP: Completely different behaviour for an online webapplication

I have a link like http://www.myweb.it/people/add/ when execute I have problem about non-existent add view and json:

Error: The view for PeopleController::add() was not found.

Error: Confirm you have created the file: /var/datas/httpd/vhosts/myweb.it/demo/htdocs/0.4/app/View/elements/json.ctp

The problem is that imported file are correctly handled in local. This is the entire people controller:

<?php
class PeopleController extends AppController {
    var $name = 'People';
    public $components = array('RequestHandler');
    public $helpers = array('Html', 'Form');

        public function add() {
        $this->autorender = false;

        if ($this->request->is('post')) {
            if ($this->Person->save($this->request->data)) {
                $this->set('return', 'I dati sono stati salvati.');
            } else {
                $this->set('return', 'Non è stato possibile salvare i dati.');
            }
        }

        $this->layout = 'void';
        $this->render('/elements/json');
    }

    public function getPeopleByName(){
        $people = $this->Person->getPeopleByName($_GET['name']);
        $this->set(array(
            'People' => $people,
            '_serialize' => array('People')
        ));
    }
}

Any idea?

Upvotes: 0

Views: 95

Answers (1)

dhofstet
dhofstet

Reputation: 9964

I think $this->render('/elements/json'); should be $this->render('/Elements/json');, at least if your element is placed in CakePHP's default location for elements, which is app/View/Elements.

Upvotes: 2

Related Questions