Preventing DRY in OOP - 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: Preventing DRY in OOP (/showthread.php?tid=60071) |
Preventing DRY in OOP - El Forum - 01-11-2014 [eluser]ivantcholakov[/eluser] @behnampmdg3 This is what I would do: Code: class Base_Class extends CI_Controller { // Or MY_Controller Then within the ancestor controllers or views I would access needed data this way: Code: // Example 1 An amendment, using the helper, if it has been loaded: Code: <h1><?php echo registry('title'); ?></h1> Preventing DRY in OOP - El Forum - 01-11-2014 [eluser]behnampmdg3[/eluser] @ivantcholakov I am not using library. I am using MY_Controller. In child, at the moment I do this: Code: class Account extends MY_Controller { Thanks Preventing DRY in OOP - El Forum - 01-12-2014 [eluser]InsiteFX[/eluser] If you use either ivantcholakov's or my Registry then you should not have any problems, set the registry with your data then use the registry methods to call back the values. |