uri_string() or flashdata problems.. |
[eluser]neph[/eluser]
i'm using a value of $this->session->set_flashdata('lastPage', $this->uri->uri_string()) and setting the redirect url as redirect($this->session->flashdata('lastPage')...i've just started to notice that in various places it redirects to favicon.ico, or a png file, or a .js file, below is an example of what's shown with the debug output and ci_sessions via mysql. for some reason it does 3 updates for the the ci_sessions table, the last of which has the correct ur_string value. i've validated my xhtml on each page involved...not quite sure what could be causing an intermittent issue like this...any help would be appreciated it. * the example below shows session->userdata instead of flashdata, both have the same effect* Code: DATABASE: sfs QUERIES: 6
[eluser]haydenp[/eluser]
neph I was getting the same last night when I was testing some code. I needed to keep track of the current url so as to offer the user a "Return to previous page" link on the next page. I was setting the flashdata in the usual way and setting its value to ... current_url() On the next page, my "Return to previous page" link was there but had a lot of "extra" bits added on to the end of the url??? Were you able to get to the bottom of this?
[eluser]haydenp[/eluser]
FYI Just seen this ... forum post I had the profiler running when I was getting the error, switched it off and the flashdata was working 100% again. If I switched the profiler back on I would get things like "site_assets/images/site/icon_footer.gif.html" added to the end of the return url?
[eluser]haydenp[/eluser]
Mmmmm ... after a lot of trial and error I have now "fixed" this. I noticed that the "icon_footer.gif" it was adding to the return url in the flashdata related to an image within the markup of the page AND ... no matter where I put this image within the markup it would always append it to the return url set in the flashdata. If I removed the image tag from the markup it would not be added to the return url set in the flashdata. The markup in question: Code: <div class="footer_icon"><a href="#"><img src="assets/images/site/icon_footer.gif" alt="" /></a></div> So how did I resolve this? It was as simple as replacing the relative image path with its absolute path ... and bingo, the return url I was setting in my flashdata was no longer appending "rubbish" to the end of the url. Code: <div class="footer_icon"><a href="#"><img src="http://www.mysite.com/assets/images/site/icon_footer.gif" alt="" /></a></div> NOTE: This is WITH the profiler running on the page, so it is not "profiler" related as far as I can tell. Conclusion There must be a a bug somewhere in CI relating to relative/absolute paths and flashdata? |
Welcome Guest, Not a member yet? Register Sign In |