views:

32

answers:

2

Ok I have adopted a CodeIgniter Setup,

My route.php in config looks like this:

$route['default_controller'] = "development";

My development.php controller looks like this:

class Development extends Controller
{

function Development() {

parent::Controller();

}

public function Index() {

    $this->load->view('index');

}
function show() {

    $this->load->view('show');

}
}

When I go to the root folder, in my browser, it does load the index.php view, I want to make a link to show.php which is also in my Views dir. the URL I'm using is eg: my.server/test/codeigniter/ but when I go to my.server/test/codeigniter/show my show.php doesn't load. Am I doing this correctly?

I should mention I've tried public function show() also and it doesn't work, also I have no .htaccess file in the directory

Any advice would help!

A: 

Ken Struys comment on your question is correct. The default controller status you give a controller means that controller and the index function will load if you go to my.server/test.

Other than that, you need to include index.php/controller_name/function_name to get to your controller functions.

Unless that is, you implement some fancy .htaccess url rewriting, which I can't help you with.

kevtrout
+1  A: 

Two rules are enough in your .htaccess file:

# check if the requested resource is not an existing file
RewriteCond %{REQUEST_FILENAME} !-f

# rewrite internally to index.php
RewriteRule ^(.*)$ index.php [QSA,L]

Mod_rewrite and AllowOverride All assumed enabled.

mhitza