flashdata and views inside views

#1
[eluser]xatrix[/eluser]
Is loading a view inside another view considered a server request?

I'm testing something and I've noticed that the flashdata is kept when I load the view without any included views. Everything fine here. But if that view were to include anything else, for example a header/footer view, the flashdata is lost. Why?

#2
[eluser]Cristian Gilè[/eluser]
Hi xatrix,

flashdata are a type of session that will only be available for the next server request, and are then automatically cleared. For example, after a redirect. Including a view inside another view should not be a problem.

Please, paste here a reduction code of your controller and views.


Cristian Gilè

#3
[eluser]xatrix[/eluser]
Ninja edit: By whatever personal mistake or technological magic, things seem to be working now. Also a way to debug flashdata is to output it in your views as

Code:
<?php $v = $this->session->flashdata('referrer'); echo $v; $this->session->set_flashdata('referrer', $v); ?>

#4
[eluser]InsiteFX[/eluser]
If it makes more then one request you need to use keep_flashdata

InsiteFX

#5
[eluser]Cristian Gilè[/eluser]
Your referrer session is not much reusable and you have had to modify ion_auth class while you can use a hook like this

Cristian Gilè

#6
[eluser]xatrix[/eluser]
Hey thanks for the replies guys. As stated in my (unedited) second post, I was using keep_flashdata, but the problem was some weird browser caching bug. I cleared the cache and everything is ok now. And as to my modifying Ion Auth for redirecting the referrer, I agree it's not very reusable. It was just a placeholder. I think a better solution is to have a hidden field inside your form that stores the referrer page.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.