New to CI - View will not display - 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: New to CI - View will not display (/showthread.php?tid=55475) |
New to CI - View will not display - El Forum - 10-28-2012 [eluser]Unknown[/eluser] Hello all, I have this issue with a view that comes up as a 404 error. I am working on login authentication and I was doing really well until this problem. Basically what I do is get the information from a form, compare it to the DB and is there is a match I show a view. This view is the one the will not work. Here is the code: My controller: Code: class Login extends CI_Controller { The varianble $authentication does get set to true so I redirect to the application.php controller which looks like this: Code: class Main extends CI_Controller { And the application_view.php which looks like this: Code: This is the members only area! Any help will be greatly appreciated. New to CI - View will not display - El Forum - 10-28-2012 [eluser]vitoco[/eluser] The first problem that i see, it's that the redirection path it's wrong, your are telling CI redirect to controller "application" and method "main" Code: redirect('application/main'); but it must be controller "main" method "main" Code: redirect('main/main'); Second, the "main" function in "Main" controller it's the constructor, so it's called every time when you call a method of that class, and that can be a problem later, i think it will be better to change the function name to something different. New to CI - View will not display - El Forum - 10-28-2012 [eluser]Unknown[/eluser] [quote author="vitoco" date="1351456018"]The first problem that i see, it's that the redirection path it's wrong, your are telling CI redirect to controller "application" and method "main" Code: redirect('application/main'); but it must be controller "main" method "main" Code: redirect('main/main'); Second, the "main" function in "Main" controller it's the constructor, so it's called every time when you call a method of that class, and that can be a problem later, i think it will be better to change the function name to something different. [/quote] I love you. I got mixed with the file name as it is still muddy to me how CI finds the files it needs. But that is for another post. Thanks. |