codeigniter constructor

cycledude
cycledude used Ask the Experts™
on
Hi Everyone

I am stuck with the constructor in codeigniter.....

class Members_area extends CI_Controller {

	
	public function __contruct()
	{
		parent::__construct();
		
		echo "hello from constructor";
		
	}

          
        public function index()
	{	
		
		
		echo "hello from index method";
		

		
		
	}
	

Open in new window


I go to the 'members_area' in my url like

www.example.com/index.php/members_area

but the 'hello from the constructor' is not firing... any idea what is going wrong?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Its been a while since I last used CI but I do believe the class name is case sensitive in the URL. So you should be visiting example.com/index.php/Members_area

Author

Commented:
Hi Derokorian

Thanks for the help, but I don't think that is the problem.....

in the example above, if i typed in

mydomain.com/index.php/members_area

I will see

hello from index method

on the page, but nothing else.....  I would have expected the constructor to be called with every page request, and it just isn't.... so I must have screwed something up somewhere...
Don't know why I didn't notice this the first time:
public function __contruct()

Open in new window

You're missing the 's' in construct.

Author

Commented:
Well spotted Derokorian

Can't believe that I missed that !! ;0)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial