redirect() question |
[eluser]ellipsis[/eluser]
I have a function in a controller that is used by two separate views because the link sends to that function.. that's beside the point. The point is that at the end of that function i have a redirect('page' 'Location); which is just fine when the user performs the action on that specific page, but when he performs it from the other page that uses this function it obviously sends him to 'page'. Is it possible to tell redirect to go to whatever page it was on? or just specify with some if statements where to go? I tried using ajax to do this, but had absolutely no luck with the link_to_remote function because I can't understand how to concatenate strings to the location and I've seen topics open on the same issue that nobody has replied to.
[eluser]tomcode[/eluser]
Either You add a segment in the views' link, and trigger the redirect based on that segment in Your controller function. If not possible You can use flash data User Guide | sessions
[eluser]ellipsis[/eluser]
That was a great suggestion about using flashdata :lol: Thanks. One question about flashdata, though... in the user guide is says it lives until the next server request, but does it get added to the database every time as well? Because I have database enabled with sessions.
[eluser]tomcode[/eluser]
Yes, it's serialized together with the other session data. Just one comment : I try to avoid sessions when possible : 1. not 100 % of all Your visitors have cookies enabled 2. sessions tend to cause problems So, if You can, I'd recommend You using the segment solution. |
Welcome Guest, Not a member yet? Register Sign In |