Sunday, April 21, 2013

YII set and get flush message

In controller: 
Yii::app()->user->setFlash(
    'Message00', //a string for key usage
    'This is msg from controller.'
);
 
In view: 
if(Yii::app()->user->hasFlash('Message00')){
    echo '<div class="flash-success">';
    echo Yii::app()->user->getFlash('Message00');
    echo '</div>'; 
}

No comments:

Post a Comment