12-29-2012, 10:33 AM
[eluser]Unknown[/eluser]
Hi everybody,
I started using CI and I'm having a problem with database entry listing.
I list the entries fine, but I need to assign some template to them.
For instance
Function for DB listing is as follows:
Now, if I echo the template in foreach loop, I'll most likely get some kind of error, since I noticed CI is really strict about output, but I have no idea, even if that works, how to send it to the view.
Hi everybody,
I started using CI and I'm having a problem with database entry listing.
I list the entries fine, but I need to assign some template to them.
For instance
Code:
<div class="class">$title</div>
<div class="class">$date</div>
Function for DB listing is as follows:
Code:
$query = $this->db->get('posts', 10);
foreach($query->result() as $row) {
$data[] = $row;
}
return $data;
Now, if I echo the template in foreach loop, I'll most likely get some kind of error, since I noticed CI is really strict about output, but I have no idea, even if that works, how to send it to the view.