marvix
June 20, 2014, 5:05pm
1
Hi …
I spent few hours to find solution for this but with no success!
I’m implementing this code from this tutorial, but setFlash won’t works … WHY !!
http://www.yiiframework.com/wiki/172/an-easy-way-to-display-a-success-page-using-flash-messages/
Ty.
joblo
(Joe)
June 20, 2014, 6:21pm
2
You can try the extension userflash instead.
marvix:
Hi …
I spent few hours to find solution for this but with no success!
I’m implementing this code from this tutorial, but setFlash won’t works … WHY !!
http://www.yiiframew …flash-messages/
Ty.
Hey What things have you tried? I had some issues with the flash messages. Can you post any code samples and I can try dig up my solution that worked for me.
Cheers!
I will give you a list of the things I did to get it to work. Hope it helps.
In my _form.php partial view file I had his code near the top. I have included the line
<div class="form">
so you can see where abouts.
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message) {
echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
}
?>
<?php
Yii::app()->clientScript->registerScript(
'myHideEffect',
'$(".flash-success").animate({opacity: 1.0}, 60000).fadeOut("slow");',
CClientScript::POS_READY
);
?>
<div class="form">
[b]In my controller under actionCreate and actionUpdate I had:
[/b]
Yii::app()->user->setFlash('notice', "<b>Please note</b>: blah blah blah...");
[b]
[/b]
This worked for me, hope it helps!