Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP - Controller without View & Model

Tags:

cakephp

How do I create a controller with no view and model?
Making a services_controller to spit out json.

This is what I have now.

var $uses = array();

function test() {
    $this->autoRender = false;
    echo "test";
}

However, that doesn't print out the "test" message.

Thanks,
Tee

like image 912
teepusink Avatar asked Apr 14 '11 21:04

teepusink


2 Answers

The above code actually works. The issue was somewhere else related to the Auth component.

Thanks,
Tee

like image 154
teepusink Avatar answered Sep 28 '22 04:09

teepusink


Just write $this->autoRender = false; at the end of the function. It will surely work.

like image 27
Devendra Soni Avatar answered Sep 28 '22 04:09

Devendra Soni