We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

flash error

<?php $this->flash->error("this is error"); $this->dispatcher->forward(array( 'controller' => 'index', 'action' => 'index' )); ?> But no error information output is directed to ask me how to do?

output in the view :)

On the view $this->flash->output();

If that still doesn't work, use flashSession instead. I think flash works just on the same page without redirect, not sure about forwarding. View its $this->flashSession->output();, flashSession is already set if you're using the \Phalcon\DI\FactoryDefault(). Otherwise:

$di->set('flashSession', function() {
    return new \Phalcon\Flash\Session();
});


20.5k

On the view $this->flash->output();

If that still doesn't work, use flashSession instead. I think flash works just on the same page without redirect, not sure about forwarding. View its $this->flashSession->output();, flashSession is already set if you're using the \Phalcon\DI\FactoryDefault(). Otherwise:

$di->set('flashSession', function() {
   return new \Phalcon\Flash\Session();
});

Fatal error: Call to undefined method Phalcon\Flash\Direct::output() in

I don't know what causes it, please help and have a look, thank you

for index.php

$di->set('flash', function() {
return new Phalcon\Flash\Direct(array(
    'output'
    'error' => 'alert alert-error',
    'success' => 'alert alert-success',
    'notice' => 'alert alert-info',
));
});

$di->set('flashSession',function() {
    return new \Phalcon\Flash\Session();
});

for controller

public function indexAction() { $this->flash->output("aaaa"); return $this->dispatcher->forward(array( 'controller' => 'family', 'action' => 'index'; )); }



20.5k

On the view $this->flash->output();

If that still doesn't work, use flashSession instead. I think flash works just on the same page without redirect, not sure about forwarding. View its $this->flashSession->output();, flashSession is already set if you're using the \Phalcon\DI\FactoryDefault(). Otherwise:

$di->set('flashSession', function() {
   return new \Phalcon\Flash\Session();
});

I think I a mistake I want to achieve such an effect:

echo "<script>alert('111111')</script>"; return $this->dispatcher->forward(array( 'controller' => 'family', 'action' => 'index' ));

The first pop-up to the error message to the user, and then jump

edited Jan '15

for controller

public function indexAction() {

$this->flashSessiont("aaaa"); <-- use flashSession

return $this->dispatcher->forward(array(

'controller' => 'family',

'action' => 'index';

));

}



20.5k

for controller

public function indexAction() {

$this->flashSessiont("aaaa"); <-- use flashSession

return $this->dispatcher->forward(array(

'controller' => 'family',

'action' => 'index';

));

}

Tip can't find flashSession method I need inside the controller is you use?

Oh, my mistake sorry, that is code error, \Phalcon\Flash\Session is the object, missing the method call there, this is the right one:

$this->flashSession->success("aaaa"); // or ->warning(), ->notice(), ->error()


20.5k

Oh, my mistake sorry, that is code error, \Phalcon\Flash\Session is the object, missing the method call there, this is the right one:

$this->flashSession->success("aaaa"); // or ->warning(), ->notice(), ->error()

Program has an error, but still no output information jump go, I want to achieve before you jump to the user show error message