Welcome Guest, Not a member yet? Register   Sign In
how do you deal with your variables?
#2

[eluser]Phil Sturgeon[/eluser]
A method I like is:

Quote:Set all rules in array.
Foreach array_keys(rules), define $field array using language->item($field)

Validate

if($validate->run)
output error
else:
output success message
endif

$entry = some_model->getFromID($entryID)

foreach array_key(rules)
$data[$field] = isset(validation->$field) ? validation->field : $entry[$field]
endforeach

And BAM! You got a really small controller with error checking and language features, REALLY few code and no big old lists.

Hope the psuedo code will do it, its late and cba writing in syntax.


Messages In This Thread
how do you deal with your variables? - by El Forum - 08-08-2007, 05:05 PM
how do you deal with your variables? - by El Forum - 08-08-2007, 05:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB