[eluser]theprodigy[/eluser]
The easiest way (in my opinion) to have base available to all controllers, is to create a class in your application/libraries folder called MY_Controller, and have it extend Controller. Then, have all your controllers extend MY_Controller instead of Controller (does that make sense?)
Example:
application/libraries/MY_Controller.php
Code:
class MY_Controller extends Controller // <--- extends Controller
{
protected $base;
public function __construct()
{
parent::__construct(); // <---- make sure to call the parent constructor
$this->base = $this->config->item('base_url');
}
}
application/controllers/start.php
Code:
class Start extends MY_Controller // <--- extends MY_Controller
{
public function __construct()
{
parent::__construct();
// Already contains $this->base through inheritance
}
}
To answer your question about Class Start and Function Start, yes at least for right now.
In PHP4, the constructors were named the same as the class. In PHP5, they changed the constructors to be __construct() to follow suit with the rest of the PHP Magic Methods that they implemented. As far as I know, PHP only deprecated the old constructor style and not deleted it entirely. I believe it will still look for it in the case of a missing __construct() function. I wouldn't bet on it lasting for too much longer though, so I wouldn't create new code with that style.