[eluser]vincej[/eluser]
HI - I pulled this out of PyroCMS which is built on CI. I can not see what the point is of these 3 lines of code:
Code:
$sample = new stdClass;
foreach ($this->item_validation_rules as $rule)
{
$sample->{$rule['field']} = $this->input->post($rule['field']);
}
To my eyes, all it appears to do is put the input post into a an empty class as a property ... but so what. It them goes on to use $sample as part of the view,
Code:
// Build the view using sample/views/admin/form.php
$this->template
->title($this->module_details['name'], lang('sample.new_item'))
->set('sample', $sample)
->build('admin/form');
I am obviously missing something - any ideas ??
Many thanks !