public function renderEach($viewTemplate, $data, $eachItemName, $empty = 'raw|')
{
$result = '';
// If is actually data in the array, we will loop through the data and append
// an instance of the partial view to the final result HTML passing in the
// iterated value of this data array, allowing the views to access them.
if (count($data) > 0) {
foreach ($data as $key => $value) {
$data = array('key' => $key, $eachItemName => $value);
$result .= $this->loadAnyTemplate($viewTemplate, $data);
}
} else {
if (starts_with($empty, 'raw|')) {
$result = substr($empty, 4);
} else {
$result = $this->loadAnyTemplate($empty);
}
}
return $result;
}