[eluser]Chris.Campbell[/eluser]
[quote author="座頭市" date="1185427349"]Basically, you need to return something from your function get_header(), right now all it
doing is calling the model then storing the data in an array called $data rather than returning it:
Code:
function header_view()
{
$this->load->model('Main_model');
return $this->Main_model->get_header();
}
As mentioned by Imkow@CN, you are currently returning the model call as an array, which is fine if you need it, but just from the code you posted, it might be better to use row() rather than result(), at returns a single object rather than an array of objects. Mind you, this is just a guess from your code.
In the view, you have an array of
objects, not a multidimensional array, so you should be accessing it like this:
Code:
<title><?=$header[0]->title;?></title>
If you want to return a multidimensional array, use result_array() rather than result() in the model.[/quote]
I used the suggestions you outlined such as using row() and return, I am confused about how I would output this in the header now.