OOP Question! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: OOP Question! (/showthread.php?tid=12892) |
OOP Question! - El Forum - 11-04-2008 [eluser]Lazos[/eluser] Hi. I have this Home Controller and using Admin_Theme::doTopMenu($topmenu) I run a function that is in a custom Admin_Theme class. In the user guide is writing that if you want to call a function of a library use this $this->admin_theme->doTopMenu();. If I write it this way I am getting the following error Message: Undefined property: Admin_Theme::$lang in my Admin_Theme class. Now if I change the way the function is called like this Admin_Theme::doTopMenu($topmenu); everything is working properly. If is not big trouble can you explain me what is the difference between them and why when I use this -> is not working but when I use this :: it is? Also which way do you recommend? Thanks. EDIT1: Well I found a solution in another post in the forum. I had to use this $this->CI =& get_instance(); inside my _constructor. I am not sure if is correct though. If is correct or not still try to explain it. Code: class Home extends Controller { Code: function doTopMenu ($topmenu) { |