[eluser]JamieBarton[/eluser]
Hey guys,
I'm doing sort of a news system, what is the best way to perform line beaks. My articles in the DB have line breaks, however, when i load the view (below) everything is crammed together. How can I get round this?
controller:
Code:
function article()
{
$requested_id = $this->uri->segment(3);
$data['query'] = $this->db->where('id', $requested_id);
$data['query'] = $this->db->limit(1);
$data['query'] = $this->db->get('news');
$this->layout->view('news/article', $data, array('page_name' => "news"));
}
view:
Code:
<div id="main">
<?php if ($query->num_rows() > 0) { $row = $query->row(); ?>
<h2><?=$row->title?></h2>
<p><?=$row->body?></p>
<?php } else { ?>
<h2>Not found</h2>
<p>Sorry, we couldn't find the news article you were after.</p>
<?php } ?>
</div>
Regards,
Jamie