1

Is there a way to don't generate the layout, but write our something with echo? (Like a blank page with some text on it)

Or is there a way to get magento to not send any headers?

I have this because I would load this controller with ajax:

$this->getResponse()->clearAllHeaders();
header("Access-Control-Allow-Origin:*");

If I just simple echo some text, then I will get the following error:

2016-01-21T11:56:10+00:00 DEBUG (7): HEADERS ALREADY SENT:
[0] /www/htdocs/w0114ce0/www/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /www/htdocs/w0114ce0/www/lib/Zend/Controller/Response/Abstract.php:773
[2] /www/htdocs/w0114ce0/www/app/code/core/Mage/Core/Controller/Response/Http.php:84
[3] /www/htdocs/w0114ce0/www/app/code/core/Mage/Core/Controller/Varien/Front.php:184
[4] /www/htdocs/w0114ce0/www/app/code/core/Mage/Core/Model/App.php:365
[5] /www/htdocs/w0114ce0/www/app/Mage.php:684
[6] /www/htdocs/w0114ce0/www/index.php:83

2016-01-21T12:08:03+00:00 DEBUG (7): Cannot send headers; headers already sent in /www/htdocs/w0114ce0/www/app/code/local/Mxsxs2/MyWidgets/controllers/IndexController.php, line 62

Exapmle code:

  public function indexAction(){
      echo("some text");  
  }

1 Answer 1

5

You must use $this->getResponse()->setBody('your echo');

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.