Welcome Guest, Not a member yet? Register   Sign In
Can someone advise what this code snippet does ?
#1

[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 !



Messages In This Thread
Can someone advise what this code snippet does ? - by El Forum - 02-05-2014, 02:31 PM
Can someone advise what this code snippet does ? - by El Forum - 02-05-2014, 03:07 PM
Can someone advise what this code snippet does ? - by El Forum - 02-05-2014, 03:10 PM
Can someone advise what this code snippet does ? - by El Forum - 02-05-2014, 04:17 PM
Can someone advise what this code snippet does ? - by El Forum - 02-05-2014, 05:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB