i trying send error message controller view. tried use http://www.yiiframework.com/wiki/21/how-to-work-with-flash-messages/ flash message not arriving. redirecting incorrectly?
crudcontroller.php
// execution reach here. yii::app()->user->setflash('success', "data saved!"); $this->redirect(array('crud/admin', 'id' => $currentuser->id));
admin.php aka view
<?php if(yii::app()->user->hasflash('success')):?> <div class="info"> <?php echo yii::app()->user->getflash('success'); ?> </div> <?php endif; ?>
so how send message view? want show message user, don't care how except conditional check happens in controller not view.
after var_dump(yii::app()->user)
object(cwebuser)#21 (14) { ["allowautologin"]=> bool(true) ["guestname"]=> string(5) "guest" ["loginurl"]=> array(1) { [0]=> string(11) "/site/login" } ["identitycookie"]=> null ["authtimeout"]=> null ["autorenewcookie"]=> bool(false) ["autoupdateflash"]=> bool(true) ["loginrequiredajaxresponse"]=> null ["_keyprefix":"cwebuser":private]=> string(32) "a68200d8b7c100a1634ae9aa04a6e79e" ["_access":"cwebuser":private]=> array(0) { } ["behaviors"]=> array(0) { } ["_initialized":"capplicationcomponent":private]=> bool(true) ["_e":"ccomponent":private]=> null ["_m":"ccomponent":private]=> null }
i have same problem, in case use tbalert (yiibooster). problem php version below 5.4 check php version?
Comments
Post a Comment