I'm really a newbie in MVC Framework and as well as in CodeIgniter. Is it possible to access model in view in CodeIgniter without breaking MVC framework? This is what I'm talking about.
Below is my code for my view.
foreach ($packages as $row)
{
if($row->Category == "Wedding")
{
$package_name = $row->package_name;
$ratings = $model->ratings($package_name);
foreach ($ratings as $row_review)
{
}
}
}
And this is in my model
public function ratings($package_name)
{
$this->db->select('round(sum(Rating)/count(Rating)) as total');
$this->db->where('package_name', $package_name);
$query = $this->db->get('tbl_review');
return $query->result();
}