flashSession and output conditions

Hi,

I'm trying to make a flashSession to output some error messages ... Everything goes well with the $this->flashSession->output(); in my view but i want to control with a condition whether there's a set flashSession because i'm stylizing it before I output the errors.

It looks like ...

        <? if ($this->flashSession->output()): ?>

        <div class="spacer1"></div>
        <div class="col-md-10 col-md-offset-1">

        <?= $this->flashSession->output(); ?>

        </div>
        <div class="clearfix"></div>

        <? endif; ?>

I tried to add a !== NULL but it doesn't work either ... How can I get a boolean reply for my condition ?

Also, how to use the Volt syntax with these sessions ? I saw a session.output() but it seems it's not dedicated to the flash sessions, but maybe i'm wrong.

Thanks guys ;)

Note : I know I can add some styles to the output in the Session configuration but for some reasons i'm forced to do it this way ...

+1 i got the same problem

Hi,

Someone helped me on your IRC channel so I give the solution in case another guy got a similar problem ...

        <? if (count($this->flashSession->getMessages(NULL, FALSE)) > 0): ?>

        <div class="spacer1"></div>
        <div class="col-md-10 col-md-offset-1">

        <?= $this->flashSession->output(); ?>

        </div>
        <div class="clearfix"></div>

        <? endif; ?>

getMessage() let you know what are the exact messages that were saved and the FALSE parameter force the system to keep the datas in. You just have to count() and check if the result isn't 0.

I still didn't find a Volt version of these lines, I'd repost here if so ! Thanks ;)