[eluser]Chris Blackwell[/eluser]
I'm new to CodeIgniter, and just started using version 2. I'm a little confused on when to use the constructor when creating a new class. Some tutorials I see use it, and some don't. Here is a code sample showing the difference:
Code:
class Site extends CI_Controller
{
function Site()
{
parent::Controller();
}
public function index()
{
echo 'Welcome to my new site!';
}
}
Versus:
Code:
class Site extends CI_Controller
{
public function index()
{
echo 'Welcome to my new site!';
}
}
What is the difference?