CodeIgniter Forums
callbacks in library - 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: callbacks in library (/showthread.php?tid=57427)



callbacks in library - El Forum - 03-13-2013

[eluser]Unknown[/eluser]
Hey, codeIgniter community. I have some questions. Lets say I have controller:

Code:
class Test extends CI_Controller{

     public function test(){

           $this->form_validation->set_rules("test", "test", "callback_test");

     }

     public function test($str){

          doing stuff..... blah blah

     }

}

So, I using callback from same controller... How I can, put all my callbacks in library, so they can be reached from any controllers, or i can put same library in others projects? I hope will understand my question. Sorry for bad english.


callbacks in library - El Forum - 03-13-2013

[eluser]Aken[/eluser]
Extend the Form_validation library and add your rules there. Then you can specify them like any other rule: without the callback_ prefix.