__construct() is called first, then according to URL is called index() or other functions.
public function __construct() should contain:
- allocating resources used in entire class ex. $this->load
- check user authentication (if entire class requires it)
public function index() should contain:
- allocating resources used only in this function
- calling views or displaying anything
it is bad design if public function __construct() contain:
- Displaying anything
- Any code required only for one function.