Welcome Guest, Not a member yet? Register   Sign In
Validation+Filtering
#12

[eluser]RESPECT[/eluser]
try to follow what colin said, keep things divided up as it was 'intended' to be with the term MVC (model, view, controller).
I know what I'm about to say now goes against my previous thoughts (please dont colin Tongue) but it would be better to have those validation rules tied into your controller as it allows your application to be more agile, rather then having the rules set in the model. If you have base validation rules and functions, just setup another controller, then make all of your other controllers extend it.

ex.

Random controller(magic happens with the extend partSmile)
Code:
<?php
class Portfolio extends Validation_Controller {
#code...
}
?>

Validation Controller
Code:
<?php
class Validation_Controller extends Controller {

function Validation_Controller {
parent::Controller();
var $validation_rules['standard'] = array (
  'name' => 'required' // etc. etc.
);

var $validation_rules['extreme'] = array (
  'name' => 'required' // etc. etc.
);
}

function _set_validation_rules($rules = 'standard')
{
  if (is_array($rules)) {
    $this->validation->set_rules($rules) // allow the use of custom rules
  } else {
    $this->validation->set_rules($this->validation_rules[$rules]);
  }
  
}

}
?>

Your way is good but try not to put that sorta stuff in the model...though error checking like this:
Code:
function view_all_from($table) {
    $query = $this->db->get($table);
    $exe = !$query ? false : $query->result();

    return $exe;
    }
imho is goodSmile


Hope this helps,

Respect


Messages In This Thread
Validation+Filtering - by El Forum - 09-25-2008, 06:04 PM
Validation+Filtering - by El Forum - 09-25-2008, 06:32 PM
Validation+Filtering - by El Forum - 09-25-2008, 07:05 PM
Validation+Filtering - by El Forum - 09-25-2008, 10:13 PM
Validation+Filtering - by El Forum - 09-25-2008, 11:40 PM
Validation+Filtering - by El Forum - 09-26-2008, 10:10 PM
Validation+Filtering - by El Forum - 09-26-2008, 11:29 PM
Validation+Filtering - by El Forum - 09-27-2008, 03:22 PM
Validation+Filtering - by El Forum - 09-28-2008, 05:16 PM
Validation+Filtering - by El Forum - 09-29-2008, 02:35 PM
Validation+Filtering - by El Forum - 09-29-2008, 02:52 PM
Validation+Filtering - by El Forum - 09-29-2008, 09:46 PM
Validation+Filtering - by El Forum - 09-30-2008, 09:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB