[eluser]mpar612[/eluser]
Hi everyone, I have done this dozens of times and am totally stumped as to why it isn't working.
For some reason the $data from my controller is not being made available to my view. If I do print_r($data) in my controller, it returns all of the data appropriately. If I access $artist in my view I get an error - Undefined variable: data
I am still pretty new to Codeigniter. Any thoughts or suggestions on places to start looking? Thanks!
I have this function in my controller:
Code:
public function view($slug)
{
$data['artist'] = $this->artist_model->get_artist($slug);
if(empty($data['artist']))
{
show_404();
}
$this->load->view('artists/view', $data);
}
I have this function in my model:
Code:
public function get_artist($slug = FALSE)
{
if($slug === FALSE)
{
$query = $this->db->get('artists');
return $query->result_array();
}
$query = $this->db->get_where('artists', array('slug' => $slug));
return $query->row_array();
}