i use ubuntu 10.10 and codeigniter 2.0.2
i have successfully installed CI by opening welcome index page
later on i was following tutorial and have added new controller to my project:
class Start extends CI_Controller{
var $base;
var $css;
function __construct() {
parent::__construct();
$this->base=$this->config->item('base_url');
$this->css=$this->config->item('css');
}
function hello($name){
$data['css'] = $this->css;
$data['base'] = $this->base;
$data['mytitle'] = 'Welcome to this site';
$data['mytext'] = "Hello, $name, now we're getting dynamic!";
$this->load->view('testview', $data);
}
}
as well as view(testview.php) and css variable in question. then upon trying to test it by executing http://localhost/ci/index.php/index/start/hello/fred i get 404 page not found.
thank you
use this class declaration instead
and instead of your php4 constructor
use this instead of
Start()The actual reason you’re getting a 404 is because you’re telling it to find a function called
fred. The url you’re probably meaning to hit is this…Since 2.0.x , Codeigniter has changed their base controller class names and moved everything to php5 style constructors, among other things.
You are probably following a older tutorial.