1

I am trying to display the test data on the screen by running function test() in the pagesController. Used $this->autoRender = false for it, but it is still giving me error:

Please help me out. I think some version problem is there, but I can't figure it out. Thankyou.

ndm
  • 59,784
  • 9
  • 71
  • 110

1 Answers1

0

Cakephp by default takes Pages controller's display actions as a home page. display function manages pages and subpages itself that is why you are getting error. Either you can change your default home page in your /config/routes.php

 $routes->connect('/', ['controller' => 'Pages', 'action' => 'index']);

OR

define your test action in some other controller.

OR

Remove code from display action

class PagesController {
    function display()
    {
        // default controller code here
        // your custom code here
    }
}

Hope this will work.

Sehdev
  • 5,486
  • 3
  • 11
  • 34
  • thanx brother.. I was not knowing that display function was the actual problem. Your first suggestion helped me to get the output. Kudos bro! – Sumeet Mathew Aug 14 '18 at 12:19