php - How can I separate the callback logic in the one single file using codeigniter? -


I use config.php to store all form_validation rules ... but I have to callback the function in one I would like to store a single file too, how can I do this? any idea? Thank you ....

Now my file is something like this:

User Controller has several customized callback_with the user controller, but I'll configure the config. Run all the rules in php. I want to insert _valid callback to a class. Thank you.

By default, Form_validation lib $ CI property to use it Uses callback method. Usually it looks on the current controller. However, you can change this behavior by increasing the accreditation class and by changing the run () method. MY_Form_validation Expands CI_Form_validation {/ ** * Support for verification callback Object to run callback from any object * * @access public * @param object * @param string Is there any validation rule to reach the URI? * Returning Bull validation status * / Function run ($ obj = '', $ group = '') {// Callback object Diagnose if (is_object ($ obj)) $ this- & gt; CI = & amp; $ Obj; // Run verification as normal return parent: run ($ group); }}

We are just reassigning the property to $ CI for example, using callback from class called user_validation To do this, you can:

  $ callback_class = $ this- & gt; User_validation; If ($ the-> - form_validation- & gt; play ($ callback_class)) {}   

A weighted class will work, so that you can store callback rules in the model or library , Simply pass the object that you want to handle callback with the run () method.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -