![]() |
Load a function from a library for all functions into a 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: Load a function from a library for all functions into a controller (/showthread.php?tid=57048) |
Load a function from a library for all functions into a controller - El Forum - 02-10-2013 [eluser]GonzaFY[/eluser] I am sorry if you can't understand me, my english isn't the best... Ok, I am trying to load a data for all my pages (into a controller).. My code is this: Code: <?php But it gives an error: undefined variable data... If I put '$data = $this->miembros->Datos();' into function index() it works very well but I need load this data for all pages and I don't want put it on each function.. Thanks guys ^^! Load a function from a library for all functions into a controller - El Forum - 02-10-2013 [eluser]p5systems[/eluser] Hi Please declare $data as global and access by $this pointer Code: <?php Thanks Load a function from a library for all functions into a controller - El Forum - 02-10-2013 [eluser]GonzaFY[/eluser] It works perfectly! Thanks ^^! |