Situation: A method in a model is fetching info from a database. I call this method in a controller sending a url-segment as an argument. This is to get pageinfo. Now I’m having a hard time getting the info in the shape I want it. The info is pasted to $this->data[‘page_contents’] as an array. With my limited skill I can’t alter data. I would like to separate page_contents. Like this.
page_contents (just an example)
Array(
[0] Array(
[page] = Start
[title] = Welcome
[text] = Lorem ipsum...
)
[1] Array(
[page] = Start
[title] = Hi again
[text] = Ut enim ad...
)
)
Now I’m ending up with a solution thats somewhat questionable.
The view-file:
foreach($page_contents AS $row)
{ echo $row->page; break; }
The controller I’m tinkering with:
$url_segment = $this->uri->segment(1, 'home');
$this->data['page_contents'] = $this->pagesdata->get_page_content($url_segment,1);
$data['header'] = $this->load->view('view_html_head', $this->data, true);
$this->load->view('view_index', $this->data);
