[eluser]gwerner[/eluser]
[quote author="CroNiX" date="1344898301"]If you extend the Form_validation class, it's not a callback any longer. It's only a callback function if it exists in the controller. It's now a regular validation function like any of the others that come with form_validation. So you shouldn't have "callback_" as the prefix to the rule name in the set_rules().[/quote]
I think I may have been unclear in my first post. I am currently including this in the controller. I am then accessing it with the callback_ in the form validation in the controller. I just wanted to know which way is better. As a callback or extending the Form_validation. It looks like either is ok depending on if it will be used beyond this single controller.
[quote author="Aken" date="1344901731"]What you're doing is fine. I'd only turn it into a validation rule of some sort if you use the same callback code in multiple controllers (don't repeat yourself).
Also a random tidbit - you can return the expression check instead of doing an entire if/else check:
Code:
return ($start_date <= $end_date);
[/quote]
Makes sense and thanks for the reminder on the expression check. Old habits.
[quote author="CroNiX" date="1344904954"]And you actually can access CI's functions from within libraries, or extended libraries using
Code:
$CI =& get_instance();
$some_post_var = $CI->input->post('some_post_var');
[/quote]
I tend to forget this as well, thanks for the reminder.