Welcome Guest, Not a member yet? Register   Sign In
Default Method in Controller (... index() ... ? )
#1

[eluser]beneck[/eluser]
I am having a little bit of trouble accessing a method and I am out of idea.

The method is called index() and it's in a Controller called Screen.

I can access the file correctly via:
http://site/screen/index

However, if I do not want to have to put the "index" on there, and I try to access it (assuming the default index() method will be called) by typing
http://site/screen

I get a bunch of CI errors followed by a 404 Page.

Is the index() method called by default if no method is put in the URL?

Here is my controller file
Code:
class Screen extends CI_Controller
{
   public function __construct()
   {
      parent::__construct();
   }

   public function index()
   {
      $this->load->view('screening/index');
   }
}

Here is my .HTACCESS file (perhaps I do not have the property code?)

Code:
RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]


Messages In This Thread
Default Method in Controller (... index() ... ? ) - by El Forum - 09-03-2013, 10:38 AM
Default Method in Controller (... index() ... ? ) - by El Forum - 09-03-2013, 01:00 PM
Default Method in Controller (... index() ... ? ) - by El Forum - 09-03-2013, 05:16 PM
Default Method in Controller (... index() ... ? ) - by El Forum - 09-03-2013, 10:36 PM
Default Method in Controller (... index() ... ? ) - by El Forum - 09-04-2013, 10:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB