Need help in 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: Need help in Controller (/showthread.php?tid=41644) |
Need help in Controller - El Forum - 05-13-2011 [eluser]raiser[/eluser] Dear Friends, How can i reduce the code in controller? That is, is there any way to include helper files and library files only once? Now i am including individually for each and every function. So kindly guide me to avoid this.. Here, the below code gives you an idea of what i am following the structure now... Code: class Events_awards extends CI_Controller{ Hope you can understand the code.. If any difficulty, let me know.. Need help in Controller - El Forum - 05-13-2011 [eluser]toopay[/eluser] You can put any helper/library loading statement into your constructor function, or if you use them in any controllers (or most of them) consider to autoload all that stuffs. Need help in Controller - El Forum - 05-13-2011 [eluser]raiser[/eluser] Thanks toopay for replying.. Can you explain little bit clearly? I cant understand what you are suggesting.. I am a new bie to this CI.. Need help in Controller - El Forum - 05-13-2011 [eluser]toopay[/eluser] About loading library and helper at once in constructor, here you can do that... Code: class Events_awards extends CI_Controller{ Need help in Controller - El Forum - 05-13-2011 [eluser]raiser[/eluser] Thanks toopay.. It is working now.. I defined all files in autoload.php.. |