Accesing Controller Data from module - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Accesing Controller Data from module (/showthread.php?tid=18062) |
Accesing Controller Data from module - El Forum - 04-24-2009 [eluser]Uto[/eluser] Is it possible to access to properties of the calling controller from a module other than passing it as parameters? I mean something like: Code: $this->parent->propertyname I have a module that was able to load all data needed from constructor itself, no needing any parameters, and it's widely used in the application. But now, under some circunstances, that happen a 0.5% of the times it's used, it may need to get a property from the "parent" controller, and changing it all over the code is quite risky. Accesing Controller Data from module - El Forum - 04-24-2009 [eluser]pistolPete[/eluser] What do you mean by "parent" controller, do you mean class inheritance? Code: Parent_controller extends Controller { Accesing Controller Data from module - El Forum - 04-24-2009 [eluser]Uto[/eluser] [quote author="pistolPete" date="1240584759"]What do you mean by "parent" controller, do you mean class inheritance? Code: Parent_controller extends Controller { Well, I explained it badly. I mean the "calling" controller, like: In the controller: Code: $this->someproperty = 10; In the module: Code: $x = $this->callingcontroller->someproperty; |