Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

No echo output in browser?


I am new to phalcon and probably going to ask allot of questions here.

I have used phalcon devtools to create a project skelleton.

And did some testing in the indexAction(){} from the indexController.

my index controller looks like:

 class IndexController extends ControllerBase


    public function indexAction()





and index.volt looks like:

 <!DOCTYPE html>



        <title>Phalcon PHP Framework</title>



    <?php echo $this->view->getContent(); ?>

        {{ content() }}



I know this way I am getting double the content. But this is for debugging. The output I get is:

I am using chrome browser for testing, and ubuntu server 12.04 for phalcon 1.3.0


You must use exit(); after echo to see the message


HI You can use $this->view->disable()

you cannot echo from controller due to output buffering. will see output if put ob_flush() after line. if you are using incubator and have debug service set, you can do "$this->debug->dump($var)" if you want to debug quickly

edited Apr '14

When I used: $this->view->disable(); the output is getting on my screen including the main volt layout 'layer'

But when I remove the line: $this->view->disable();

Nothing on echoing is getting outputted.

This is because:

Phalcon uses its first layout 'layer' as viewdir/index.phtml/volt

Second it searches for the layout that matches the controller (and action) its name.

On the first layour 'layer' with volt language you can use : {{ content() }}

to output the second layout 'layer'. That is what it did. But because I didn't use {{ content()}}

on he controllers layout 'layer' nothing that is outputed through the controller code is getting on the screen

But when using {{content()}} on the second 'layer', you probably will get the output. It works for me.

I hope this will help others too.

Additional info: <?php echo $this->getContent() ?> is the same as volt's {{ content() }}