(CLOSED) - Use of flashdata |
[eluser]gryzzly[/eluser]
Quote:With flashdata, you might be better off assigning it to a variable in your controller, and passing that variable to your view. I don't think it is a good solution, since assigning it to a variable, would force me to check in my template if the variable is assigned or not. A very small loop --> if(isset($bob)){echo $bob;} <-- but unnecessary, since the flashdata key does not require to really exist (if the key:flashmsg is not assigned/present in userdata session, flashdata just not shows it, and does not deletes it from session). If it exists in session, it flashes and deletes. If the value is not assigned, it just waits we pass data to it to play it's role. I'm not sure to be easyly understandable (english is not my mother tong, and i do not have always the right words) ... --- At least, I get it working: http://ellislab.com/codeigniter/user-gui...views.html Quote:Returning views as data Then in controller : Code: // Set a flash message In my template view : Code: <?php echo $this->session->flashdata('flashmsg'); ?> Finally, in the /view/flashmsg/success.php file : Code: <p class="flashmsg success"><?php echo $result; ?></p> Finally i'll probably make a small function to pass automatically the good message to the choosen message-type view. The interest of this method, is that i can send notices, errors, success, etc. with any message i want and in a custom design :o) Perfect for informations (update succes, failure, etc....) to give to the user after he mades any action ! PS : is there a way to "close"/"mark resolved" any message on this forum ? |
Messages In This Thread |
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 03:35 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 03:44 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 04:05 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 04:13 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 05:13 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 05:21 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 06:09 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 06:49 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 07:08 PM
(CLOSED) - Use of flashdata - by El Forum - 03-19-2009, 07:40 PM
|