• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not sure why my controller is getting called

#1
[eluser]codeigniterzzz[/eluser]
Here is my route for the controller:

Code:
$route['gotopage'] = 'general/gotopage';

The controller file is located here:

application/controllers/general/gotopage.php

Here is the code in the controller file:

Code:
<?php

if (!defined('BASEPATH'))  
    exit('No direct script access allowed');

class Gotopage extends CI_Controller
{  
    public function __construct()  
    {  
        parent::__construct();  
    }
    
    public function index()
    {  
        this->load->view('index');  
    }
}
?>

for some reason codeigniter is throwing the 404 page not found error.

I have no idea what I'm doing wrong...

#2
[eluser]nencor[/eluser]
have you create the views for index.php ?

#3
[eluser]codeigniterzzz[/eluser]
yes i have. and teh file is called index.php and is in the views directory.

application/views/index.php

#4
[eluser]CroNiX[/eluser]
Your route is saying "if the request is for /gotopage, send it to the general controller/gotopage method".

So, you're sending the request to the "general" controller, which doesn't exist.

#5
[eluser]codeigniterzzz[/eluser]
ok...so how should i correct my routes, directories, files, class names?

#6
[eluser]Aken[/eluser]
Your example should be okay - it should find the controller in the subdirectory just fine. Can you access the general/gotopage controller directory (without routes)? Verify that you can do that first.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.