Welcome Guest, Not a member yet? Register   Sign In
Beginner question; 404 Page Not Found!
#1

[eluser]cehennem[/eluser]
Hey there,

I've just set up the CodeIgniter package from its original.

But this controller shows me "404 Page Not Found" thing of code-igniter:

Code:
<?php
class Login extends Controller {

        function Login()
        {
            parent::Controller();
                        echo 'hey there';
        }
}

Nothing changed from config or routes files.

ps; I compared my controller with welcome.php, the only difference is welcome.php has a index() function that my controller hasn't. whats the use and need of index(), whats difference between index() and classname ie. Login() ?
#2

[eluser]InsiteFX[/eluser]
Did you change the application/config/routes.php default controller ?

The controller defaults to calling the index function, otherwise you
need to specify it controller/method

InsiteFX
#3

[eluser]techgnome[/eluser]
When there is a function of the same name as the class... in this case "Login" it runs when the class is created - or in this case, when the controller is invoked... The index function is called by CI when you invoke the controller with no method name... It's what is called a default method. Since you don't have one, any call to that controller will result in a 404.

-tg
#4

[eluser]Dennis Rasmussen[/eluser]
And just to make sure you get it.
You need an index() function as well if you're just gonna call the Login controller without a method (domain.com/login/).
#5

[eluser]cehennem[/eluser]
Thanks for all answers! Wink
#6

[eluser]Davva[/eluser]
Thanks, solved my problem too!
#7

[eluser]dimas ts[/eluser]
I also got page not found, i use ubuntu 10.10, when i open in wins it works perfectly but not work in ubuntu 10.10, mod_rewrite has been loaded

anyone?




Theme © iAndrew 2016 - Forum software by © MyBB