CodeIgniter Forums
Help with calling views [FIXED] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Help with calling views [FIXED] (/showthread.php?tid=17361)



Help with calling views [FIXED] - El Forum - 04-02-2009

[eluser]NachoF[/eluser]
Say I have a method called delete_piece(), that gets called through the url mycontroller/delete_piece/2 (or any number)... but i have links to that method on different parts(views) of my site, and I want the controller to perform the actions (delete and stuff) and then load the view that called the method in the first place... how would you go about doing that?? help please.


Help with calling views [FIXED] - El Forum - 04-02-2009

[eluser]jedd[/eluser]
Hi NachoF and welcome to the CI forums.

You might want to look at using flashdata.

Have a read about it in the [url="http://ellislab.com/codeigniter/user-guide/libraries/sessions.html"]Sessions page[/url] of the CI manual - it's about 2/3 of the way down that page.

You could either update the flash data on pages where you know you might send the user off to do this delete method (for instance) or else you could set the flash data on all your pages - and then the delete method could test to see if the flash data exist, and if it does it will redirect the user back to where they came from.

Does that make sense?


Help with calling views [FIXED] - El Forum - 04-02-2009

[eluser]NachoF[/eluser]
Interesting, Im gonna try that and report.... also, codeigniter is the best thing ever Smile


Help with calling views [FIXED] - El Forum - 04-02-2009

[eluser]NachoF[/eluser]
Yes, that worked beatifully... thanks man