Single Responsibility Principal |
[eluser]Otemu[/eluser]
Hi, You could make better use of the Codeigniter Validation class, for instance you have a lot of Code: if (strtotime($user_data->lock_date) > $current_time) Quote:The validation system supports callbacks to your own validation functions. This permits you to extend the validation class to meet your needs. For example, if you need to run a database query to see if the user is choosing a unique username, you can create a callback function that does that So for instance to check status you could run a callback: Code: $this->form_validation->set_rules('username', 'Username', 'required|check_status'); Quite a few of your if else statements can also be changed to just switch statements. Then just use set_message for each one. You can also save sets of rules in a config file Form Validation Also check out Flattening Arrow Code and The Single Responsibility Principle |
Messages In This Thread |
Single Responsibility Principal - by El Forum - 01-12-2013, 05:04 PM
Single Responsibility Principal - by El Forum - 01-13-2013, 07:49 PM
Single Responsibility Principal - by El Forum - 01-14-2013, 02:55 AM
Single Responsibility Principal - by El Forum - 01-14-2013, 11:51 AM
Single Responsibility Principal - by El Forum - 01-24-2013, 07:53 PM
Single Responsibility Principal - by El Forum - 01-25-2013, 12:31 PM
Single Responsibility Principal - by El Forum - 01-26-2013, 12:48 PM
|