Going berzerk with MY_Controller - 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: Going berzerk with MY_Controller (/showthread.php?tid=49046) |
Going berzerk with MY_Controller - El Forum - 02-06-2012 [eluser]Marc Arbour[/eluser] Hi friends. I have thrown the gloves down with CI for the 1st time since I've used it. I have briefly tought to do it the old PHP way but said to myself that I should ask you guys for help. I have a clean new CI 2.1 running the latest LAMP architecture. I am trying to make some mathematical calculations before the controlers executions (for ALL controllers) in MY_Controller and use the variable's content (the result) in the controllers. I have tried every approaches I've found on this forum as well as others (stackoverflow to name just that one). I've copy/pasted/changed/tested code like I had never done before. 8 hours later and more then 4 dozen threads... I admit defeat" Whatever I do and try, MY_Controller (in application/core) works because I can use the variables in the views... But not in the controllers. Could someone find it in their heart to copy/paste me some working code? I am interested in using the data produced in the MY_Controller to further process in controllers. Regards. Going berzerk with MY_Controller - El Forum - 02-06-2012 [eluser]scottwire[/eluser] Try this: Code: class MY_Controller extends CI_Controller Going berzerk with MY_Controller - El Forum - 02-06-2012 [eluser]Marc Arbour[/eluser] THANKS! On the spot! I don't know what I have done wrong because I tought I tried that. Or maybe was it in the __construct() Maybe I should've asked earlier. I spent too much time pulling my hair on this one. Thanks ScottWire! Going berzerk with MY_Controller - El Forum - 02-06-2012 [eluser]InsiteFX[/eluser] The class name doe's not have to be MY_Controller it can be anything you want! It just has to be saved as ./application/core/MY_Controller.php Going berzerk with MY_Controller - El Forum - 02-06-2012 [eluser]Marc Arbour[/eluser] Hi InsightFX I had tried to "stay on the path" of the other user's example. But having the opportunity to rename the class will help me. Thanks Marc |