CodeIgniter Forums
organizing private functions - 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: organizing private functions (/showthread.php?tid=11568)



organizing private functions - El Forum - 09-14-2008

[eluser]Insteps[/eluser]
I have books, authors, sellers controllers. In controllers I have some private functions like
Code:
_setBookByAuthor($a) {
...
}

The function calls a common model function, and some helper functions for text manipulations and sets appropriate output in an array.

Incidentally this function became a bit generic and could be used from all controllers.

Is there a way of defining these kind of functions once so maintenance becomes easier?

Thanks.


organizing private functions - El Forum - 09-14-2008

[eluser]Derek Allard[/eluser]
Welcome to CI Insteps!

You'd probably want to build a custom library for this.

http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html