loading a view and redirecting - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: loading a view and redirecting (/showthread.php?tid=4790) |
loading a view and redirecting - El Forum - 12-16-2007 [eluser]AtlantixMedia[/eluser] Hi, in my previous procedural projects when I needed to show a message to the user (no results found, no user by that name, etc) I would send a Code: echo "<meta http-equiv='refresh' content='3;URL=" . $URL . "'>"; echo whatever message, and the user would be redirected to xyz page after 3 seconds. how would I implement something like this with CI? how can I incorporate a refresh after x number of seconds after I loaded a view with the relevant message? thanks in advance loading a view and redirecting - El Forum - 12-16-2007 [eluser]Lovecannon[/eluser] This would work: Add a <?=refresh?> in the head of your view, and if you need to redirect: Code: $data['refresh'] = "<meta http-equiv='refresh' content='3;URL=" . $URL . "'>"; loading a view and redirecting - El Forum - 12-17-2007 [eluser]AtlantixMedia[/eluser] great! thank you very much. loading a view and redirecting - El Forum - 12-17-2007 [eluser]sandwormusmc[/eluser] I've done this with JavaScript ... that way I can point a hidden form element to a specific CI function and check the post variables. It may not the best way to do it, but it works for me, and allows me to specify actions in my header files. Here is some code: Main header file: Code: <!--- Process login view, loaded when the user successfully authenticates: Code: <?=$header?> |