Hello guys,
I have a custom flashSession class with this contructor:
    public function __construct()
    {
        parent::__construct();
        $this->setAutomaticHtml(false);
        $this->setImplicitFlush(false);
    }I want to assing message to the view, so they can be used in a javascript environment. This is how i am doing it:
    public function beforeExecuteRoute(\Phalcon\Mvc\Dispatcher $dispatcher)
    {
        $flash = array();
        foreach ($this->flashSession->getMessages() as $message) {
            $flash[] = $message;
        }
        $this->view->flashMessages = $flash[0];
    }View:
<html>
...
<script>
var app = {
    //...
    'flashMessages' : []
    //...
};
{% if flashMessages %}
    {% for message in flashMessages %}
        app.flashMessages.push("{{ message }}");
    {% endfor %}
{% endif %}
</script>
</html>I need to know the type of the message (error, alert, success, etc), so i can render the correct JS flash method notification.
- The output of the messages, are raw text, not html formatted. And i don't want to use the HTML format.
Any thoughts ? Thanks.