views:

175

answers:

2

Is there a way to call a method inside the controller from our view using codeigniter.I know it is a bad practice but, now I force to do this.Thank you

+3  A: 

You can just do:

$this->controller_method();

While this might answer your question, I personally agree with the comments of – Matthew J Morrison and DamienL.

Kurucu
A: 

in your controller put

$data['myClass'] = $this;

That way when you send the data to the view, it will load the controller :)

Then you can access the methods like

$myClass->method();

Haruo