Welcome Guest, Not a member yet? Register   Sign In
Change controller class property
#8

[eluser]jedd[/eluser]
[quote author="yabune" date="1258931912"]
What I would like to pass to the show function is any error I would get in uploading a file, so that I can show a div displaying the error.
[/quote]

Ahh, okay. What most people do here is set some [url="/user_guide/libraries/sessions.html"]flash data[/url].

I'm in two minds about flash data. It's very handy, certainly, but the occasional redirect here and there, having to track that and do the odd keep_flashdata() call, and the fact you can't seem to test for its presence on the same run that you set it (I think?), often makes it a bit frustrating. Instead I tend to just stick with normal session data, and just remove (unset) it when I use it.

Anyhoo, in the place that you generate the error - pop some session data in with whatever you need to know later. Later, when you come into your page, check for the presence of that session data, generate whatever view partial with the <div> stuff you need, feed this into your main view, and unset the session data.

Easy.

Quote:Is it good practice to pass an error description with the url? Isn't too much information?

No, you're right - this kind of ephemeral data should not be in the URL.

Quote:If I don't redirect, and call the show function as you mentioned, can I change the url in the browser to http://.../show?

Changing URL's from within a page is not possible (exception being javascript's ability to change anything after the #) and for good reason - huge security hole if you could do that.


Messages In This Thread
Change controller class property - by El Forum - 11-22-2009, 08:27 AM
Change controller class property - by El Forum - 11-22-2009, 09:22 AM
Change controller class property - by El Forum - 11-22-2009, 09:25 AM
Change controller class property - by El Forum - 11-22-2009, 09:33 AM
Change controller class property - by El Forum - 11-22-2009, 10:50 AM
Change controller class property - by El Forum - 11-22-2009, 11:10 AM
Change controller class property - by El Forum - 11-22-2009, 11:18 AM
Change controller class property - by El Forum - 11-22-2009, 11:33 AM
Change controller class property - by El Forum - 11-22-2009, 12:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB